Introduce linking information from m68hc1x's example file.
[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 -Wmissing-prototypes -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
16 OBJCOPY_FLAGS=--only-section=.text \
17               --only-section=.rodata \
18               --only-section=.vectors \
19               --only-section=.data
20
21
22 DEVC_PREFIX = m68hc11-
23 CC = $(DEVC_PREFIX)gcc
24 AS = $(DEVC_PREFIX)as
25 AR = $(DEVC_PREFIX)ar
26 SIZE = $(DEVC_PREFIX)size
27 OBJCOPY = $(DEVC_PREFIX)objcopy
28 OBJDUMP = $(DEVC_PREFIX)objdump
29 LD = $(DEVC_PREFIX)ld
30
31 all: rom2.b rom2.elf rom2.s19
32
33 rom2.elf: $(OBJS) memory.x
34         $(CC) $(LDFLAGS) -o $@ $(OBJS) $(LIBADD)
35
36 clean:
37         rm -f $(OBJS) *.elf *.s19 *.b *.a
38
39 #
40 # Implicit rules
41 #
42 # .elf is for the simulator and gdb
43 # .s19 is for some downloader and the simulator
44 # .b   is a binary dump
45 #
46 .SUFFIXES: .elf .s19 .b
47
48 .elf.s19:
49         $(OBJCOPY) --output-target=srec $(OBJCOPY_FLAGS) $< $*.s19
50
51 .elf.b:
52         $(OBJCOPY) --output-target=binary --gap-fill=255 \
53                    --only-section=.data $(OBJCOPY_FLAGS) $< $*.b
54                    

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