a7fd90dc30b2f5cd06ddf3aa487998ffe0a2dc54
[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_basic.o coinmech.o chime.o \
5         helpers.o server.o main_basic.o comm.o \
6         vectors.o
7 INCLUDES = vend.h keypad.h chime.h asm.h display_basic.h ports.h types.h
8
9 CFLAGS = -O3 -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           -Wl,-defsym,_uart_regs=0x4000
21
22 OBJCOPY_FLAGS=--only-section=.text \
23               --only-section=.rodata \
24               --only-section=.vectors \
25               --only-section=.data
26
27
28 DEVC_PREFIX = m68hc11-
29 CC = $(DEVC_PREFIX)gcc
30 AS = $(DEVC_PREFIX)as
31 AR = $(DEVC_PREFIX)ar
32 SIZE = $(DEVC_PREFIX)size
33 OBJCOPY = $(DEVC_PREFIX)objcopy
34 OBJDUMP = $(DEVC_PREFIX)objdump
35 LD = $(DEVC_PREFIX)ld
36
37 all: rom2.b rom2.elf rom2.s19
38
39 rom2.elf: $(OBJS) memory.x
40         $(CC) $(LDFLAGS) -o $@ $(OBJS) $(LIBADD)
41
42 clean:
43         rm -f *.o *.elf *.s19 *.b *.a
44
45 #
46 # Some useful rules
47 #
48 dump:   rom2.elf
49         $(OBJDUMP) -d $<
50
51 size:   rom2.s19
52         $(SIZE) $<
53
54
55 #
56 # Implicit rules
57 #
58 # .elf is for the simulator and gdb
59 # .s19 is for some downloader and the simulator
60 # .b   is a binary dump
61 #
62 .SUFFIXES: .elf .s19 .b
63
64 .elf.s19:
65         $(OBJCOPY) --output-target=srec $(OBJCOPY_FLAGS) $< $*.s19
66
67 .elf.b:
68         $(OBJCOPY) --output-target=binary --gap-fill=255 \
69                    --only-section=.data $(OBJCOPY_FLAGS) $< $*.b
70                    

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