Hier ist die make-Datei:
Code:
###############################################################################
# Makefile for the project AsuroLib
###############################################################################
## General Flags
PROJECT = AsuroLib
MCU = atmega8
TARGET = AsuroLib.elf
CC = avr-gcc.exe
AR = avr-ar
OBJDUMP = avr-objdump
## Options common to compile, link and assembly rules
COMMON = -mmcu=$(MCU)
## Compile options common for all C compilation units.
CFLAGS = $(COMMON)
CFLAGS += -Wall -gdwarf-2 -Os -I./inc
CFLAGS += -MD -MP -MT $(*F).o -MF dep/$(@F).d
## Assembly specific flags
ASMFLAGS = $(COMMON)
ASMFLAGS += -x assembler-with-cpp -Wa,-gdwarf2
## Linker flags
LDFLAGS = $(COMMON)
LDFLAGS +=
## Intel Hex file production flags
HEX_FLASH_FLAGS = -R .eeprom
HEX_EEPROM_FLAGS = -j .eeprom
HEX_EEPROM_FLAGS += --set-section-flags=.eeprom="alloc,load"
HEX_EEPROM_FLAGS += --change-section-lma .eeprom=0
## Objects that must be built in order to link
OBJECTS = globals.o adc.o encoder.o encoder_low.o i2c.o leds.o lcd.o\
motor.o motor_low.o print.o rc5.o sound.o switches.o\
time.o uart.o version.o
## Objects explicitly added by the user
LINKONLYOBJECTS =
# Define directories, if needed.
DIRAVR = C:/WinAVR
DIRAVRBIN = $(DIRAVR)/bin
DIRAVRUTILS = $(DIRAVR)/utils/bin
DIRINC = .
DIRLIB = $(DIRAVR)/avr/lib
LIB = asuro
LIBFILE = lib$(LIB).a
HEADER = asuro.h
## Build
all: $(LIBFILE)
rm -rf *.o *~
%.o: %.c
$(CC) $(INCLUDES) $(CFLAGS) -c $<
$(LIBFILE): $(OBJECTS)
$(AR) cru $(LIBFILE) $(OBJECTS)
## Clean target
clean:
rm -rf *.o *~ $(LIBFILE)
rm -rf *.lst *.map $(EXTRA_CLEAN_FILES)
rm -rf dep/*.d
install:
cp $(LIBFILE) $(DIRLIB)/$(LIBFILE)
cp inc/$(HEADER) $(DIRINC)/$(HEADER)
lst: $(OBJECTS:%.o=%.lst)
%.lst: %.o
$(OBJDUMP) -h -S $< > $@
## Other dependencies
-include $(shell mkdir dep 2>/dev/null) $(wildcard dep/*)
Lesezeichen