#
# makefile for the ads56800 command-line interface to the 56LC811 board
#
# Author: Brian L. Evans
# Version: @(#)make.template	1.4	06/30/98

ROOT = ..
VPATH = $(ROOT)/src
BINDIR = $(ROOT)/bin.$(PTARCH)
LIBDIR = $(ROOT)/lib.$(PTARCH)

# get configuration info
CONFIG=$(ROOT)/mk/config-$(PTARCH).mk
include $(CONFIG)

# Turn on compilation flags
USERFLAGS = -DUNIX -DBIG_ENDIAN=1 -DFULLSIM=1 -DGUI=0 -DADSx=1

# Define QUANTIFY
QUANTIFY = quantify

# Add to the include path
C_INCL = -I$(ROOT)/mcoffinc

HDRS = \
adsreg58.h \
cc.h \
driver.h \
gsig800.h \
hostio.h \
proto568.h \
protocom.h \
rgcom.h \
rgir.h \
rgsim.h \
simcom.h \
simdev.h \
simusr.h \
utsim.h \
vcx_utls.h \
vstruct.h

SRCS = \
ads56800.c \
utsim.c \
dsp56800.c \
simglob.c \
scrmgr.c \
driver.c

OBJS = $(SRCS:.c=.o)

LIBFILES = \
$(LIBDIR)/libwwads.a \
$(LIBDIR)/libww56800.a \
$(LIBDIR)/libcm56800.a

ADS568_DEPEND = $(OBJS) $(LIBFILES)

# link against the c30 library
LIBS += -L$(LIBDIR) -lwwads -lww56800 -lcm56800 -lm -lcurses -ltermcap

# force static compilation
ifeq ($(CC),gcc)
LINKFLAGS += -static
else
LINKFLAGS += $(CC_STATIC)
endif

# common.mk wants this, otherwise we get multiple targets for $(LIBDIR)/$(LIB)
LIB = foo

all:	makefile ads56800

install:	ads56800 $(BINDIR)/ads56800

$(BINDIR)/ads56800:	ads56800
	echo "Linking ads56800 into $(BINDIR)"
	rm -f $(BINDIR)/ads56800
	ln ads56800 $(BINDIR)

ads56800:	$(ADS568_DEPEND)
	$(PURELINK) $(LINKER) $(LINKFLAGS) $(OBJS) $(LIBS) -o $@

ads56800.debug:	$(ADS568_DEPEND)
	$(PURELINK) $(LINKER) $(LINKFLAGS_D) $(OBJS) $(LIBS) -o $@

ads56800.debug.purify:	$(ADS568_DEPEND)
	$(PURIFY) $(LINKER) $(LINKFLAGS_D) $(OBJS) $(LIBS) -o $@

ads56800.debug.quantify:	$(ADS568_DEPEND)
	$(QUANTIFY) $(LINKER) $(LINKFLAGS_D) $(OBJS) $(LIBS) -o $@

# include common definitions, rules
include $(ROOT)/mk/common.mk

# Don't add anything after the next line; makedepend will zap it.
# DO NOT DELETE THIS LINE -- make depend depends on it.

ads56800.o: ads56800.c utsim.h simcom.h ../mcoffinc/coreaddr.h \
 ../mcoffinc/maout.h ../mcoffinc/filehdr.h ../mcoffinc/aouthdr.h \
 ../mcoffinc/scnhdr.h ../mcoffinc/reloc.h ../mcoffinc/linenum.h \
 ../mcoffinc/syms.h ../mcoffinc/storclas.h simdev.h vstruct.h \
 vcx_utls.h simusr.h hostio.h rgsim.h rgir.h rgcom.h protocom.h \
 proto568.h driver.h
utsim.o: utsim.c utsim.h
dsp56800.o: dsp56800.c simcom.h ../mcoffinc/coreaddr.h \
 ../mcoffinc/maout.h ../mcoffinc/filehdr.h ../mcoffinc/aouthdr.h \
 ../mcoffinc/scnhdr.h ../mcoffinc/reloc.h ../mcoffinc/linenum.h \
 ../mcoffinc/syms.h ../mcoffinc/storclas.h simdev.h vstruct.h \
 vcx_utls.h simusr.h hostio.h rgsim.h rgir.h rgcom.h gsig800.h
simglob.o: simglob.c simcom.h ../mcoffinc/coreaddr.h \
 ../mcoffinc/maout.h ../mcoffinc/filehdr.h ../mcoffinc/aouthdr.h \
 ../mcoffinc/scnhdr.h ../mcoffinc/reloc.h ../mcoffinc/linenum.h \
 ../mcoffinc/syms.h ../mcoffinc/storclas.h simusr.h hostio.h rgsim.h \
 rgir.h rgcom.h simdev.h vstruct.h vcx_utls.h
scrmgr.o: scrmgr.c utsim.h simcom.h ../mcoffinc/coreaddr.h \
 ../mcoffinc/maout.h ../mcoffinc/filehdr.h ../mcoffinc/aouthdr.h \
 ../mcoffinc/scnhdr.h ../mcoffinc/reloc.h ../mcoffinc/linenum.h \
 ../mcoffinc/syms.h ../mcoffinc/storclas.h simdev.h vstruct.h \
 vcx_utls.h simusr.h hostio.h rgsim.h rgir.h rgcom.h protocom.h
driver.o: driver.c simcom.h ../mcoffinc/coreaddr.h ../mcoffinc/maout.h \
 ../mcoffinc/filehdr.h ../mcoffinc/aouthdr.h ../mcoffinc/scnhdr.h \
 ../mcoffinc/reloc.h ../mcoffinc/linenum.h ../mcoffinc/syms.h \
 ../mcoffinc/storclas.h simdev.h vstruct.h vcx_utls.h simusr.h \
 hostio.h rgsim.h rgir.h rgcom.h driver.h cc.h adsreg58.h protocom.h
