-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathMakefile
31 lines (21 loc) · 842 Bytes
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
.PRECIOUS: %.o %.elf %.d
CPPFLAGS=-traditional-cpp -I/usr/avr/sys-root/include -D__AVR_ATmega88A__ -D__ASSEMBLER__
FIRMWARES=SwinSID88_lazy_jones_fix.hex SwinSID88_20120524.hex SwinSID88_20141027.hex
all: $(FIRMWARES)
# Dependency file is needed to make sure firmware is rebuilt when include file changes.
%.d: %.asm
rm -f $@; \
cpp -MM $(CPPFLAGS) $< > $@.$$$$; \
sed 's,\($*\)\.o[ :]*,\1.o $@ : ,g' < $@.$$$$ > $@; \
rm -f $@.$$$$
%.o: %.asm %.d
cpp $(CPPFLAGS) $< | \
avr-as -mmcu=atmega88a -o $@
%.elf: %.o swinsid_atmega88.ld
avr-ld -mavr4 -T swinsid_atmega88.ld -o $@ $<
%.hex: %.elf
avr-objcopy -j .text -j .wavetable -j .data -O ihex $< $@
if [ -f $(basename $<).compare ]; then diff -q $(basename $<).compare $@ ; fi || ( rm $@ ; exit 1 )
clean:
rm -f *.o *.elf *.hex
include $(FIRMWARES:.hex=.d)