# Note, TOPDIR needs to point to the directory where Make.rules lives
TOPDIR = ../../MotoRobots/src
include $(TOPDIR)/Make.vars

# list all .o files to be built in OBJS, there is no need to define
# rules for them due to our .depend and Make.rules files
OBJS = main.o OS-Support.o func.o


# Select linking for ram/rom, and which MRM version

RAM_512=$(TOPDIR)/startup/68332/mrm/mrm_ram_512k.ld
ROM_512=$(TOPDIR)/startup/68332/mrm/mrm_rom_512k.ld
RAM_32=$(TOPDIR)/startup/68332/mrm/mrm_ram_32k.ld
ROM_32=$(TOPDIR)/startup/68332/mrm/mrm_rom_32k.ld
LDSCRIPT=$(RAM_512)

# Eventually we can have all libs in an "installed" directory but
# for now each is in it's source directory so we need lots of -L args
EXE_LIBDIRS = \
		-L$(TOPDIR)/startup/68332/mrm \
		-L$(TOPDIR)/libbase/68332 \
		-L$(TOPDIR)/libqsm/68332 \
		-L$(TOPDIR)/libsim/68332 \
		-L$(TOPDIR)/libtpu/68332 \
		-L$(TOPDIR)/libled/68332/mrm \
		-L$(TOPDIR)/liblcd/68332/mrm \
		# many more to come ...
                
EXE_LIBS = 	-lqsm -lsim -llcd -lled

all: Program.s19 Program.num

Program.s19: Program.exe
Program.exe: $(OBJS)

# Use the following to produce map files (or otherwise customize the linking)	
#        $(LD) -M --verbose -o $@ $^ $(EXE_LIBDIRS) $(EXE_LIBS) $(COLDFIRE_LIBDIRS) -T$(LDSCRIPT) > $(@:.exe=.map)

depend: depend_default
clean: clean_default
install:

include $(TOPDIR)/Make.rules

