# makefile
#
# This is part of the flight simulator 'fly8'.
# Author: Eyal Lebedinsky (eyal@ise.canberra.edu.au).
#

#
# machine specific makefile for msdos, ms qc
#

CDIR=	..\..
HH=	$(CDIR)\h
RSP=	$(TMP)\libfly8.rsp

CFLAGS= -I$(HH) -I.. $(XFLAGS) -DC7GRAPH 

#	Non portable programs
#
COBJS=	mouse.obj stick.obj dosstick.obj console.obj timer.obj pcserial.obj \
	packet.obj slip.obj pcdos.obj drivers.obj misc.obj \
	grfast.obj s3.obj grqc.obj grstat.obj plspeak.obj plsound.obj \
	grvesa.obj vesa.obj vgr.obj pcudp.obj

AOBJS=	msubs.obj

OBJS=	$(COBJS) $(AOBJS)

HFILES=	..\fly.h config.h

.PRECIOUS: msubs.obj


all:	fly8sys.lib exe

exe:	gettimer.exe settimer.exe joytest.exe

fly8sys.lib:	$(OBJS)
	if exist fly8sys.lib del fly8sys.lib
	echo fly8sys >$(RSP)
	echo y >>$(RSP)
	echo +mouse +stick +console +timer +pcserial +packet & >>$(RSP)
	echo +msubs +dosstick +grstat & >>$(RSP)
	echo +slip +pcdos +drivers +grfast +s3 +grqc +misc & >>$(RSP)
	echo +plspeak +plsound +grvesa +vesa +vgr +pcudp; >>$(RSP)
	lib @$(RSP)
	del $(RSP)

$(COBJS):	$(HFILES)

plsound.obj:	$(HFILES) ..\notes.h

plspeak.obj:	$(HFILES) ..\notes.h pc8254.h

grfast.obj:	$(HFILES) ..\colors.h $(HH)\gr.h

grvesa.obj:	$(HFILES) ..\colors.h vgr.h vesa.h

vesa.obj:	$(HFILES) vgr.h vesa.h

vgr.obj:	$(HFILES) vgr.h

grqc.obj:	$(HFILES) ..\colors.h

pcserial.obj:	$(HH)\com.h

timer.obj:	pc8254.h

stick.obj:	stick.h

dosstick.obj:	stick.h

packet.obj:	$(HH)\pktdrvr.h

slip.obj:	$(HH)\pktdrvr.h

msubs.obj:	msubs.asm
	$(CC) -c msubs.asm
	copy msubs.obj msubs.qc

#
# Utility programs
#

gettimer.exe:	gettimer.c
	$(CC) -AL -Ox -W4 gettimer.c
	lzexe gettimer.exe
	del gettimer.old

settimer.exe:	settimer.c
	$(CC) -AL -Ox -W4 settimer.c
	lzexe settimer.exe
	del settimer.old

joytest.exe:	joytest.c
	$(CC) -AL -Ox -W4 joytest.c
	lzexe joytest.exe
	del joytest.old

clean:
	-del *.exe
	-del *.obj
	-del *.lib
	-del *.rsp
