avr-game

view Makefile @ 1:872e425f0e7f

foo
author John Tsiombikas <nuclear@member.fsf.org>
date Tue, 09 Sep 2014 06:49:28 +0300
parents
children
line source
1 src = $(wildcard *.c)
2 obj = $(src:.c=.o)
3 bin = avrgame
4 hex = $(bin).hex
5 eep = $(bin).eep
7 mcu_gcc = atmega328p
8 mcu_dude = m328p
10 CC = avr-gcc
11 OBJCOPY = avr-objcopy
13 CFLAGS = -O2 -pedantic -Wall -mmcu=$(mcu_gcc) -DF_CPU=1000000
14 LDFLAGS = -Wl,-Map,$(bin).map -mmcu=$(mcu_gcc)# -Wl,-u,vfprintf -lprintf_flt -lm
16 .PHONY: all
17 all: $(hex) $(eep)
19 $(bin): $(obj)
20 $(CC) -o $@ $(obj) $(LDFLAGS)
22 $(hex): $(bin)
23 $(OBJCOPY) -j .text -j .data -O ihex -R .eeprom $< $@
25 $(eep): $(bin)
26 $(OBJCOPY) -j .eeprom --change-section-lma .eeprom=0 -O ihex $< $@
28 .PHONY: program
29 program: $(hex)
30 avrdude -c usbtiny -p $(mcu_dude) -e -U flash:w:$(hex)
32 .PHONY: clean
33 clean:
34 rm -f $(bin) $(obj) $(hex) $(eep) $(bin).map