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

#
# machine specific makefile for msdos, c7
#

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

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

#	Non portable programs
#
COBJS=	mouse.obj stick.obj console.obj timer.obj pcserial.obj packet.obj \
	slip.obj speaker.obj pcdos.obj drivers.obj grqc.obj grfast.obj misc.obj

AOBJS=	msubs.obj

OBJS=	$(COBJS) $(AOBJS)

HFILES=	..\fly.h config.h

.PRECIOUS: msubs.obj


all:	fly8sys.lib 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 & >>$(RSP)
	echo +slip +speaker +pcdos +drivers +grqc +grfast +misc; >>$(RSP)
	lib @$(RSP)
	del $(RSP)

$(COBJS):	$(HFILES)

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

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

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

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

timer.obj:	pc8254.h

msubs.obj:	msubsobj
	copy msubsobj msubs.obj

#
# These are needed or the comms may lock the machine up.
#
packet.obj:	$(HH)\pktdrvr.h
	$(CC) -c $(CFLAGS) -Od -Gs2 packet.c

slip.obj:	$(HH)\pktdrvr.h
	$(CC) -c $(CFLAGS) -Od -Gs2 slip.c

#
# Utility programs
#

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

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

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

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