nuclear@0: src = $(wildcard *.c) nuclear@0: obj = $(src:.c=.o) nuclear@0: bin = avrgame nuclear@0: hex = $(bin).hex nuclear@0: eep = $(bin).eep nuclear@0: nuclear@0: mcu_gcc = atmega328p nuclear@0: mcu_dude = m328p nuclear@0: nuclear@0: CC = avr-gcc nuclear@0: OBJCOPY = avr-objcopy nuclear@0: nuclear@0: CFLAGS = -O2 -pedantic -Wall -mmcu=$(mcu_gcc) -DF_CPU=1000000 nuclear@0: LDFLAGS = -Wl,-Map,$(bin).map -mmcu=$(mcu_gcc)# -Wl,-u,vfprintf -lprintf_flt -lm nuclear@0: nuclear@0: .PHONY: all nuclear@0: all: $(hex) $(eep) nuclear@0: nuclear@0: $(bin): $(obj) nuclear@0: $(CC) -o $@ $(obj) $(LDFLAGS) nuclear@0: nuclear@0: $(hex): $(bin) nuclear@0: $(OBJCOPY) -j .text -j .data -O ihex -R .eeprom $< $@ nuclear@0: nuclear@0: $(eep): $(bin) nuclear@0: $(OBJCOPY) -j .eeprom --change-section-lma .eeprom=0 -O ihex $< $@ nuclear@0: nuclear@0: .PHONY: program nuclear@0: program: $(hex) nuclear@0: avrdude -c usbtiny -p $(mcu_dude) -e -U flash:w:$(hex) nuclear@0: nuclear@0: .PHONY: clean nuclear@0: clean: nuclear@0: rm -f $(bin) $(obj) $(hex) $(eep) $(bin).map