voltmeter
diff Makefile @ 0:d26d73ef2db7
initial commit
author | John Tsiombikas <nuclear@member.fsf.org> |
---|---|
date | Sun, 27 Jan 2013 10:11:40 +0200 |
parents | |
children |
line diff
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/Makefile Sun Jan 27 10:11:40 2013 +0200 1.3 @@ -0,0 +1,34 @@ 1.4 +src = $(wildcard *.c) 1.5 +obj = $(src:.c=.o) 1.6 +bin = voltmeter 1.7 +hex = $(bin).hex 1.8 +eep = $(bin).eep 1.9 + 1.10 +mcu_gcc = atmega168 1.11 +mcu_dude = m168 1.12 + 1.13 +CC = avr-gcc 1.14 +OBJCOPY = avr-objcopy 1.15 + 1.16 +CFLAGS = -O2 -pedantic -Wall -mmcu=$(mcu_gcc) 1.17 +LDFLAGS = -Wl,-Map,$(bin).map -mmcu=$(mcu_gcc) -Wl,-u,vfprintf -lprintf_flt -lm 1.18 + 1.19 +.PHONY: all 1.20 +all: $(hex) $(eep) 1.21 + 1.22 +$(bin): $(obj) 1.23 + $(CC) -o $@ $(obj) $(LDFLAGS) 1.24 + 1.25 +$(hex): $(bin) 1.26 + $(OBJCOPY) -j .text -j .data -O ihex -R .eeprom $< $@ 1.27 + 1.28 +$(eep): $(bin) 1.29 + $(OBJCOPY) -j .eeprom --change-section-lma .eeprom=0 -O ihex $< $@ 1.30 + 1.31 +.PHONY: program 1.32 +program: $(hex) 1.33 + avrdude -c usbtiny -p $(mcu_dude) -e -U flash:w:$(hex) 1.34 + 1.35 +.PHONY: clean 1.36 +clean: 1.37 + rm -f $(bin) $(obj) $(hex) $(eep) $(bin).map