#
#  Makefile for Waterloo TCP Http Daemon Sample
#

TCCINCLUDE=C:\borlandc\include
#TCCINCLUDE=C:\tc\include

DEBUG= D        # set to D for disable, E for enable
MODEL= S        # set to L for large, S for small

#
# auto configure section
#

!if '$(DEBUG)'=='E'
IDEBUG=-v
TEXTDEBUG=enabled
!elif '$(DEBUG)'=='D'
IDEBUG=-v-
TEXTDEBUG=disabled
#!else
#!error  DEBUG must be set to either E or D
!endif

!if '$(MODEL)'=='L'
CMODEL=-ml
CLIB=..\lib\wattcplg.lib
TEXTMODEL=large
!elif '$(MODEL)'=='S'
CMODEL=-ms
CLIB=..\lib\wattcpsm.lib
TEXTMODEL=small
!else
!error  MODEL must be set to either S or L
!endif

DEBUGS= -v -Wall

CFLAGSOBJS= $(DEBUGS) -DMSDOS -IC:\borlandc\include -I..\include
#CFLAGSOBJS= $(DEBUGS) -DMSDOS -IC:\bc4\include -I..\include
CCO= bcc $(CFLAGSOBJS)

CFLAGS= $(CMODEL) -r- $(IDEBUG) -IC:\borlandc\include -I..\include
#CFLAGS= $(CMODEL) -r- $(IDEBUG) -IC:\bc4\include -I..\include
CC= bcc $(CFLAGS)
#CC= tcc $(CFLAGS)

#
#  list of executables
#

.c.exe:
        $(CC) $*.c $(CLIB)

#exes.arc: httpd.exe bghttp.obj
exes.arc: httpd.exe 

# host.exe
        echo done $(TEXTMODEL) make with debugging $(TEXTDEBUG)

#bghttp.obj: bghttp.c ..\include\wattcp.h
#        echo "Making the background process"
#        $(CCO) bghttp.c 

httpd.exe: httpd.c bghttp.c
        echo "Making the main daemon"
        $(CC) httpd.c bghttp.c $(CLIB)

clean:
      del httpd.exe
      del *.obj
#      make

