# $Header

all: .\selmotn.dll

clean:
	del selmotn.obj
	del selmotn.out
	del selmotn.bak
	del selmotn.map

realclean: clean
	del selmotn.dll

CWDIR=j:\cw3b
# set to "cwstart" or "startup"
START=cwstart
CWSTARTDEF=-DCWSTART

INCDIR=-I$(CWDIR)\$(START) -I$(CWDIR)\include 
LIBDIR=$(CWDIR)\lib
EXEDIR=$(CWDIR)
DLLDIR=.
STARTUP=$(CWDIR)\$(START)\$(START).h
EXPORTS=$(CWDIR)\include\exports.h

# 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
# 0w 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

CC=cl -c $(INCDIR) $(CWSTARTDEF) -ALw -G3w -Odw -Zp2 -Zi
# Uncomment to compile with Borland C
#CC=BCC -WD -ml -c -M -v -DBORLAND $(INCDIR)

selmotn.obj: selmotn.c $(EXPORTS) $(STARTUP)
	$(CC) selmotn.c

$(DLLDIR)\selmotn.dll: selmotn.obj $(LIBDIR)\libentry.obj selmotn.def $(LIBDIR)\$(START).lib
	link /CO/NOD/li selmotn $(LIBDIR)\libentry,selmotn.dll,,libw ldllcew $(LIBDIR)\cwright $(LIBDIR)\$(START),selmotn.def
# Uncomment to link with Borland's tlink
#	tlink /Twd /n /m /v c0dl.obj selmotn.obj, $(DLLDIR)\selmotn, , cwl cl import $(LIBDIR)\cwright $(LIBDIR)\cwstart,selmotn
	rc $(DLLDIR)\selmotn.dll
