# (c) 1999-2007 Electronic Arts Inc.

.silent:

all:: spit.lib lumpy.lib lumpy_eg.exe huff.exe author.exe bingrep.exe bmw.exe chunkify.exe cmp.exe copyr.exe crc.exe cymbal.exe dis.exe glump.exe gs.exe gsr.exe hashid.exe math.exe mathx.exe sleep.exe spit_eg.exe bloodhound_eg.exe tabs.exe txt.exe unslash.exe xd.exe xl.exe zcut.exe zhelp.exe zrename.exe zrun.exe sortshp.exe hhmerge.exe timex.exe undup.exe chimp.exe lumpy.exe \
 abstract.exe db.exe fp.exe ie.exe acdc.exe e.exe url.exe whereis.exe venom.exe zcopy.exe recurse.exe chunktoavi.exe

SPITOBJS=spit.obj stdgimex.obj hash.obj findfile.obj wildmatch.obj expr.obj range.obj ranger.obj gclip.obj gsocket.obj bloodhound.obj
STDLIBS=user32.lib version.lib shell32.lib ole32.lib comdlg32.lib winmm.lib wsock32.lib gdi32.lib advapi32.lib tapi32.lib rasapi32.lib wininet.lib ddraw.lib dxguid.lib

ifdef DEBUG
CCOPTS=/c /MTd /Od /GF /Gy /GB /W3 /WX /nologo /DATL_NO_LEAN_AND_MEAN /DWIN32_LEAN_AND_MEAN /Zi /DDEBUG=1
LINKOPTS=/nologo /version:3.64 /INCREMENTAL:NO /SUBSYSTEM:CONSOLE /DEBUG

else
CCOPTS=/c /MT /O2 /GF /Gy /GB /W3 /WX /nologo /DATL_NO_LEAN_AND_MEAN /DWIN32_LEAN_AND_MEAN
LINKOPTS=/nologo /version:3.64 /INCREMENTAL:NO /SUBSYSTEM:CONSOLE /DEBUG

endif

# ICL should be set in the users environment to icl or cl
# only Intel C versions should be publically posted, if at all possible

ifndef ICL
ICL=cl
endif

%.obj: %.cpp
	$(ICL) $(CCOPTS) $<

%.obj: %.c
	$(ICL) $(CCOPTS) $<

%.res: %.rc
	rc -r $<

%.exe: %.obj
	echo linking $*
	link $(LINKOPTS) /OUT:$*.exe $*.obj spit.lib $(STDLIBS)

spit.lib: $(SPITOBJS)
	@echo building spit library
	@LIB /out:spit.lib $(SPITOBJS)

lumpy.lib: lumpylib.obj $(SPITOBJS)
	@echo building lumpy library
	@LIB /out:lumpy.lib lumpylib.obj $(SPITOBJS)

txt: txt.exe
db: db.exe
fp: fp.exe
ie: ie.exe
acdc: acdc.exe
abstract: abstract.exe
author: author.exe
bingrep: bingrep.exe
bmw: bmw.exe
chunkify: chunkify.exe
cmp: cmp.exe
copyr: copyr.exe
crc: crc.exe
cymbal: cymbal.exe
dis: dis.exe
gs: gs.exe
gsr: gsr.exe
hashid: hashid.exe
huff: huff.exe
math: math.exe
mathx: mathx.exe
sleep: sleep.exe
spit_eg: spit_eg.exe
bloodhound_eg: bloodhound_eg.exe
tabs: tabs.exe
timex: timex.exe
undup: undup.exe
unslash: unslash.exe
url: url.exe
xl: xl.exe
zcut: zcut.exe
zhelp: zhelp.exe
zrename: zrename.exe
zrun: zrun.exe
sortshp: sortshp.exe
hhmerge: hhmerge.exe
whereis: whereis.exe
venom: venom.exe
zcopy: zcopy.exe
recurse: recurse.exe
chunktoavi: chunktoavi.exe


