# (c) 1999-2007 Electronic Arts Inc.

.silent:

all:: spit.lib avi2chunk.exe asflocale.exe moviecat.exe huff.exe whereis.exe chimp.exe glump.exe rifft.exe chunkify.exe unchunkify.exe gsr.exe crc.exe imagetohex \
 spit_eg.exe zarg.exe xd.exe math.exe zrun.exe timex.exe copyr.exe zcut.exe tabs.exe zhelp.exe zfilesize.exe zrename.exe recurse.exe makepad.exe filepad.exe bighead.exe \
 cmp.exe cymbal.exe author.exe bingrep.exe bmw.exe gs.exe hashid.exe sleep.exe txt.exe eapu.exe fmj.exe touch.exe getfiletime.exe \
 unslash.exe xl.exe dis.exe sortshp.exe hhmerge.exe uni.exe abstract.exe  e.exe url.exe venom.exe zcopy.exe ztee.exe chunk2avi.exe vid2div.exe sony2dvd.exe dvdmap.exe \
 du.exe cdu.exe paddvd.exe filestat.exe
#db.exe fp.exe ie.exe acdc.exe

SPITOBJS=spit.obj stdgimex.obj hashlist.obj findfile.obj wildmatch.obj expr.obj range.obj ranger.obj gclip.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 /W3 /nologo /DATL_NO_LEAN_AND_MEAN /DWIN32_LEAN_AND_MEAN /Zi /DDEBUG=1
LINKOPTS=/nologo /version:3.99 /STACK:16777216 /INCREMENTAL:NO /SUBSYSTEM:CONSOLE /DEBUG /IGNORE:4098
!ELSE
CCOPTS=/c /MT /O2 /GF /Gy /W3 /WX /nologo /DATL_NO_LEAN_AND_MEAN /DWIN32_LEAN_AND_MEAN /Zi
LINKOPTS=/nologo /version:3.99 /STACK:16777216 /INCREMENTAL:NO /SUBSYSTEM:CONSOLE /IGNORE:4098
!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

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

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

.rc.res::
    rc -r $<

.pl.exe::
	echo making perlapp --force
	perlapp --force $*.pl

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

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

imagetohex: imagetohex.exe
avi2chunk: avi2chunk.exe
asflocale: asflocale.exe
moviecat: moviecat.exe
du: du.exe
cdu: cdu.exe
dvdmap: dvdmap.exe
txt: txt.exe
eapu: eapu.exe
fmj: fmj.exe
touch: touch.exe
getfiletime: getfiletime.exe
db: db.exe
fp: fp.exe
ie: ie.exe
crc: crc.exe
acdc: acdc.exe
abstract: abstract.exe
author: author.exe
bingrep: bingrep.exe
bmw: bmw.exe
chunkify: chunkify.exe
unchunkify: unchunkify.exe
cmp: cmp.exe
copyr: copyr.exe
cymbal: cymbal.exe
dis: dis.exe
dvdmap: dvdmap.exe
filestat: filestat.exe
gs: gs.exe
gsr: gsr.exe
hashid: hashid.exe
math: math.exe
sleep: sleep.exe
spit_eg: spit_eg.exe
zarg: zarg.exe
tabs: tabs.exe
timex: timex.exe
uni: uni.exe
unslash: unslash.exe
url: url.exe
xl: xl.exe
zcut: zcut.exe
zhelp: zhelp.exe
zfilesize: zfilesize.exe
zrename: zrename.exe
zrun: zrun.exe
sortshp: sortshp.exe
hhmerge: hhmerge.exe
whereis: whereis.exe
venom: venom.exe
zcopy: zcopy.exe
ztee: ztee.exe
recurse: recurse.exe
chunk2avi: chunk2avi.exe
vid2div: vid2div.exe
expr_test: expr_test.exe
falloc_test: falloc_test.exe
hash_eg: hash_eg.exe
bighead: bighead.exe
sony2dvd: sony2dvd.exe
makepad: makepad.exe 
filepad: filepad.exe 
bighead: bighead.exe 

imagetohex.exe: imagetohex.obj	 spit.lib
avi2chunk.exe:  avi2chunk.obj	 spit.lib
asflocale.exe:  asflocale.obj	 spit.lib
moviecat.exe:  moviecat.obj	 spit.lib
touch.exe: 		touch.obj
getfiletime.exe: getfiletime.obj
txt.exe: 		txt.obj	         spit.lib
eapu.exe: 		eapu.obj	     spit.lib
fmj.exe: 		fmj.obj	         spit.lib
db.exe: 		db.obj	         spit.lib
fp.exe: 		fp.obj	         spit.lib
ie.exe: 		ie.obj	         spit.lib
crc.exe: 		crc.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
unchunkify.exe:	unchunkify.obj   spit.lib
cmp.exe:		cmp.obj	         spit.lib
copyr.exe:	    copyr.obj        spit.lib
cymbal.exe:      cymbal.obj      spit.lib
dis.exe:		dis.obj	         spit.lib
dvdmap.exe:		dvdmap.obj
e.exe:		    e.obj 	         spit.lib
gs.exe: 		gs.obj	         spit.lib
gsr.exe:		gsr.obj	         spit.lib
hashid.exe:      hashid.obj      spit.lib
math.exe:		math.obj	     spit.lib
sleep.exe:	    sleep.obj        spit.lib
spit_eg.exe:    spit_eg.obj      spit.lib
zarg.exe:       zarg.obj         spit.lib
tabs.exe:		tabs.obj	     spit.lib
timex.exe:	    timex.obj        spit.lib
uni.exe:	    uni.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
zfilesize.exe:  zfilesize.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
venom.exe:	    venom.obj        spit.lib
zcopy.exe:	    zcopy.obj        spit.lib
ztee.exe:	    ztee.obj         spit.lib
recurse.exe:    recurse.obj
chunk2avi.exe: chunk2avi.obj	 spit.lib
vid2div.exe:	vid2div.obj	     spit.lib
expr_test.exe: 	expr_test.obj	 spit.lib
hash_eg.exe:	hash_eg.obj		 spit.lib
bighead.exe:    bighead.obj
sony2dvd.exe:   sony2dvd.obj
makepad.exe:    makepad.obj
filepad.exe:    filepad.obj
bighead.exe:    bighead.obj

timex.obj: zrun.cpp
gs.obj: gsr.cpp
spit.obj: spit.h falloc.h

du.exe: du.pl
	perlapp --force du.pl

cdu cdu.exe: cdu.pl
	perlapp --force cdu.pl

paddvd paddvd.exe: paddvd.pl
	perlapp --force paddvd.pl

cymbal cymbal.exe: cymbal.obj $(SPITOBJS)
	@link $(LINKOPTS) cymbal.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)

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)

whereis whereis.exe: whereis.obj whereis_tool.obj $(SPITOBJS)
	@LIB /out:whereis.lib whereis.obj
	@link $(LINKOPTS) /OUT:whereis.exe whereis.obj whereis_tool.obj $(SPITOBJS) $(STDLIBS) mpr.lib vfw32.lib

#	@cl /clr /LD whereis.cpp winmm.lib user32.lib gdi32.lib advapi32.lib mpr.lib vfw32.lib

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

rifft rifft.exe: rifft.obj ansi.obj stdgimex.obj
	@link $(LINKOPTS) /OUT:rifft.exe rifft.obj ansi.obj stdgimex.obj $(STDLIBS)
