📄 makedefs
字号:
#*****************************************************************************## MAKEDEFS - Common definitions for all makefiles.## Copyright (c) 2006 Cirrus Logic, Inc.##*****************************************************************************#*****************************************************************************## The default rule.##*****************************************************************************.PHONY: allall: default#*****************************************************************************## The following defines are for using GCC to cross compile ARM code.##*****************************************************************************ifeq ($(CROSSTOOLS), gcc)## The names of the various tools.#CC = arm-elf-gccLD = arm-elf-ldNM = arm-elf-nmOBJCOPY = arm-elf-objcopy## The extension used for executables.#EXEEXT = elf## The default set of flags for the assembler, compiler, and linker.#AFLAGS = -MD -Wa,-marm7tdmi -DgccCFLAGS = -MD -Wall -fno-common -fshort-enums -mcpu=arm7tdmi -fno-builtin -mapcsLFLAGS = -q## Augment the compiler flags based on whether or not a DEBUG version is being# built.#ifdef DEBUGAFLAGS += -Wa,--gdwarf2CFLAGS += -gelseCFLAGS += -O2endif## Augment the assembler and compiler flags based on the set of pre-defined# values.#ifdef DEFINESAFLAGS += $(patsubst %,-D%,$(DEFINES))CFLAGS += $(patsubst %,-D%,$(DEFINES))endif## Augment the linker flags based on the read-only and read-write base, if# specified.#ifdef ROBASELFLAGS += --defsym ROBASE=$(ROBASE)endififdef RWBASELFLAGS += --defsym RWBASE=$(RWBASE)endif## A rule to create a ROM image from the object files.#$(TARGET).rom: $(OBJS) $(LIBS) $(TARGET).lds $(LD) $(LFLAGS) -T $(TARGET).lds -o $(TARGET).elf $(OBJS) $(LIBS) $(NM) -n $(TARGET).elf | awk '$$2 != "a" {print}' > $(TARGET).map $(OBJCOPY) -O binary $(TARGET).elf $@## The default rule for generating an object file from an assembly source file.#.S.o: $(CC) $(AFLAGS) -c $(<:.s=.S)endif#*****************************************************************************## The following defines are for using ARM SDT 2.5.##*****************************************************************************ifeq ($(CROSSTOOLS), sdt25)## The names of the various tools.#AS = armasmCC = armccLD = armlinkFROMELF = fromelf## The extension used for executables.#EXEEXT = axf## The default set of flags for the assembler, compiler, and linker.#AFLAGS =CFLAGS =CPPFLAGS = -MD -WallLFLAGS = -info size,total -map -noscanlib -remove## Augment the assembler and compiler flags based on whether or not a DEBUG# version is being built.#ifdef DEBUGAFLAGS += -gCFLAGS += -g -zpdebug_inlineselseCFLAGS += -O2 -Otimeendif## Augment the compiler flags based on the set of pre-defined values.#ifdef DEFINESCFLAGS += $(patsubst %,-D%,$(DEFINES))endif## Augment the linker flags based on the read-only base, read-write base, and# first object, if specified.#ifdef ROBASELFLAGS += -ro-base $(ROBASE)endififdef RWBASELFLAGS += -rw-base $(RWBASE)endififdef FIRSTLFLAGS += -first $(FIRST)endififdef ENTRYLFLAGS += -entry $(ENTRY)endif## Convert the names of the libraries from their GCC/Unix (.a) names to the# SDT/Windows (.alf) names.#SDT25LIBS = $(LIBS:.a=.alf)## A rule to extract a ROM image from the executable.#$(TARGET).rom: $(OBJS) $(SDT25LIBS)ifneq ($(OBJS), ) @echo $(OBJS) > linker.viaendififneq ($(SDT25LIBS), ) @echo $(SDT25LIBS) >> linker.viaendif $(LD) $(LFLAGS) -o $(TARGET).$(EXEEXT) -list $(TARGET).map \ -via linker.via @rm -f linker.via $(FROMELF) -nozeropad $(TARGET).$(EXEEXT) -bin $@## The default rule for generating an object file from an assembly source file.#.S.o: @CC="$(CC)" CPPFLAGS="$(CPPFLAGS) -Dsdt25" AS="$(AS)" AFLAGS="$(AFLAGS)" \ sh assemble.sh $<endif#*****************************************************************************## The following defines are for using ARM ADS 1.0/1.1.##*****************************************************************************ifeq ($(CROSSTOOLS), ads)## The names of the various tools.#AS = armasmCC = armccLD = armlinkFROMELF = fromelf## The extension used for executables.#EXEEXT = axf## The default set of flags for the assembler, compiler, and linker.#AFLAGS =CFLAGS =CPPFLAGS = -MD -WallLFLAGS = -info sizes,totals -map -scanlib## Augment the assembler and compiler flags based on whether or not a DEBUG# version is being built.#ifdef DEBUGAFLAGS += -gCFLAGS += -gelseCFLAGS += -O2endif## Augment the compiler flags based on the set of pre-defined values.#ifdef DEFINESCFLAGS += $(patsubst %,-D%,$(DEFINES))endif## Augment the linker flags based on the read-only base, read-write base, and# first object, if specified.#ifdef ROBASELFLAGS += -ro-base $(ROBASE)endififdef RWBASELFLAGS += -rw-base $(RWBASE)endififdef FIRSTLFLAGS += -first $(FIRST)endififdef ENTRYLFLAGS += -entry $(ENTRY)endif## A rule to extract a ROM image from the executable.#$(TARGET).rom: $(OBJS) $(LIBS)ifneq ($(OBJS), ) @echo $(OBJS) > linker.viaendififneq ($(LIBS), ) @echo $(LIBS) >> linker.viaendif $(LD) $(LFLAGS) -o $(TARGET).$(EXEEXT) -list $(TARGET).map \ -via linker.via @rm -f linker.via $(FROMELF) -bin -o $@ $(TARGET).$(EXEEXT)## The default rule for generating an object file from an assembly source file.#.S.o: @CC="$(CC)" CPPFLAGS="$(CPPFLAGS) -Dads" AS="$(AS)" AFLAGS="$(AFLAGS)" \ sh assemble.sh $< endif#*****************************************************************************## The following defines are for using GCC to compile native code.##*****************************************************************************ifeq ($(NATIVETOOLS), gcc)## The names of the various tools.#NATIVECC = gcc -s## The extension used for executables.#PROGEXT = $(shell $(NATIVECC) -dumpmachine | grep cygwin)ifneq ($(PROGEXT),)PROGEXT = .exeendifendif#*****************************************************************************## The following defines are for using MSVC to compile native code.##*****************************************************************************ifeq ($(NATIVETOOLS), msvc)## The names of the various tools.#NATIVECC = cl -nologo## The extension used for executables.#PROGEXT = .exeendif#*****************************************************************************## The following are default rules that are used with any tool set.##*****************************************************************************## The default rule for generating an object file from a C source file.#.c.o: $(CC) $(CFLAGS) -c $< ## Recursively executes make in each of the subdirectories.#ifdef DIRS.PHONY: $(DIRS)$(DIRS): @$(MAKE) -C $@endif## Clean out the source tree.#.PHONY: cleanclean::ifdef DIRS @for i in $(DIRS); do $(MAKE) -C $$i clean; doneendififdef TARGET @rm -f $(TARGET).$(EXEEXT) $(TARGET).rom $(TARGET).mapendif @rm -f $(wildcard *.o) $(wildcard *.obj) $(wildcard *~) \ $(wildcard *.d)#*****************************************************************************## The following are default dependencies.##*****************************************************************************## All of the objects depend upon the makefile and the files that it includes.#$(OBJS): Makefile makedefs## Include the dependencies generated by the build.#-include $(wildcard *.d) __dummy__
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -