rgbyteclock-code/Makefile

56 lines
1.3 KiB
Makefile

PRG = rgbyteclock
OBJ = rgbyteclock.o timer.o lcd.o main.o rtc.o spi.o ringbuffer.o crc.o ledcontroller.o led1642gw.o
MCU_TARGET = atmega164a
OPTIMIZE = -Os
DEFS =
LIBS =
CC = avr-gcc
override CFLAGS = -g -Wall $(OPTIMIZE) -DF_CPU=20000000UL -std=gnu99 -mmcu=$(MCU_TARGET) $(DEFS)
override LDFLAGS = -Wl,-Map,$(PRG).map
OBJCOPY = avr-objcopy
OBJDUMP = avr-objdump
SIZE = avr-size -A
all: $(PRG).hex $(PRG).bin
$(PRG).elf: $(OBJ)
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $^ $(LIBS)
@echo
@$(SIZE) $@
@echo
# dependency:
rgbyteclock.o: timer.o lcd.o rgbyteclock.h rtc.o spi.o ledcontroller.o
main.o: rgbyteclock.o lcd.o spi.o ledcontroller.o rtc.o timer.o
ledcontroller.o: led1642gw.o
led1642gw.o: led1642gw.h
timer.o: timer.h
lcd.o: lcd.h timer.o
rtc.o: rtc.h
spi.o: spi.h crc.o ringbuffer.o
ringbuffer.o: ringbuffer.h
crc.o: crc.h
ledcontroller.o: ledcontroller.h
clean:
rm -rf *.o $(PRG).elf $(PRG).bin $(PRG).hex *.eps *.png *.pdf *.bak
rm -rf *.lst *.map $(EXTRA_CLEAN_FILES)
hex: $(PRG).hex
bin: $(PRG).bin
%.hex: %.elf
$(OBJCOPY) -j .text -j .data -O ihex $< $@
%.bin: %.elf
$(OBJCOPY) -j .text -j .data -O binary $< $@
prg: $(PRG).bin
python2 megaHidProg.py -C -c 1000 -t 4 -b $(PRG).bin