TARGET=wc-licht MCU=atmega8 FREQUENCY=1000000 SOURCES=wc-licht.c ASM_SOURCES=interrupts.S utils.S PROGRAMMER=usbtiny PORT=usb BAUD=19200 #PROGRAMMER=arduino #PORT=/dev/ttyUSB0 #BAUD=19200 OBJECTS=$(SOURCES:.c=.o) OBJECTS+=$(ASM_SOURCES:.S=.o) CFLAGS=-Os -Wall -std=gnu11 "-DF_CPU=$(FREQUENCY)" LDFLAGS= all: hex #eeprom hex: $(TARGET).hex eeprom: $(TARGET)_eeprom.hex $(TARGET).hex: $(TARGET).elf avr-objcopy -O ihex -j .data -j .text $(TARGET).elf $(TARGET).hex $(TARGET)_eeprom.hex: $(TARGET).elf avr-objcopy -O ihex -j .eeprom --change-section-lma .eeprom=1 $(TARGET).elf $(TARGET)_eeprom.hex $(TARGET).elf: $(OBJECTS) avr-gcc $(LDFLAGS) -mmcu=$(MCU) $(OBJECTS) -o $(TARGET).elf .c.o: avr-gcc -c $(CFLAGS) -mmcu=$(MCU) $< -o $@ .S.o: avr-gcc -c $(CFLAGS) -mmcu=$(MCU) $< -o $@ size: avr-size --mcu=$(MCU) -C $(TARGET).elf asm: avr-gcc -S $(CFLAGS) -fverbose-asm -mmcu=$(MCU) $(TARGET).c -o $(TARGET).s program: hex avrdude -p$(MCU) -P$(PORT) -b$(BAUD) -c$(PROGRAMMER) -Uflash:w:$(TARGET).hex:a clean_tmp: rm -rf *.o rm -rf *.elf clean: rm -rf *.o rm -rf *.elf rm -rf *.hex