📄 builddef.mf
字号:
# makefile fragment builddef.mf
# define some variables to do a build
# get target definitions
include $(TopDir)/$(TARGET).mf
# set VPATH to point at hal subdirectory
VPATH := $(TopDir)/$(CHIPNAME)hal $(VPATH)
# TARGETNAME specifies the target we are building for
# it is defined for conditional compilation in C source
TARGETNAME := $(TARGETNAME.$(TARGET))
# COMPILER defines which tool set to use when building the programs
COMPILER := $(COMPILER.$(TARGET))
# CPU is an option passed on the command line to select the particular CPU family member
CPU := $(CPU.$(TARGET))
# CFLAGS lists the compiler flags to use when compiling C programs
CFLAGS = -Wall $(CFLAGS.$(TARGET)) $(CFLAGS.$(BUILD)) -I$(TopDir)/common
# ASFLAGS lists the flags to be passed to the assembler
ASFLAGS = $(ASFLAGS.$(TARGET)) $(ASFLAGS.$(BUILD))
# LDFLAGS lists the flags to use when linking
LDFLAGS = $(LDFLAGS.$(TARGET)) $(LDFLAGS.$(BUILD))
# ARFLAGS is passed to the archive manager when adding modules to a library
ifneq "$(ARFLAGS.$(TARGET))" ""
ARFLAGS = $(ARFLAGS.$(TARGET))
else
ARFLAGS := rv
endif
# TARGET_ARCH is passed on compiler and linker command line to select correct tools
TARGET_ARCH := -b $(COMPILER)
# TARGET_MACH is passed on compiler and assembler command line to select CPU variant
TARGET_MACH := $(CPU)
# user libraries that need to be linked with an application
LOADLIBES = $(patsubst %, $(LibDir)/%.$(LIB), $(LIBS))
# flags to give to the C/C++ preprocessor
ifneq "$(CPPFLAGS.$(TARGET))" ""
CPPFLAGS = $(CPPFLAGS.$(TARGET)) $(CPPFLAGS.$(BUILD))
else
CPPFLAGS = -MMD $(patsubst %, -I%, $(VPATH)) -I- -D$(TARGETNAME) $(CPPFLAGS.$(BUILD))
endif
# compiler
ifneq "$(CC.$(TARGET))" ""
CC = $(CC.$(TARGET))
else
CC := gcc
endif
# assembler
ifneq "$(AS.$(TARGET))" ""
AS = $(AS.$(TARGET))
else
AS = $(CC) $(TARGET_ARCH) -c
endif
# library manager
ifneq "$(AR.$(TARGET))" ""
AR = $(AR.$(TARGET))
else
AR = $(COMPILER)-ar
endif
# utility to create index in libraries
ifneq "$(RANLIB.$(TARGET))" ""
RANLIB = $(RANLIB.$(TARGET))
else
RANLIB = $(COMPILER)-ranl $@
endif
# utility to translate between object formats
ifneq "$(OBJCOPY.$(TARGET))" ""
OBJCOPY = $(OBJCOPY.$(TARGET))
else
OBJCOPY := $(COMPILER)-objc
endif
# filename extensions
ASM := $(ASM.$(TARGET))
OBJ := $(OBJ.$(TARGET))
LIB := $(LIB.$(TARGET))
EXE := $(EXE.$(TARGET))
HEX := $(HEX.$(TARGET))
DEP := $(DEP.$(TARGET))
# 'extra' objects needed for HAL and LIBSE
# use just the basename here - no filename extensions
HAL_EXTRAS := $(HAL_EXTRAS.$(TARGET))
LIBSE_EXTRAS := $(LIBSE_EXTRAS.$(TARGET))
# extra object files to be linked with every application
EXTRAS := $(EXTRAS.$(TARGET))
# Rule to build EXE from object
%.$(EXE): %.$(OBJ)
$(LINK.$(TARGET))
# Command line to make output (Hex) file from EXE
EXEtoHEX = $(EXEtoHEX.$(TARGET))
# command to delete all 're-buildable' files
ifneq "$(CLEAN.EXTRA)" ""
CLEAN := for %f in (*.$(ASM) *.$(OBJ) *.$(LIB) *.$(EXE) *.$(DEP) *.$(CLEAN.EXTRA) $(Mkfile)) do $(Rm) %f
else
CLEAN := for %f in (*.$(ASM) *.$(OBJ) *.$(LIB) *.$(EXE) *.$(DEP) $(Mkfile)) do $(Rm) %f
endif
# end of builddef.mf
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -