#
# makefile for the Motorola 68HC11 simulator/emulator
#
# Author: Brian L. Evans
# Version: @(#)make.template	1.6	10/09/97

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

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

# Define QUANTIFY
QUANTIFY = quantify

HDRS = \
commands.h \
foreign.h \
main.h \
options.h \
sim.h \
sim_io.h \
sim_irq.h \
sim_low.h \
symbols.h

SRCS = \
main.c \
commands.c \
sim.c \
dis.c \
sim_irq.c \
symbols.c

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

# source files in the Sim68 simulator that we are not using
EXTRA_SRCS = dis.h serial_io.h serial_io.c sim_io.c 

LIBFILES =

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

M68HC11_DEPEND = $(OBJS)

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

all:	makefile m68hc11sim

install:	m68hc11sim $(BINDIR)/m68hc11sim

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

m68hc11sim:	$(M68HC11_DEPEND)
	$(PURELINK) $(LINKER) $(LINKFLAGS) $(OBJS) $(LIBS) -o $@

m68hc11sim.debug:	$(M68HC11_DEPEND)
	$(PURELINK) $(LINKER) $(LINKFLAGS_D) $(OBJS) $(LIBS) -o $@

m68hc11sim.debug.purify:	$(M68HC11_DEPEND)
	$(PURIFY) $(LINKER) $(LINKFLAGS_D) $(OBJS) $(LIBS) -o $@

m68hc11sim.debug.quantify:	$(M68HC11_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.
main.o: main.c symbols.h foreign.h sim.h commands.h main.h
commands.o: commands.c main.h foreign.h sim.h commands.h
sim.o: sim.c foreign.h sim.h sim_low.h symbols.h
dis.o: dis.c foreign.h sim.h symbols.h
sim_irq.o: sim_irq.c foreign.h
symbols.o: symbols.c foreign.h symbols.h options.h
