##### Module Macros ####
NAME	= CountDOS
SRCS	= $(NAME).c wintime.c
ASMSRC  = callback.asm cdoscall.asm
OBJS	= 

##### C7 Macro #####
C7	    = 1

##### Library Macros #####
LIBS	= libw slibcew
MOD	    = -AS

##### Include Macro #####
INCLS	= $(NAME).h wintime.h 

##### Resource Macro #####
RCFILES = $(NAME).rc

##### DEBUG Macro Defined #####
DEBUG	= 1

##### Build Option Macros #####
!if $(DEBUG)
DDEF	= -DDEBUG
CLOPT	= -Zid -Od
MOPT	= -Zi
LOPT	= /CO /LI /MAP
!else
DDEF	=
CLOPT	= -Os
LOPT	=
!endif

##### General Macros #####
DEF	    = -DSTRICT -D_WINDOWS

##### Tool Macros #####
ASM	    = masm -Mx $(MOPT) $(DDEF) $(DEF)
CC	    = cl -nologo -c -G2sw -Zp -W3 $(MOD) $(CLOPT) $(DDEF) $(DEF)
LINK	= link /A:16/NOD/NOE $(LOPT)
RC	    = rc $(DDEF) $(DEF)
HC	    = hc

##### Inference Rules #####
.c.obj:
    $(CC) $*.c

.asm.obj:
    $(ASM) $*.asm;

.rc.res:
    $(RC) -r $*.rc

##### Main (default) Target #####
goal: $(NAME).exe setfocus.exe

##### Dependents For Goal and Command Line #####
#####
##### Note that TSR.EXE is deleted after building COUNTDOS.EXE.  
##### This is because TSR.EXE gets included into COUNTDOS.EXE as
##### its stub program.
#####
$(NAME).exe: $(SRCS:.c=.obj) $(ASMSRC:.asm=.obj) $(NAME).def $(NAME).res tsr.obj
!if $(DEBUG)
    link /M/CO tsr;
    mapsym tsr
!else
    link tsr;
!endif
    $(LINK) @<<
    $(SRCS:.c=.obj) $(ASMSRC:.asm=.obj) $(OBJS),
    $(NAME).exe,
    $(NAME).map,
    $(LIBS),
    $(NAME).def
<<
    $(RC) -T $(NAME).res
!if $(DEBUG)
!if !$(C7)
    cvpack -p $(NAME).exe
!endif
    mapsym $(NAME).map
!endif
    del tsr.exe

##### Build the SetFocus application #####
setfocus.exe:   setfocus.c
!if $(DEBUG)
    cl -Zi -Od setfocus.c
!else
    cl setfocus.c
!endif

##### Build the TSR (used as stub for CountDOS) #####
tsr.obj: tsr.asm doscalls.asm
!if $(DEBUG)
    masm /Zi tsr;
!else
    masm tsr;
!endif

##### Dependents #####
$(SRCS:.c=.obj):  $(INCLS)
$(ASMSRC:.asm=.obj): $(INCLS)
$(NAME).res: $(RCFILES)

##### Clean Directory #####
clean:
    -del *.obj
    -del *.res
    -del *.exe
    -del *.map
    -del *.sym
