#       buildfile       4.7     83/08/14
#
#	as.h		Definitions for data structures
#	asnumber.h	Definitions for all numbers: byte .. G format float
#	asscan.h	Definitions for the character scanner
#	asscanl.h	Definitions for the character scanner;
#				local to asscan?.c
#	astokfix.awk
#	astoks.H	The defines for tokens that yacc produced
#				This is processed by astokfix.awk to yield:
#	astoks.h	Included implicitly in as.h
#	asexpr.h	The macros for parsing and expressions
#	assyms.h	Macros for dealing with the symbol table
#	instrs.h	Definitions to make instrs more readable
#
#	asscan1.c	buffer management, yylex, and buffer drainer
#	asscan2.c	character scanner, and buffer filler
#	asscan3.c	character sets definitions (initialized data)
#	asscan4.c	constructs normal integers; interfaces with bignum?.c
#
#	bignum1.c	constructs large integers; utility routines
#	bignum2.c	packs/unpacks floating point numbers
#	natof.c		constructs large floating point #'s, ala atof
#
#	asparse.c	parser
#	asexpr.c	parses expressions, constructs and evaluates
#				expression trees
#
#	asmain.c	main body
#	assyms.c	symbol table processing routines
#	asjxxx.c	Fixes jxxx instructions
#	ascode.c	Emits code
#	assizetab.c	Converts internal ordinal #'s into sizes, strings, etc
#	asio.c		Does block I/O and faster versions of fwrite
#
#	aspseudo.c	Symbol table definitions for reserved words
#	instrs		included in pseudo.c; instructions and semantic info
#				for each instructions
#
HDRS = astoks.H astokfix.awk as.h asscan.h assyms.h asexpr.h 

SRCS = asscan1.c asscan2.c asscan3.c asscan4.c \
	bignum1.c bignum2.c natof.c floattab.c \
	asmain.c asparse.c \
	asexpr.c assyms.c \
	asjxxx.c ascode.c aspseudo.c \
	assizetab.c asio.c

OBJS = asscan1.$(OBJSUFFIX) asscan2.$(OBJSUFFIX) asscan3.$(OBJSUFFIX) \
	asscan4.$(OBJSUFFIX) bignum1.$(OBJSUFFIX) bignum2.$(OBJSUFFIX) \
	natof.$(OBJSUFFIX) floattab.$(OBJSUFFIX) asparse.$(OBJSUFFIX) \
	asexpr.$(OBJSUFFIX) asmain.$(OBJSUFFIX) assyms.$(OBJSUFFIX) \
	asjxxx.$(OBJSUFFIX) ascode.$(OBJSUFFIX) aspseudo.$(OBJSUFFIX) \
	assizetab.$(OBJSUFFIX) asio.$(OBJSUFFIX)

GRIND = astoks.h as.h asscan.h assyms.h asexpr.h instrs.h asnumber.h \
	asscanl.h asscan1.c asscan2.c asscan3.c asscan4.c \
	bignum1.c bignum2.c natof.c floattab.c \
	asmain.c asscan.c asparse.c asexpr.c \
	assyms.c asjxxx.c ascode.c asio.c \
	assizetab.c aspseudo.c

DESTDIR = 

#
#	available flags:
#
#	AS		This is the assembler; always set
#  (UNIX and VMS are mutually exclusive.)
#	UNIX		Must be set if the assembler is to produce a.out
#			files for UNIX.
#
#	VMS		Must be set if the assembler is to produce executables
#			for VMS (Thanks to David Kashtan, SRI for these fixes)
#
#	if VMS is set, then these two flags are also valid:
#			(necessary to frob system calls and '$' conventions
#	VMSDEVEL	The assembler is being compiled under VMS
#	UNIXDEVEL	The assembler is being compiled under UNIX
#
#
#	DEBUG		print out various debugging information
#			in the first pass
#
#	FLEXNAMES	All names are stored internally as true character
#			strings, null terminated, and can be no more
#			than BUFSIZ long.
#			


#ifdef	M68K
# 68000 compiler has a bug -- won't handle (void) casts
DFLAGS= -DAS -Dvoid=int
#else
DFLAGS= -DAS
#endif

LIBS = $(VSYS)/lib/$(MACHINE)/libVunix-compat.a

CFLAGS = $(MIFLAGS) $(MDFLAGS) $(DFLAGS)

asvax.$(MACHINE):  $(OBJS)
	$(CC) $(CFLAGS) $(OBJS) -o asvax.$(MACHINE) $(LIBS)


astoks.h: astoks.H astokfix.awk
	awk -f astokfix.awk < astoks.H > astoks.h

.c.$(OBJSUFFIX):
	$(CC) $(CFLAGS) -c $*.c

.c.s:
	$(CC) $(CFLAGS) -S $*.c

aspseudo.$(OBJSUFFIX):	aspseudo.c
#ifdef	VAX
	$(CC) -c -R $(CFLAGS) aspseudo.c
#else
# cc68 doesn't know about -R (read-only), need :rofix hack
	$(CC) $(CFLAGS) -S aspseudo.c
	sh ./:rofix aspseudo.s
#	$(AS) -o aspseudo.$(OBJSUFFIX) aspseudo.s
	$(CC) $(CFLAGS) -c aspseudo.s
	rm -f aspseudo.s
#endif

instrs.as: instrs
	(echo FLAVOR AS ; cat instrs) | awk -f instrs > instrs.as

lint:
	lint $(DFLAGS) $(SRCS)

install: asvax.$(MACHINE)
	$(NETINSTALL) -p asvax.$(MACHINE) $(VSYS)/bin

ascode.$(OBJSUFFIX): as.h instrs.h astoks.h asnumber.h assyms.h
asexpr.$(OBJSUFFIX): as.h instrs.h astoks.h asnumber.h asexpr.h
asio.$(OBJSUFFIX): as.h instrs.h astoks.h asnumber.h
asjxxx.$(OBJSUFFIX): as.h instrs.h astoks.h asnumber.h assyms.h
asmain.$(OBJSUFFIX): as.h instrs.h astoks.h asnumber.h assyms.h asscan.h asexpr.h
asparse.$(OBJSUFFIX): as.h instrs.h astoks.h asnumber.h asscan.h assyms.h asexpr.h
aspseudo.$(OBJSUFFIX): as.h instrs.h astoks.h asnumber.h instrs.as
asscan1.$(OBJSUFFIX): as.h instrs.h astoks.h asnumber.h asscanl.h
asscan2.$(OBJSUFFIX): as.h instrs.h astoks.h asnumber.h asscanl.h
asscan3.$(OBJSUFFIX): as.h instrs.h astoks.h asnumber.h asscanl.h
asscan4.$(OBJSUFFIX): as.h instrs.h astoks.h asnumber.h asscanl.h
assizetab.$(OBJSUFFIX): as.h instrs.h astoks.h asnumber.h assyms.h
assyms.$(OBJSUFFIX): as.h instrs.h astoks.h asnumber.h asscan.h assyms.h
bignum1.$(OBJSUFFIX): as.h instrs.h astoks.h asnumber.h
bignum2.$(OBJSUFFIX): as.h instrs.h astoks.h asnumber.h
floattab.$(OBJSUFFIX): as.h instrs.h astoks.h asnumber.h
natof.$(OBJSUFFIX): as.h instrs.h astoks.h asnumber.h
