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


all: robocup.elf;

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

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

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

%.d: %.cpp
	@avr-g++ -MM -mmcu=atmega32 -Os -MF $@ -MT $(patsubst %.cpp,%.o,$<) -MT $@ $<

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

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

.PHONY: clean


-include $(FILES:%=%.d)