reworkings
[uccvend-snackrom.git] / ROM2 / Makefile
1 # muchly stolen from m68hc1x's example.tar.gz's Makefile
2
3 OBJS = \
4         motors.o keypad.o display.o coinmech.o helpers.o main.o \
5         vectors.o
6 INCLUDES = vend.h
7
8
9 CFLAGS = -O2 -Wall -m68hc11 -mshort -Wall -Os -g0 \
10         -msoft-reg-count=0 -ffixed-z
11
12 LDFLAGS = -m68hc11 -mshort -Wl,-m,m68hc11elfb \
13           -nostartfiles \
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
21 OBJCOPY_FLAGS=--only-section=.text \
22               --only-section=.rodata \
23               --only-section=.vectors \
24               --only-section=.data
25
26
27 DEVC_PREFIX = m68hc11-
28 CC = $(DEVC_PREFIX)gcc
29 AS = $(DEVC_PREFIX)as
30 AR = $(DEVC_PREFIX)ar
31 SIZE = $(DEVC_PREFIX)size
32 OBJCOPY = $(DEVC_PREFIX)objcopy
33 OBJDUMP = $(DEVC_PREFIX)objdump
34 LD = $(DEVC_PREFIX)ld
35
36 all: rom2.b rom2.elf rom2.s19
37
38 rom2.elf: $(OBJS) memory.x
39         $(CC) $(LDFLAGS) -o $@ $(OBJS) $(LIBADD)
40
41 clean:
42         rm -f $(OBJS) *.elf *.s19 *.b *.a
43
44 #
45 # Some useful rules
46 #
47 dump:   rom2.elf
48         $(OBJDUMP) -d $<
49
50 size:   rom2.s19
51         $(SIZE) $<
52
53
54 #
55 # Implicit rules
56 #
57 # .elf is for the simulator and gdb
58 # .s19 is for some downloader and the simulator
59 # .b   is a binary dump
60 #
61 .SUFFIXES: .elf .s19 .b
62
63 .elf.s19:
64         $(OBJCOPY) --output-target=srec $(OBJCOPY_FLAGS) $< $*.s19
65
66 .elf.b:
67         $(OBJCOPY) --output-target=binary --gap-fill=255 \
68                    --only-section=.data $(OBJCOPY_FLAGS) $< $*.b
69                    

UCC git Repository :: git.ucc.asn.au