.AUTODEPEND

.PATH.cpp= .

# allow overriding of the name of the compiler
!if !$d(CC)
CC=tcc
!endif

# set if using BC++3, which implements C++ language spec 2.1
!if $d(VERSION21)
VERSION21=-DVERSION21
!endif

# allow precompiled headers
!if $d(DASHH)
HFLAG=-H=$(DASHH)
!endif

# set memory model
!if !$d(MODEL)
MODEL=s
!endif

# destination for OBJ files
!if !$d(OBJ)
OBJ= .
!endif

# where you keep your libraries
!if !$d(LIBDEST)
LIBDEST= $(LIBPREFIX)$(MODEL)
!endif

.PATH.obj= $(OBJ)

L1 = $(LIB)\c0$(MODEL)
#Link1 -- startup code

L2 = $(LIB)\c$(MODEL)
#Link2 -- library

CMDLLIB=$(LIBDEST)\cmdl.lib
#name of this lib

.cpp.obj:
   $(CC) -c -Ii $(VERSION21) $(HFLAG) -n$(.PATH.obj) {$< }

OBJS= \
cmdl.obj      output.obj    scanner.obj   common.obj    int.obj   \
string.obj    flag.obj      report.obj    help.obj

$(CMDLLIB): $(OBJS)
   del $<
   tlib /C $< @&&!
+$(OBJ)\cmdl     +$(OBJ)\output   +$(OBJ)\scanner  +$(OBJ)\common    &
+$(OBJ)\int      +$(OBJ)\string   +$(OBJ)\flag     +$(OBJ)\report    &
+$(OBJ)\help
!

# generic EXE rule
.obj.exe:
   tlink $(TLINK_BUGSW) $(MAPFLAG) @&&!
$(L1)+$*
$&.exe
$(mapfile)
$(CMDLLIB)+$(L2)
!

