############################################################################### # Module name : TOOLSET/arm251 # Module type : Makefile system # Environment(s): arm251 # # ################################################################### ############################################################################### #.. Remove "undef" warnings # cc_includes += cc_defines += cxx_include += cxx_defines += as_includes += as_defines += ############################################################################### #.. Parse user options # Global options already parsed # These options extend the global options # ifdef OPTIONS ifneq "$(findstring wall,$(OPTIONS))" "" # Enable all warnings USE_WALL = 1 endif ifneq "$(findstring list,$(OPTIONS))" "" # Create Listings USE_LIST = 1 endif endif ############################################################################### # # Extend LIBDIRS with toolset libraries # Create a ';' separated list # Start with a space separated list # May need to change if ARMLIB is to be installed # in a path with spaces in it. LIB := $(patsubst %,%;,$(LIBDIRS) $(ARMLIB) $(INGEDEV_LIBS) ) export LIB ############################################################################### #.. C Compiler definition # cc_filter := $(wildcard $(GBE_ROOT)/warnings.arm251) ifdef cc_filter cc_redirect = 1 cc_error_filter = $(awk) -f $(GBE_ROOT)/warnings.arm251 endif ################################################################################ # Compiler options # # -zz-1 # Same as zz0 - sets the zero initialised variable(bss) threshold # # zz0 forces unitialisaed global to be placed in the ZI degment # -c # Compiler, but don't link # -apcs 3/noswst/nofp/interwork # proceedure call options # # 3 - is default ( use unknown) # # /noswst - no software stack checking # # /nofp - no frame pointers # # /interwork - arm/Thumb interworking # -littleend # Generate Little Endian (default) # -list # Create a listing file # -g # Enable generation of debug tables # -zc # Char type is signed # -zap1 # Pointers to Structs aligned to Min # -zat1 # Alignment of top level static objects (default = 1) # -zas1 # Min Byte alignment (default is 4) # -fa # Check for certain types of data flow anomalies # -o filename # Specifies output file # -Ospace # Optimise for Space (default) # -Otime # Optimise for time # -O2 # Full optimize # # -DBSP_LITTLE_ENDIAN=1 # -D__thumb=1 # Standard defines # #.. arm_defines += -D__SOURCE__=\"$(notdir $<)\" # Standard flags # arm_flags += -c -apcs 3/noswst/nofp/interwork arm_flags += -zz-1 -zc -zap1 -zat1 -zas1 -fa -littleend arm_defines += -D__thumb=1 arm_defines += -DBSP_LITTLE_ENDIAN=1 ifdef USE_OPTIMISE # default for production ifdef OPT_MODE arm_flags += -O$(OPT_MODE) endif arm_flags += -O2 else arm_flags += -O0 endif ifdef USE_DEBUGINFO # default for debug arm_flags += -g arm_defines += -DDEBUG else arm_defines += -DNDEBUG endif ifdef USE_STRICT_ANSI # default NO arm_flags += -strict endif ifdef LEAVETMP # default NO arm_flags += endif ifdef USE_LIST arm_flags += -list endif ifdef USE_WALL arm_flags += else endif # Standard includes # #.. arm_includes += arm_includes += $(ARM_INCLUDES) # From Toolset Defs ############################################################################### #.. C Compiler definition # cc = $(CC_PRE) $(compiler) cc_init = cc_o_switch = -o $@ cc_source = $< cc_flags = \ $(patsubst %,%,$(CFLAGS)) \ $(patsubst %,%,$(arm_flags)) \ $(patsubst %,%,$(arm_defines)) \ $(patsubst %,-D%,$(cc_defines)) \ $(patsubst %,-I %,$(INCDIRS)) \ $(patsubst %,-I %,$(cc_includes)) \ $(patsubst %,-I %,$(arm_includes)) cc_term = define cc_pre @echo '[$<] compiling..' endef cc_post = ############################################################################### #.. C++ Compiler definition # cxx = $(CC_PRE) $(compiler) cxx_init = cxx_o_switch = -o $@ cxx_source = $< cxx_flags = \ $(patsubst %,%,$(CXXFLAGS)) \ $(patsubst %,%,$(arm_flags)) \ $(patsubst %,%,$(arm_defines)) \ $(patsubst %,-d%,$(cxx_defines)) \ $(patsubst %,-I %,$(INCDIRS)) \ $(patsubst %,-I %,$(cxx_includes)) \ $(patsubst %,-I %,$(arm_includes)) define cxx_pre @echo '[$<] compiling..' endef define cxx_post endef ############################################################################### #.. C/C++ dependencies # ccdep = $(XX_PRE) $(GBE_BIN)/mkdepend ccdep_init = ccdep_o_switch = -f - ccdep_flags = -MM -b -We -p '$$(OBJDIR)/' -o ".$(o)" ccdep_source = $(filter %.c %.cc %.cpp, $+) > $@ 2> $(OBJDIR)/depend.err ccdep_flags += \ $(patsubst %,%,$(CFLAGS)) \ $(patsubst %,%,$(arm_depend)) \ $(patsubst %,%,$(arm_defines)) \ $(patsubst %,-D%,$(cc_defines)) \ $(patsubst %,-I %,$(INCDIRS)) \ $(patsubst %,-I %,$(cc_includes)) \ $(patsubst %,-Y %,$(arm_includes)) ccdep_pre = ccdep_post = ############################################################################### #.. Linker definition # ld = $(CC_PRE) $(linker) ld_cmdfile = $(subst /,\\,$(basename $@).ld) ld_flags = ld_file_flags = ld_o_switch = -output $@ -via $(ld_cmdfile) ld_term = define ld_pre $(AA_PRE)$(cmdfile) -wkWeo$(ld_cmdfile) \ "$(ld_file_flags) $($(notdir $(basename $@))_ld)"; \ echo '[$@] Linking..';\ $(call show_cmdfile,$(ld_cmdfile)) endef ifndef LEAVETMP define ld_post @$(rm) -f $(ld_cmdfile) endef else define ld_post endef endif ################################################################################ # Library dependency file generation # Use cmdfile to create a file that will be included in this makefile # The generated file will contain library path names that can only be # calculated on the fly # define LDDEPEND $(AA_PRE)$(cmdfile) -wkWeo$(@) "$($(DPLIST))" endef ################################################################################ #.. Archiver Definitions # #.. Archiver # ar = $(XX_PRE) $(librarian) ar_init = ar_cmdfile = $(basename $@).ar ar_flags = ar_o_switch = -v $(ar_cmdfile) define ar_pre $(XX_PRE) $(echo) '[$@] Creating library archive..' ; \ $(rm) -f $@ ;\ $(cmdfile) -ko$(ar_cmdfile) \ -c $@\\n\ $(patsubst %,%\\n,$(filter %.o, $^));\ $(call show_cmdfile,$(ar_cmdfile)) endef ifndef LEAVETMP define ar_post @$(rm) -f $(ar_cmdfile) endef else define ar_post endef endif ################################################################################ #.. Archive Merge # The archive tool can directly merge libaries # armerge = $(XX_PRE) $(GBE_TOOLS)/armerge armerge_init = armerge_flags = -d $(MLIBDIR) -t unix -a $(librarian) armerge_o_switch= $@ $^ define armerge_pre @$(echo) '[$@] Creating a Merged library..' ; \ $(rm) -f $@ endef armerge_post = ############################################################################### #.. Assembler definition # # as = $(XX_PRE) $(assembler) as_init = as_o_switch = -o $@ as_source = $< asm_flags += -16 asm_flags += -apcs /interwork asm_flags += -fpu none asm_flags += $(ASFLAGS) ifdef as_defines #asm_flags += $(addprefix -D,$(as_defines)) endif ifdef USE_DEBUGINFO #asm_flags += -DDEBUG asm_flags += -g else #asm_flags += -DNDEBUG endif as_flags = $(asm_flags) ifdef as_includes as_flags += "-I$(subst $(space),;,$(strip $(as_includes)))" endif as_flags += $(patsubst %,-I%,$(INCDIRS)) ifdef USE_LIST as_flags += -list $(addsuffix .lst, $(basename $(@F))) endif ifdef USE_WALL as_flags += else as_flags += -nowarn endif define as_pre @$(echo) '[$<] Assembling file..' endef define as_post endef