42 lines
821 B
Makefile
42 lines
821 B
Makefile
|
PRG = rgbyteclock
|
||
|
OBJ = rgbyteclock.o timer.o lcd.o main.o
|
||
|
MCU_TARGET = atmega16
|
||
|
OPTIMIZE = -Os
|
||
|
|
||
|
DEFS =
|
||
|
LIBS =
|
||
|
|
||
|
CC = avr-gcc
|
||
|
|
||
|
override CFLAGS = -g -Wall $(OPTIMIZE) -DF_CPU=16000000UL -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).elf: $(OBJ)
|
||
|
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $^ $(LIBS)
|
||
|
@echo
|
||
|
@$(SIZE) $@
|
||
|
@echo
|
||
|
|
||
|
# dependency:
|
||
|
rgbyteclock.o: timer.o lcd.o rgbyteclock.h
|
||
|
main.o: rgbyteclock.o
|
||
|
timer.o:timer.h
|
||
|
lcd.o: lcd.h
|
||
|
|
||
|
clean:
|
||
|
rm -rf *.o $(PRG).elf *.eps *.png *.pdf *.bak
|
||
|
rm -rf *.lst *.map $(EXTRA_CLEAN_FILES)
|
||
|
|
||
|
hex: $(PRG).hex
|
||
|
|
||
|
%.hex: %.elf
|
||
|
$(OBJCOPY) -j .text -j .data -O ihex $< $@
|
||
|
|