📄 makefile
字号:
#
# Makefile for yampp-3/USB
#
# Jesper Hansen 2001-05-22
#
# Tools and directories
CC = avr-gcc
AS = avr-gcc -x assembler-with-cpp
RM = rm -f
RN = mv
BIN = avr-objcopy
INCDIR = .
LIBDIR = $(AVR)/avr/lib
SHELL = $(AVR)/bin/sh.exe
FORMAT = srec
# library (.a) file creation command
AR= avr-ar rc
# second step in .a creation (use "touch" if not needed)
AR2= avr-ranlib
############################################################################################
############################################################################################
# CPU type
MCU = atmega161
# Target
TRG = yampp3_usb
# C-source files
#SRC = ata_if.c printf.c usb.c control.c $(TRG).c
SRC = printf.c usb.c control.c $(TRG).c
# Assembler source files
ASRC = Glcd_1.asm Glcd_2.asm
# Extra include dir
INC = ../yampp3lib
# Libraries
LIB = $(AVR)/avr/lib/libc.a ../yampp3lib/yampp3lib.a
# Compiler flags
CPFLAGS = -g -Os -Wall -Wstrict-prototypes -Wa,-ahlms=$(<:.c=.lst) -mcall-prologues -I$(INC)
# Assembler flags
ASFLAGS = -Wa,-gstabs,-a=$<.lst
# Linker flags
LDFLAGS = -Wl,-Map=$(TRG).map,--cref
#,-Tldscript.ld
############################################################################################
############################################################################################
#define all project specific object files
OBJ = $(ASRC:.asm=.o) $(SRC:.c=.o)
CPFLAGS += -mmcu=$(MCU)
ASFLAGS += -mmcu=$(MCU)
LDFLAGS += -mmcu=$(MCU)
#this defines the aims of the make process
all: $(TRG).elf $(TRG).bin
#compile: instructions to create assembler and/or object files from C source
%o : %c
$(CC) -c $(CPFLAGS) -I$(INCDIR) $< -o $@
%s : %c
$(CC) -S $(CPFLAGS) -I$(INCDIR) $< -o $@
#assemble: instructions to create object file from assembler files
%o : %asm
$(AS) -c $(ASFLAGS) -I$(INCDIR) $< -o $@
#link: instructions to create elf output file from object files
%elf: $(OBJ)
$(CC) $(OBJ) $(LIB) $(LDFLAGS) -o $@
#create avrobj file from elf output file
%obj: %elf
$(BIN) -O avrobj $< $@
#create bin (ihex, srec) file from elf output file
%rom: %elf
$(BIN) -O $(FORMAT) $< $@
%hex: %elf
$(BIN) -O ihex $< $@
%bin: %elf
$(BIN) -O binary $< $@
avr-size $(TRG).elf
#make instruction to delete created files
clean:
$(RM) $(OBJ)
$(RM) $(TRG).map
$(RM) $(TRG).elf
$(RM) $(TRG).obj
$(RM) $(TRG).eep
$(RM) $(TRG).rom
$(RM) *.bak
$(RM) *.lst
$(RM) *.?_sym
############################################################################################
############################################################################################
###### dependecies, add any dependencies you need here ###################
usb.o : usb.c usb.h makefile
printf.o : printf.c makefile
control.o : control.c Constants.h makefile
$(TRG).o : $(TRG).c types.h mem.h Constants.h makefile
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -