summaryrefslogtreecommitdiffstats
path: root/Makefile
blob: c7fe375548502d67131469a369ce3b4b6432bb01 (plain)
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
FILES := $(patsubst %.cpp,%,$(wildcard *.cpp))


all: robocup.elf;


include $(FILES:%=%.d)


robocup.hex: robocup.elf
	avr-objcopy -O ihex -R .eeprom $< $@

robocup.elf: $(FILES:%=%.o)
	avr-g++ -mmcu=atmega32 -o $@ $^

%.o: %.cpp
	avr-g++ -c -mmcu=atmega32 -o $@ $<

%.d: %.cpp
	@set -e; rm -f $@; \
	avr-g++ -M -mmcu=atmega32 -MF $@.$$$$ $<; \
	sed 's,\($*\)\.o[ :]*,\1.o $@ : ,g' < $@.$$$$ > $@; \
	rm -f $@.$$$$

program: robocup.hex
	sudo avrdude -P usb -c avrisp2 -p m32 -U $<

clean:
	rm -f robocup.hex robocup.elf $(FILES:%=%.o) $(FILES:%=%.d)

.PHONY: clean