# Description file for 68000 assembler

VPATH = ../mi

#ifdef UNIX
OPTS = -DStanford -DSymDesc -I$(VSYS)/include -DBOOTSTRAP -DLITTLE_ENDIAN
#else
OPTS = -DStanford -DSymDesc -I$(VSYS)/include
#endif
# -I$(VSYS)/include is used to pull in the m68k version of b.out.h.  The
#	source files which need it do "#include "m68k/b.out.h".  There aren't
#	(or shouldn't be) any files in $(VSYS)/include, only in its
#	subdirectories.
#	NOTE: Should we use PRODUCTION_VSYS instead of VSYS?
#	      And, is -I$(whatever_VSYS)/include a good thing to put in
#	      the general buildtemplates instead of in this one command?
# -DBOOTSTRAP does some include-file magic in mical.h.  BOOTSTRAP => compiler
#	running on Unix, (not BOOTSTRAP) => compiler running on V or something
#	else (?).  I'm not convinced we really need this even for Unix.
# -DLITTLE_ENDIAN says that the assembler will run on a machine with little-
#	endian (VAX-like) byte order, so it must be defined for VAX Unix and
#	MicroVAX V, and undefined for all our big-endian (68000) machines.
#	The MicroVAX V compiler (ccVAX) generates -DLITTLE_ENDIAN itself, so
#	we just do it here for the VAX Unix version.

O = $(OBJSUFFIX)
OBJS	= as.$O cond.$O error.$O eval.$O init.$O ins.$O mac.$O oper.$O \
	  print.$O ps.$O ps1.$O ps2.$O ps3.$O psstab.$O random.$O rel.$O \
	  sdi.$O spawn.$O sym.$O
 
all: as68.$(MACHINE)

as68.$(MACHINE): $(OBJS)
	$(CC) $(MIFLAGS) $< -o $@ $(MDFLAGS) $(LIBRARIES)
# Unix version used to be linked with -g.  Hope no-one needs it.

$(OBJS): mical.h
# ^ Can makedep do this for us?  Whaddabout the stuff below?

mac.$O: mical.h mac.h

init.$O: mical.h inst.h

ins.$O: mical.h inst.h

.c.$O:
	$(CC) $(OPTS) $(MIFLAGS) $(SPECINCLUDES) $(INCLUDES) -c $*.c
# ^ What we really want is to tack $(OPTS) onto the normal rule in
#   /xV/cmds/{m68k,vax,unix,...}/buildtemplate.  Is there a way?

install: as68.$(MACHINE)
#ifdef UNIX
	rcp $< $(UNIXDESTDIR)/as68
#else
	$(NETINSTALL) -p $< $(VSYS)/bin
#endif

clean:
	rm -f *CKP *BAK *.$O as68.$(MACHINE)

relink:
	rm -f as68.$(MACHINE)
