# "makefile" for CML0
#
# Set up for use with Microsoft VC++, 32-bit edition.   Generated code
# should run using Win32s or Win32.

# go "make debug=1" to create a version suitable for debugging.

!if "x$(DEBUG)"=="x"
!if "x$(NOOPT)"=="x"
LFLAGS =
CFLAGS = -Ox -DCWIN=1 -DFOR_ML=1 -D__STDC__=1
!else
LFLAGS =
CFLAGS = -Od -DCWIN=1 -DFOR_ML=1 -D__STDC__=1
!endif
!else
LFLAGS = -debug:full -debugtype:cv
CFLAGS = -Zi -Od -DCWIN=1 -DFOR_ML=1 -D__STDC__=1
!endif

default:	cml.exe cml.hlp

# The definitive version of the source for CWIN lives somewhere else
# so I copy a version to the current directory if necessary

CWIN = d:\acn\cwin

cwin.cpp:	$(CWIN)\cwin.cpp
	copy $(CWIN)\cwin.cpp cwin.cpp

cwin.h:	$(CWIN)\cwin.h
	copy $(CWIN)\cwin.h cwin.h

#############################################################################

cml.exe:	cwin.obj fam.obj interp.obj io.obj store.obj system.obj bignum.obj plot.obj cml.res
	link $(LFLAGS) -out:cml.exe \
	-subsystem:windows -entry:WinMainCRTStartup \
	cwin.obj fam.obj interp.obj io.obj store.obj system.obj bignum.obj plot.obj \
	nafxcw.lib libc.lib kernel32.lib user32.lib gdi32.lib \
	winspool.lib advapi32.lib olecli32.lib olesvr32.lib \
	shell32.lib comdlg32.lib winmm.lib cml.res

cml.res:	cml.rc cwin.h cml.ico
	rc -r cml.rc

cml.hlp:	cml.prj cml.ico cml.bmp \
		toplvl.rtf graph.rtf refer.rtf \
		use.rtf menu.rtf gloss.rtf
	hc31 cml.prj

cwin.obj:	cwin.cpp cwin.h
	cl -c -W3 $(CFLAGS) -DFOR_ML=1 cwin.cpp

fam.obj:	fam.c globdefs.h structs.h globvars.h debug.h io.h system.h
	cl -c -W2 $(CFLAGS) fam.c

interp.obj:	interp.c globdefs.h structs.h globvals.h io.h \
		bcodes.h debug.h system.h
	cl -c -W2 $(CFLAGS) interp.c

io.obj:	io.c globdefs.h structs.h globvars.h io.h system.h
	cl -c -W2 $(CFLAGS) io.c

store.obj:	store.c globdefs.h structs.h globvars.h bcodes.h \
		debug.h system.h
	cl -c -W2 $(CFLAGS) store.c

system.obj:	system.c globdefs.h structs.h globvars.h system.h
	cl -c -W2 $(CFLAGS) system.c

bignum.obj:	bignum.c globdefs.h structs.h globvars.h system.h
	cl -c -W2 $(CFLAGS) bignum.c

plot.obj:	plot.c globdefs.h structs.h globvars.h system.h
	cl -c -W2 $(CFLAGS) plot.c

# Now some attempt to show how all ML can be rebuild provided you
# have the critical binary file phase1.exp

phase2.exp:	phase1.exp
	wx cml -h 8000 -i phase1.ml -l phase1.log phase1.exp

phase3.exp:	phase2.exp
	wx cml -h 8000 -i phase2.ml -l phase2.log phase2.exp

sml.exp:	phase3.exp
	wx cml -h 8000 -i bsml.ml   -l phase3.log phase3.exp

cml.exp:	sml.exp
	wx cml -i cml.sml sml.exp


clean:
	-del *.obj
	-del *.exe
	-del *.ph
	-del *.ph
	-del *.res
	-del *.hlp

# end of makefile

