# $Header
# This is the 16 bit make file
# This makefile was tested with NT4.0 and MSVC 1.5

CWDIR=c:\ed\cwbeta
CWVDIR=c:\cwvc

INCDIR=-I$(CWDIR)\cwstart -I$(CWDIR)\include 

LIBDIR=$(CWDIR)\lib\win16
CWVLIBDIR=$(CWVDIR)\lib

STARTUP=$(CWDIR)\cwstart\cwstart.h
EXPORTS=$(CWDIR)\include\exports.h

CWBASE=grepquik
CWVBASE=grepquif


cwright: $(CWBASE).dll


all: cwright fusion $(CWBASE).bsc

clean:
	del $(CWBASE).obj
	del $(CWBASE).bak
	del $(CWBASE).map
	del $(CWVBASE).map
	
realclean: clean
	del $(CWBASE).dll
	del $(CWVBASE).dll


# W3 sets warning level
# ALw selects large model
# G2 generates 80286 code
# Gs disables stack checking (Ge enables)
# Gw generates Windows prologs/epilogs for real-mode FAR calls
# Od disables optimization
# Ow assumes aliasing only across function calls
# Zp specifies structure packing--should be followed by 1|2|4|8|16
# Zi specifies full debug information
# Zd specifies partial debug info--line numbers only
# FR builds the BSC (browser database) file

#CC=cl -c $(INCDIR) $(CWSTARTDEF) -W3 -DMT -ALw -G2sw -Ows -Zpe -FR
CC=cl -c $(INCDIR) $(CWSTARTDEF) -W3 -DMT -ALw -Ows -Zpe -FR
# Uncomment to compile with Borland C
#CC=BCC -WD -ml -c -M -v -DBORLAND $(INCDIR)

$(CWBASE).obj: $(CWBASE).c $(EXPORTS) $(STARTUP)
	$(CC) $(CWBASE).c
	
# comment this line out if you take -FR out of the cl command line
#
$(CWBASE).bsc: $(CWBASE).sbr
	bscmake -o $(CWBASE).bsc $(CWBASE).sbr
	
$(CWBASE).dll: $(CWBASE).obj $(LIBDIR)\libentry.obj .\win16\$(CWBASE).def $(LIBDIR)\cwstart.lib
	link /CO/NOD/li $(CWBASE) $(LIBDIR)\libentry,win16\$(CWBASE).dll,,libw ldllcew $(LIBDIR)\cwright $(LIBDIR)\cwstart,win16\$(CWBASE).def
	
# Uncomment to link with Borland's tlink
#	tlink /Twd /n /m /v c0dl.obj $(CWBASE).obj, $(CWBASE), , cwl cl import $(LIBDIR)\cwright $(LIBDIR)\cwstart,$(CWBASE)

	rc win16\$(CWBASE).dll

$(CWVBASE).dll: $(CWBASE).obj $(CWVLIBDIR)\libentry.obj win16\$(CWVBASE).def $(CWVLIBDIR)\cwvstart.lib
	link /CO/NOD/li $(CWBASE) $(CWVLIBDIR)\libentry,win16\$(CWVBASE).dll,,libw ldllcew $(CWVLIBDIR)\cwvdll $(CWVLIBDIR)\cwvstart,win16\$(CWVBASE).def
	
# Uncomment to link with Borland's tlink
#	tlink /Twd /n /m /v c0dl.obj $(CWBASE).obj, $(DLLDIR)\$(CWVBASE), , cwl cl import $(CWVLIBDIR)\cwvdll $(CWVLIBDIR)\cwvstart,$(CWVBASE)

	rc win16\$(CWVBASE).dll