txt.exe:		txt.obj 		 spit.lib
db.exe: 		db.obj			 spit.lib
fp.exe: 		fp.obj			 spit.lib
ie.exe: 		ie.obj			 spit.lib
acdc.exe:		acdc.obj		 spit.lib
abstract.exe:	abstract.obj	 spit.lib
author.exe: 	author.obj		 spit.lib
bingrep.exe:	bingrep.obj 	 spit.lib
bmw.exe:		bmw.obj 		 spit.lib
chunkify.exe:	chunkify.obj	 spit.lib
cmp.exe:		cmp.obj 		 spit.lib
copyr.exe:		copyr.obj		 spit.lib
crc.exe:		crc.obj 		 spit.lib
cymbal.exe: 	 cymbal.obj 	 spit.lib
dis.exe:		dis.obj 		 spit.lib
e.exe:			e.obj			 spit.lib
gs.exe: 		gs.obj			 spit.lib
gsr.exe:		gsr.obj 		 spit.lib
hashid.exe: 	 hashid.obj 	 spit.lib
huff.exe:		huff.obj		 spit.lib
math.exe:		math.obj		 spit.lib
mathx.exe:		mathx.obj		 spit.lib
sleep.exe:		sleep.obj		 spit.lib
spit_eg.exe:	spit_eg.obj 	 spit.lib
bloodhound_eg.exe: bloodhound_eg.obj spit.lib
tabs.exe:		tabs.obj		 spit.lib
timex.exe:		timex.obj		 spit.lib
undup.exe:		undup.obj		 spit.lib
unslash.exe:	unslash.obj 	 spit.lib
url.exe:		url.obj 		 spit.lib
xl.exe: 		xl.obj			 spit.lib
zcut.exe:		zcut.obj		 spit.lib
zhelp.exe:		zhelp.obj		 spit.lib
zrename.exe:	zrename.obj 	 spit.lib
zrun.exe:		zrun.obj		 spit.lib
sortshp.exe:	sortshp.obj 	 spit.lib
hhmerge.exe:	hhmerge.obj 	 spit.lib
whereis.exe:	whereis.obj 	 spit.lib
venom.exe:		venom.obj		 spit.lib
zcopy.exe:		zcopy.obj		 spit.lib
recurse.exe:	recurse.obj
chunktoavi.exe: chunktoavi.obj	 spit.lib

timex.obj: zrun.cpp
mathx.obj: math.cpp
gs.obj: gsr.cpp

cymbal cymbal.exe: cymbal.obj $(SPITOBJS)
	@link $(LINKOPTS) cymbal.obj $(SPITOBJS) $(STDLIBS)

locomoto locomoto.exe: locomoto.obj DataTableIndex.obj ustr.obj $(SPITOBJS)
	@link $(LINKOPTS) Locomoto.obj DataTableIndex.obj ustr.obj $(SPITOBJS) $(STDLIBS)

huff huff.exe: huff.obj huffbest.obj huffu.obj huffview.obj $(SPITOBJS)
	@link $(LINKOPTS) /OUT:huff.exe huff.obj $(SPITOBJS) huffbest.obj huffview.obj huffu.obj codex.lib $(STDLIBS)

lumpy lumpy.exe: lumpy.obj $(SPITOBJS) lumpy.lib
	@link $(LINKOPTS) /OUT:lumpy.exe lumpy.obj $(SPITOBJS) codex.lib $(STDLIBS)

lumpy_eg lumpy_eg.exe: lumpy_eg.obj $(SPITOBJS) lumpy.lib
	@link $(LINKOPTS) /OUT:lumpy_eg.exe lumpy_eg.obj $(SPITOBJS) lumpy.lib codex.lib $(STDLIBS)

chimp chimp.exe: chimp.obj $(SPITOBJS)
	@link $(LINKOPTS) /OUT:chimp.exe chimp.obj $(SPITOBJS) $(STDLIBS)

xd xd.exe: xd.obj $(SPITOBJS)
	@link $(LINKOPTS) /OUT:xd.exe xd.obj $(SPITOBJS) $(STDLIBS)

glump glump.exe: glump.obj $(SPITOBJS)
	@link $(LINKOPTS) /OUT:glump.exe glump.obj $(SPITOBJS) codex.lib $(STDLIBS)

# /GX required because a c++ exception handler is not to be used.
locomoto.obj: locomoto.cpp
	$(ICL) $(CCOPTS) /GX locomoto.cpp

DataTableIndex.obj: DataTableIndex.cpp
	$(ICL) $(CCOPTS) /GX DataTableIndex.cpp
