SHELL = c:\bin\tcsh.ttp
# The official makefile for GEM compiled with Alcyon and Lattice
# makefile for Lattice C 5.5
#
# NOTE: This makefile will create DESK.PRG -
#	The ALTERNATIVE DESKTOP - a runtime.
#	The variable DESKPRG must be set to TRUE in:
#
# 		DESKVARI.C
#		DESKTOP.C
#		DESKSTAR.S
#		DESKROM.C
#		DOSBIND.C
#	See below at the DEFINES/CDEPEND/ASDEPEND
#
# NOTE:	Set the SOFTLOAD flag to implement softloaded GEM AES/DESKTOP
#	resources. The AES will then try to read its resource file from
#	[A|C]:\MULTITOS\GEM.RSC.  
#
#	You have to define SOFTLOAD in DESKTOP.C and DESKROM.C
#	See SOFTLOAD.H
#
#
# NOTE:	Set the ONERSC flag to indicate that the system just has the
#	U.S. desktop resource in ROMs. If the system cannot load the
#	GEM.RSC from disk, it will displaying a warning, saying that
#	the U.S. version from ROM will be used.
#	This variable is in DESKTOP.C and DESKROM.C
#	See SOFTLOAD.H
#
# NOTE:	Turn on resource file version number checking by setting the
#	GEMRSVER to 1. Use "rscvers versnr GEM.RSC"
#	to create a GEM.RSC with a version number in the first byte of the
#	resource header. This is to prevent user from using the wrong
#	resource file.
#	This variable GEMRSVER is found in DESKROM.C
#	See SOFTLOAD.H
#
# NOTE:	Turn on resource file version number checking by setting the
#	DESKRSVER to 1. Use "rscvers versnr DESKTOP.RSC"
#	to create a DESKTOP.RSC with a version number in the first byte of the
#	resource header. This is to prevent user from using the wrong
#	resource file.
#	This variable DESKRSVER is found in DESKROM.C
#	See SOFTLOAD.H

#	These files will be touched before any compiling/linking, so
#	that it is made sure that they are compild with the correct
#	define of DESKPRG.
#
CDEPEND  = desktop.c deskvari.c dosbind.c deskrom.c
ASDEPEND = deskstar.s

#
#
# Compiler options
#

DEFINES	   = '-dDESKPRG=1'

MASDEFINES = '-D=DESKPRG=1'


# Flags for lc.ttp
#
# -w	16-bit ints
# -b0	full 32-bit addressing
# -bn	unknown
# -r0	subroutine calls will use absolute 32-bit relocated address
# -d 	Just enables debug info from line number/offset table
# -v	disable stack checking
# -rs	standard stack params
# -z2	generate DRI format objects
# -cf	force prototype checking
# NOTE: 3 files do not like the optimizer: deskdisk.c gemfslib.c deskfile.c

CMODEL	= -w -b0 -bn -r0 -v -rs -m3 -z2 -cf #-O
CFLAGS	= $(DEFINES) $(CMODEL)  

# Flags for just linking, see target
#
# -N	don't compile, just link
# -Labg	a	cause extended debug info in executable
#	b	batch option of the linker
#	g	search the AES and VDI library first
LDFLAGS	= -N $(CMODEL) -d -Labg 

# Assembly flags
#
ASFLAGS = $(DEFINES) -ie:\lc5\i

## Files that depend on the country switches are all dependent
## on the makefile, so you don't need to go deleting a bunch
## of objects every time you make a new country.

#### Country definitions

COUNTRY = usa

## NOTE: When making UK AES, set COUNTRY to usa and CDEF to UK.
##       This will build a ttaesusa.o which must then be manually
##	 renamed to ttaesuk.o.
##	The same goes for SWISSGER and SWISSFRA -- use grm and fre,
##	and manually rename the ttaesxxx.o file that gets built.


#
# Headers
#

STDESK.H =	portab.h deskdefi.h deskwin.h desk$(COUNTRY).h
STGEM.H =	machine.h gemusa.h
#GEMPD.H =	pdstruct.h dispvars.h
#GEMOLIB.H =	obdefs.h gemlib.h

RSC1 =		glue.usa
RSC2 =		glue.grm 
RSC3 =		glue.fre
RSC4 =		glue.ita 
#RSC5 =		glue.swe
RSC6 = 		glue.spa

.c.o:
	lc -c $(CFLAGS) -o$@ $<


.s.o:
	mas -us $(MASDEFINES) $*.s



#
# Objects
#

STARTUP =	apstart.oo

DESKOBJ = 	desktop.o deskact.o deskapp.o deskvdi.o deskbutt.o \
		deskdir.o deskdisk.o deskfile.o deskinf.o deskins.o \
		deskmenu.o deskmisc.o deskmn.o deskopen.o \
		deskpref.o desksele.o deskshel.o deskshow.o deskvari.o\
		deskupda.o desksear.o kballoc.o \
		deskstar.o deskmem.o deskwin.o\
		aesbin73

DESKBOTH = 	deskrom.o deskboth.o ctrlbind.o\
		traps.o dosbind.o utility.o large.o\
		romcart.o



#
# Default target
#
desk:		touchdepend desk.prg

touchdepend:
		touch $(CDEPEND) $(ASDEPEND)

desk.prg:	$(STARTUP) $(DESKOBJ) $(DESKBOTH) $(RSC1) $(RSC2) $(RSC3) $(RSC4) $(RSC6)

		aln -u -s -o desk.prg $(STARTUP) $(DESKOBJ) $(DESKBOTH)\
		-i $(RSC1) _USARSC -i $(RSC2) _GRMRSC -i $(RSC3) _FRERSC\
		-i $(RSC4) _ITARSC -i $(RSC6) _SPARSC


		prgflags 7 7 desk.prg
		@echo 'desk.prg made.'

#
# Dependencies
#

deskact.o:	$(STDESK.H) 
deskshow.o:	$(STDESK.H)
desktop.o:	$(STDESK.H) osbind.h extern.h mintbind.h signal.h 
deskmn.o:	$(STDESK.H) vdomode.h 
deskupda.o:	$(STDESK.H) 
deskvari.o:	$(STDESK.H) osbind.h
deskvdi.o:	portab.h vdidefs.h
deskwin.o:	$(STDESK.H) osbind.h 
deskpref.o:	$(STDESK.H) osbind.h
desksear.o:	$(STDESK.H) 
desksele.o: 	$(STDESK.H)
deskshel.o:	$(STDESK.H)
deskapp.o:	$(STDESK.H)
deskbutt.o:	$(STDESK.H)
deskdir.o:	$(STDESK.H) error.h osbind.h 
deskinf.o:	$(STDESK.H)
deskins.o:	$(STDESK.H) osbind.h
deskmem.o:	$(STDESK.H) extern.h	 
deskmenu.o: 	$(STDESK.H) mintbind.h
deskmisc.o:	$(STDESK.H) 
deskdisk.o:	$(STDESK.H) 
deskopen.o:	$(STDESK.H)
deskfile.o: 	$(STDESK.H) osbind.h

dosbind.o:  gemdos.h
romcart.o:  $(STGEM.H) gemdos.h
utility.o:  $(STGEM.H) objaddr.h obdefs.h
ctrlbind.o: portab.h crysbind.h obdefs.h    
kballoc.o:  osbind.h

deskstar.o:
traps.o:
large.o:
