# Released to the public domain.
#
# Anyone and anything may copy, edit, publish,
# use, compile, sell and distribute this work
# and all its parts in any form for any purpose,
# commercial and non-commercial, without any restrictions,
# without complying with any conditions
# and by any means.

# Produces MSDOS executable.
# Links with PDPCLIB created by makefile.wcd.

CC=wcl
COPTS=-ecc -q -w -c -ml -zl -D__MSDOS__ -fpi87 -s -zdp -zu -Icclib -Icclib\include -Icpplib -Icpplib\include -I. -I..\pdpclib

all: clean pdcc.exe

pdcc.exe: main.obj c_ppout.obj inc_path.obj xmalloc.obj cclib.lib cpplib.lib
  wlink File main.obj,c_ppout.obj,inc_path.obj Name pdcc.exe Form dos Library cpplib.lib,cclib.lib,..\pdpclib\watcom.lib Option quiet

cpplib.lib: cpplib\core.obj cpplib\directs.obj cpplib\errors.obj \
          cpplib\expr.obj cpplib\files.obj cpplib\chars.obj \
          cpplib\idents.obj cpplib\init.obj cpplib\lex.obj \
          cpplib\macro.obj cpplib\support.obj cpplib\symtab.obj
    rm -f cpplib.lib
    wlib -b -q cpplib +core.obj
    wlib -b -q cpplib +directs.obj
    wlib -b -q cpplib +errors.obj
    wlib -b -q cpplib +expr.obj
    wlib -b -q cpplib +files.obj
    wlib -b -q cpplib +chars.obj
    wlib -b -q cpplib +idents.obj
    wlib -b -q cpplib +init.obj
    wlib -b -q cpplib +lex.obj
    wlib -b -q cpplib +macro.obj
    wlib -b -q cpplib +support.obj
    wlib -b -q cpplib +symtab.obj
    wlib -b -q cpplib +xmalloc.obj

cclib.lib: cclib\cclib.obj cclib\diag.obj cclib\lexer.obj cclib\asgen.obj
    rm -f cclib.lib
    wlib -b -q cclib +cclib.obj
    wlib -b -q cclib +diag.obj
    wlib -b -q cclib +lexer.obj
    wlib -b -q cclib +asgen.obj

.c.obj:
  $(CC) $(COPTS) $<

clean:
    rm -f *.obj cpplib/*.obj cpplib.lib pdcc.exe
