bicycle_odometer

diff Makefile @ 0:0c1707508070

initial commit
author John Tsiombikas <nuclear@member.fsf.org>
date Tue, 23 Aug 2011 19:01:11 +0300
parents
children f74f4561e71c
line diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/Makefile	Tue Aug 23 19:01:11 2011 +0300
     1.3 @@ -0,0 +1,38 @@
     1.4 +src = $(wildcard *.c)
     1.5 +obj = $(src:.c=.o)
     1.6 +bin = odometer
     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)
    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: fuses
    1.32 +fuses:
    1.33 +	avrdude -c usbtiny -p $(mcu_dude) -U lfuse:w:0x66:m
    1.34 +
    1.35 +.PHONY: program
    1.36 +program: $(hex)
    1.37 +	avrdude -c usbtiny -p $(mcu_dude) -e -U flash:w:$(hex)
    1.38 +
    1.39 +.PHONY: clean
    1.40 +clean:
    1.41 +	rm -f $(bin) $(obj) $(hex) $(eep) $(bin).$(map)