1 # muchly stolen from m68hc1x's example.tar.gz's Makefile
4 motors.o keypad.o display_basic.o coinmech.o chime.o \
5 helpers.o main_basic.o sci.o \
6 vectors.o start.o romsrc.o xmodem.o
7 INCLUDES = vend.h keypad.h chime.h asm.h display_basic.h ports.h types.h
8 # debugging doesn't get compiled into the ROM image
9 CFLAGS = -m68hc11 -mshort -Wall -O1 \
10 -msoft-reg-count=0 -ffixed-z -g -fomit-frame-pointer
12 LDFLAGS = -m68hc11 -mshort -Wl,-m,m68hc11elfb \
14 -Wl,-defsym,_io_ports=0x1000 \
15 -Wl,-defsym,_switch_input=0x1800 \
16 -Wl,-defsym,_misc_input=0x2000 \
17 -Wl,-defsym,_home_sensors=0x2800 \
18 -Wl,-defsym,_changer_output=0x3000 \
19 -Wl,-defsym,_misc_output=0x3800 \
20 -Wl,-defsym,_uart_regs=0x4000
22 OBJCOPY_FLAGS=--only-section=.text \
23 --only-section=.rodata \
24 --only-section=.vectors \
28 DEVC_PREFIX = m68hc11-
29 CC = $(DEVC_PREFIX)gcc
32 SIZE = $(DEVC_PREFIX)size
33 OBJCOPY = $(DEVC_PREFIX)objcopy
34 OBJDUMP = $(DEVC_PREFIX)objdump
37 all: rom2.b rom2.elf rom2.s19
39 rom2.elf: $(OBJS) memory.x
40 $(CC) $(LDFLAGS) -o $@ $(OBJS) $(LIBADD)
44 rm -f *.o *.elf *.s19 *.b *.a rom.tar.bz2 romsrc.c crctab.h m68hc11-gdb gencrctab
56 rm -f romsrc.c crctab.h
57 tar cjf rom.tar.bz2 README Makefile gdbsimrc *.pl *.c *.h *.s *.x
60 perl -w src2c.pl < $< > $@
64 gencrctab: gencrctab.c
73 # .elf is for the simulator and gdb
74 # .s19 is for some downloader and the simulator
77 .SUFFIXES: .elf .s19 .b
80 $(OBJCOPY) --output-target=srec $(OBJCOPY_FLAGS) $< $*.s19
83 $(OBJCOPY) --output-target=binary --gap-fill=255 \
84 $(OBJCOPY_FLAGS) $< $*.b
86 m68hc11-gdb: /usr/bin/m68hc11-gdb
87 sed -e 's|m68hc11eepr/reg 0xb000 512|m68hc11eepr/reg 0x4000 1 |' < $< > $@
90 sim: m68hc11-gdb rom2.elf
91 ./m68hc11-gdb -x gdbsimrc rom2.elf