# Makefile - Don Yang (uguu.org)
#
# For use with MSVC++ 6.0
#
# 12/21/00

cc = cl
rc = rc
ld = link
b2c = bmp2c.exe
bheader = bheader.cpp
objs = bg.obj bgfx.obj dd.obj game.obj gfx.obj global.obj input.obj log.obj \
	main.obj sound.obj sprite.obj spritefx.obj term.obj windoze.obj \
	font.obj label0.obj label1.obj label2.obj label3.obj numbers.obj \
	tiles.obj title.obj
libs = advapi32.lib ddraw.lib dxguid.lib gdi32.lib user32.lib winmm.lib
resources = resource.res
target = otika.exe

!if "$(debug)" == "1"
cflags = -Fo$*.obj -nologo -Od -W4 -YXglobal.h -Zi
rflags = -r -fo$*.res
lflags = -debug -machine:ix86 -nologo -opt:ref -out:$*.exe -subsystem:windows
uflags = -Fe$*.exe -nologo -Od -W4
!else
cflags = -FInodebug.h -Fo$*.obj -GF6rs -nologo -Ob2gity -W4
rflags = -r -fo$*.res
lflags = -incremental:no -machine:ix86 -nologo -opt:ref -out:$*.exe -release
uflags = -Fe$*.exe -FInodebug.h -GF6rs -nologo -Ob2gity -W4
!endif


.cpp.obj:
	$(cc) -c $(cflags) $*.cpp

.c.exe:
	$(cc) $(uflags) $*.c

.rc.res:
	$(rc) $(rflags) $*.rc


all: $(target)

$(target): $(objs) $(resources)
	$(ld) $(lflags) $(objs) $(resources) $(libs)

bg.obj: bg.cpp global.h bg.h bgfx.h main.h

bgfx.obj: bgfx.cpp global.h bgfx.h

dd.obj: dd.cpp global.h bg.h dd.h main.h sprite.h

game.obj: game.cpp global.h game.h sound.h

gfx.obj: gfx.cpp global.h bg.h dd.h gfx.h resource.h sprite.h term.h

global.obj: global.cpp global.h

input.obj: input.cpp global.h game.h input.h resource.h term.h

log.obj: log.cpp global.h log.h resource.h

main.obj: main.cpp global.h bg.h dd.h game.h gfx.h input.h main.h sound.h \
	sprite.h term.h windoze.h

sound.obj: sound.cpp global.h main.h resource.h sound.h

sprite.obj: sprite.cpp global.h images.h main.h sprite.h spritefx.h

spritefx.obj: spritefx.cpp global.h spritefx.h

term.obj: term.cpp global.h bg.h game.h images.h input.h objinfo.h resource.h \
	sprite.h term.h

windoze.obj: windoze.cpp global.h bg.h game.h input.h main.h sprite.h windoze.h

resource.res: resource.rc resource.h icon.ico blip.wav clear.wav special.wav

global.h: log.h

images.h: font.h label0.h label1.h label2.h label3.h numbers.h tiles.h title.h

windoze.h: resource.h

font.h: font.cpp

label0.h: label0.cpp

label1.h: label1.cpp

label2.h: label2.cpp

label3.h: label3.cpp

numbers.h: numbers.cpp

tiles.h: tiles.cpp

title.h: title.cpp

font.obj: font.cpp font.bmp

label0.obj: label0.cpp label0.bmp

label1.obj: label1.cpp label1.bmp

label2.obj: label2.cpp label2.bmp

label3.obj: label3.cpp label3.bmp

numbers.obj: numbers.cpp numbers.bmp

tiles.obj: tiles.cpp tiles.bmp

title.obj: title.cpp title.bmp

font.cpp: font.bmp $(b2c) $(bheader)
	$(b2c) -c cpp -h h -p $(bheader) $*.bmp

label0.cpp: label0.bmp $(b2c) $(bheader)
	$(b2c) -c cpp -h h -p $(bheader) $*.bmp

label1.cpp: label1.bmp $(b2c) $(bheader)
	$(b2c) -c cpp -h h -p $(bheader) $*.bmp

label2.cpp: label2.bmp $(b2c) $(bheader)
	$(b2c) -c cpp -h h -p $(bheader) $*.bmp

label3.cpp: label3.bmp $(b2c) $(bheader)
	$(b2c) -c cpp -h h -p $(bheader) $*.bmp

numbers.cpp: numbers.bmp $(b2c) $(bheader)
	$(b2c) -c cpp -h h -p $(bheader) $*.bmp

tiles.cpp: tiles.bmp $(b2c) $(bheader)
	$(b2c) -c cpp -h h -p $(bheader) $*.bmp

title.cpp: title.bmp $(b2c) $(bheader)
	$(b2c) -c cpp -h h -p $(bheader) $*.bmp

$(b2c): bmp2c.c


clean:
	if exist font.cpp del font.cpp
	if exist label*.cpp del label*.cpp
	if exist numbers.cpp del numbers.cpp
	if exist tiles.cpp del tiles.cpp
	if exist title.cpp del title.cpp
	if exist font.h del font.h
	if exist label*.h del label*.h
	if exist numbers.h del numbers.h
	if exist tiles.h del tiles.h
	if exist title.h del title.h
	if exist *.cpp~ del *.cpp~
	if exist *.h~ del *.h~
	if exist *.rc~ del *.rc~
	if exist *.ilk del *.ilk
	if exist *.obj del *.obj
	if exist *.pch del *.pch
	if exist *.pdb del *.pdb
	if exist *.res del *.res
