⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 makefile

📁 yampp3 mp3 code
💻
字号:
#
# Makefile for yampp-3/U test
#
# Jesper Hansen 2001-07-01
#


# 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	= yampp3u_test

# C-source files
SRC	= printf.c memtest.c $(TRG).c

# Assembler source files
ASRC    =

# 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


############################################################################################
############################################################################################

#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).obj $(TRG).elf $(TRG).hex $(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 ###################

printf.o	: printf.c printf.h Constants.h makefile
memtest.o	: memtest.c memtest.h Constants.h  makefile
$(TRG).o	: $(TRG).c types.h Constants.h  makefile

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -