.SUFFIXES : .68k

#
# Defines for web server routines
#

VERSION = PRODUCTION

#
# default c.lln (.ol) make rule
#

.c.ln:
	$(CC) $*.c -opfile mr4800e.opt -o $*.lln
	llink $*.lln -lo -w -v -o $*.ln
	libr $*.ln -L embhttp.l -err+ errs -0 -v
	del $*.lln

#
# Names of compiler and assembler
#
CC=c68360

#
# Compiler Flags
#
CCFLAGS=$(cclist) $(debug) $(model) $(warn) $(inc) $(optmz)

#
# Assembler Flags
#
# -ex   - IMSI extensions (especially, ELSEC)
#
ASFLAGS=$(aslist) $(debug) $(warn) $(inc) -ex

#
# compiler optimizations
#
# -n7         no stack-fixup deferral
# -ia         needed for _CASM, force compiler to use an assembly step
#
optmz=-n7 -ia 

#
# compiler listing
#
# -l file  = listing to file
# -i       = interleave C and asm
# -nf      = narrow format
# -x       = cross reference listing
# -0       = show version #
# -v          verbose
# -V          very verbose
#
#cclist=-err+ errs
#cclist=-l -i -nf
#cclist=-err+ errs -0 -l $*.lis -i -nf
#cclist=-err+ errs -0 -i -nf -v
cclist=-err+ errs -i -nf

#
# assembler listing
#
# -l file = listing to file
# -a      = list included files
# -b      = symbol table and macros
# -s      = source listing no #included source
# -g      = global symbol listing
# -m      = show macro expansions
# -x      = cross reference listing
# -U      = list unassembled conditional source 
# -0      = show version #
#
#aslist=-err+ errs
#aslist=-l -a -b -s -g -m -x -U
#aslist=-err+ errs -0 -l $*.lis -s -g -m 
aslist=-err+ errs -l $*.lis -s -g -m 

#
# linker listing flags
#
# -0   show version
# -v   verbose
#
ldlist=
#ldlist=-err+ errs -0 -v

#
# -d  - debug information (same for c68xxx and asm68xxx)
#         used in conjunction with symlist program
#
debug=
#debug=-d

#
# suppress warnings (same for c68xxx and asm68xxx)
#
# -w 1 =  1=suppresses least severe, 11=default, suppresses all warnings
#
#warn=
#warn=-w
warn=-w 1

#
# include path for *.h files
#
#inc=-I rtxc
inc=
#inc=-I ..\kernel
#inc=-I d:\d\rtxc\kernel

#
# -P A5REL    = use A5 relative addressing vs -sd
# -cs         = constants separate
# -sd         = separate data, #undef A5REL
# -D xnx ...  = defines size and type of built-in types
#               format: type-size-signed
#               where: type = c-char, e-enum, i-int, s-short
#               where: size = size in bytes
#               where: signed = s-signed, u-unsigned
# -pack 2     = data is packed on a word boundary
#
model=-P A5REL -D s2s c1s -pack 2       # requires A5REL = 1 in kernel\rtxcasm.68k
#model=-P A5REL -cs
#model=-sd             			# requires A5REL = 0 in kernel\rtxcasm.68k
#model=-cs -sd

#
# -G   suppress global symbols
# -S   suppress local symbols
# note: -G -S means symlist is useless
#
LDFLAGS=$(ldlist)

#
# -f pm           format mot s1/2
# -m 80           record length
# -e udata        exclude segments
# -ec usep stsep  exclude classes
# -err+ errs      log errors during development
# -0              show version #
#
FORMFLAGS=-f pm -m 80 -e udata -ec usep0 usep usep9 stsep0 stsep stsep9

#
# used with debug switch enabled
#
# -err+ errs  log errors during development
# -0          show version #
#
SYMFLAGS=

#
# -0     show version #
#
OLFLAGS=

#
# -s          segments only, no symbols
# -a          sort alpha order (default)
# -n          sort number order
# -z          suppress empty (zero) segments
# -err+ errs  log errors during development
# -0          show version #
#
GSFLAGS=-n

genapps\pizza.h: genapps\example-.htm
	utils\bin\formelem genapps\example-.htm genapps\pizza.h PIZZA
genapps\filesend.h: genapps\filesend.htm
	utils\bin\formelem genapps\filesend.htm genapps\filesend.h FILESEND
genapps\filetest.h: genapps\filetest.htm
	utils\bin\formelem genapps\filetest.htm genapps\filetest.h FILETEST

genapps\testurl.h: genapps\testurl.def
	utils\bin\urltree genapps\testurl.def genapps\testurl.h

app\urldef.h: app\urls.def
	utils\bin\urltree app\urls.def app\urldef.h
	
app\uridata.c: genapps\testurl.def app\urls.def

genapps\testret.c: genapps\pizza.h genapps\filesend.h genapps\filetest.h \
	genapps\testform.h genapps\exam7.h 

all: \
genapps\pizza.h \
genapps\filesend.h \
genapps\filetest.h \
genapps\testform.h \
genapps\exam7.h \
genapps\testurl.h \
genapps\apputil.ln \
genapps\contio.ln \
genapps\fileio.ln \
genapps\flowcont.ln \
genapps\readent.ln \
genapps\sockout.ln \
genapps\streamw.ln \
genapps\strout.ln \
genapps\testret.ln \
genapps\upload.ln \
genapps\checksum.ln \
genapps\compsum.ln \
htmlform\formpars.ln \
htmlform\initoper.ln \
htmlform\multiprt.ln \
htmlform\streamfl.ln \
htmlform\strfind.ln \
#localapp\uridata.ln \
app\urldef.h \
app\uridata.ln \
prochttp\authoriz.ln \
prochttp\conttype.ln \
prochttp\formphas.ln \
prochttp\httpd.ln \
prochttp\lstnsock.ln \
prochttp\procreq.ln \
prochttp\reqlist.ln \
prochttp\resphead.ln \
prochttp\uriparse.ln \
prochttp\util.ln \
prochttp\webdisp.ln \
sysdep\oninit.ln \
sysdep\sysfile.ln \
sysdep\syslib.ln \
sysdep\tcpinter.ln \
sysdep\tcprw.ln \
sysdep\timezone.ln \
sysdep\webinit.ln

clean: 
	cd genapps
	del *.ln
	cd ..\htmlform
	del *.ln
	cd ..\app
	del *.ln
	cd ..\prochttp
	del *.ln
	cd ..\sysdep
	del *.ln
	cd ..

	

