nuclear@0: src = $(wildcard src/*.c) nuclear@0: obj = $(src:.c=.o) nuclear@0: bin = a500kbd nuclear@0: hex = $(bin).hex nuclear@0: eep = $(bin).eep nuclear@0: nuclear@1: mcu_gcc = atmega168 nuclear@1: mcu_dude = m168 nuclear@0: nuclear@0: CC = avr-gcc nuclear@0: OBJCOPY = avr-objcopy nuclear@0: nuclear@2: CFLAGS = -Os -pedantic -Wall -mmcu=$(mcu_gcc) -DF_CPU=14745600 nuclear@0: LDFLAGS = -Wl,-Map,$(bin).map -mmcu=$(mcu_gcc) -lprintf_min 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: fuses nuclear@0: fuses: nuclear@0: avrdude -c usbtiny -p $(mcu_dude) -U lfuse:w:0xe6:m -U hfuse:w:0xdf:m -U efuse:w:0xf9:m 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