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

📄 inc.makefile

📁 1. 8623L平台
💻 MAKEFILE
📖 第 1 页 / 共 2 页
字号:
CXXFLAGS += -gdwarf-2elseCFLAGS += -gCXXFLAGS += -gendif # end of CROSS switchendif # end of COMPILER switchendif # -g only in user compilationsendif # end of release switch### Platform Optionifdef RMPLATFORMPREPROCESSORFLAGS += -DRMPLATFORM=$(RMPLATFORM)endif### Bug 7037: force compilation in 32-bit in withhost mode when if -DWITH_32BITS_COMPILATION=1 is defined in RMCFLAGS### This is for x86 architectures running 64-bit compilers.ifneq '$(filter -DEM86XX_MODE=EM86XX_MODEID_WITHHOST, $(RMCFLAGS))' ''ifneq '$(filter -DWITH_32BITS_COMPILATION=1, $(RMCFLAGS))' ''$(warning Notice: -DWITH_32BITS_COMPILATION=1 is defined in RMCFLAGS, forcing compilation of binaries in 32-bit mode.)ifeq '$(filter -m32, $(RMCFLAGS))' ''RMCFLAGS += -m32endififeq '$(filter -m32, $(LDFLAGS))' ''LDFLAGS += -m32endifendifendifCFLAGS += $(PREPROCESSORFLAGS) $(CWARNINGS)CPPFLAGS := $(filter-out -include include/linux/autoconf.h,$(CPPFLAGS))## kernel code is always in CCXXFLAGS += $(PREPROCESSORFLAGS) $(CXXWARNINGS) ########################################################### select compilation according to COMPILKIND variable ###########################################################TARGET_TYPE := $(strip $(TARGET_TYPE))ifeq "$(TARGET_TYPE)" "LIBRARY"ifneq '$(filter static, $(COMPILKIND))' ''TARGET_TYPE :=  OBJECT_LIBRARYelseTARGET_TYPE :=  SHARED_LIBRARYendifendififneq '$(filter static, $(COMPILKIND))' ''STATIC_LINKS_WITH += $(LINKS_WITH)LDFLAGS += -staticelseifneq '$(filter implicit, $(COMPILKIND))' ''IMPLICIT_LINKS_WITH := $(LINKS_WITH)elseDEPENDS_ON += $(LINKS_WITH)endifendif########################################################### Compute the local object files and the dependencies ## #########################################################SRC      := $(strip $(SRC))MAIN_SRC := $(strip $(MAIN_SRC))OBJ      := $(addsuffix .o, $(basename $(SRC)))MAIN_OBJ := $(addsuffix .o, $(basename $(MAIN_SRC)))dep      := $(addsuffix .d, $(basename $(SRC) $(MAIN_SRC)))EXE      := $(basename $(MAIN_SRC))dependencies    := $(DEPENDS_ON) $(STATIC_LINKS_WITH) $(IMPLICIT_LINKS_WITH)dependency_dirs := $(dir $(shell echo '$(dependencies)' | sed -e 's/([^(]*)//g'| sed -e 's/)//g' ) )ifeq "$(TARGET_TYPE)" "OBJFILE"TARGET := $(OBJ)endififeq "$(TARGET_TYPE)" "EXECUTABLE"TARGET := $(EXE)endififeq "$(TARGET_TYPE)" "MICROCODE"ifeq '$(findstring _bin.h, $(TARGET))' ''$(error target name is not valid (must end with _bin.h))endifUCODE_NAME := $(strip $(subst _bin.h,, $(TARGET)))TMP_FILES += \    $(addprefix $(UCODE_NAME), .log .lst .map .prof .bin _release.bin _labels.h _structures.h) \    .romfs_nameendif############################### rule to make the target ###############################.PHONY: allall: $(TARGET)ifeq "$(TARGET_TYPE)" "OBJECT_LIBRARY"$(TARGET): $(OBJ) $(dependencies)	rm -f $@	$(AR) rcs $@ $(filter-out %.a, $^)# as discussed in bug #5408, for each depending static library (identified# by extension .a) which is newer than the target static library, extract# the contents of such dependency in a temporary directory, prefix the# name of the depending library to the object file and add to the target# library.	@lib_list="$(filter %.a, $^)"; \	if [ "$$lib_list" != "" ]; \	then \            tmpdir=`mktemp -d /tmp/$(@F).XXXXXX` && { \	        cd $$tmpdir; \                for lib in $$lib_list; \		do \		    case $$lib in /*) abslib=$$lib;; *) abslib=$$OLDPWD/$$lib;; esac; \	            libfile=`basename $$lib`; \	            echo "ar x $$lib"; \                    file_list=`$(AR) t $$abslib`; \                    $(AR) x $$abslib; \                    for file in $$file_list; do mv $$file $${libfile}_$$file; done; \                done; \                file_list=`ls | tr "\n" " "`; \	        echo "ar rcs $@ $$file_list"; \                $(AR) rcs $$OLDPWD/$@ $$file_list; \	        cd - >/dev/null; \                rm -r $$tmpdir; \            }; \	fiendififeq "$(TARGET_TYPE)" "RELOCATABLE_OBJECT"$(TARGET): $(OBJ) $(dependencies) $(EXTERNAL_STATIC_LINKS_WITH)	$(LD) -r $(OBJECTFLAGS) $^ -o $@endifdynamic_library_dependencies := \    $(filter %.so, $(dependencies) $(EXTERNAL_STATIC_LINKS_WITH))static_library_dependencies  := \    $(filter %.a,  $(dependencies) $(EXTERNAL_STATIC_LINKS_WITH))library_dependencies := $(static_library_dependencies) $(dynamic_library_dependencies)ifeq "$(TARGET_TYPE)" "SHARED_LIBRARY"dash_L_list := \    $(addprefix -L, $(sort $(dir $(dynamic_library_dependencies))))dash_l_list := \    $(addprefix -l, $(basename $(patsubst lib%, %, $(notdir $(dynamic_library_dependencies)))))$(TARGET): $(OBJ) $(dependencies) $(EXTERNAL_STATIC_LINKS_WITH)	@lib_list="$(filter %.a, $^)"; \	tmpdir=`mktemp -d /tmp/$(@F).XXXXXX` && { \	    cd $$tmpdir; \	    for lib in $$lib_list; \	    do \	        case $$lib in /*) abslib=$$lib;; *) abslib=$$OLDPWD/$$lib;; esac; \	        libfile=`basename $$lib | sed 's/\..*//'`; \	        echo "ar x $$lib"; \	        file_list=`$(AR) t $$abslib`; \	        $(AR) x $$abslib; \	        for file in $$file_list; do mv $$file $${libfile}_$$file; done; \	    done; \	    file_list=`ls | sed "s-^-$$tmpdir/-" | tr "\n" " "`; \	    cd - >/dev/null; \	    echo '$(LINKTOOL) -shared $(filter-out $(dynamic_library_dependencies), $^)' \	        '$(dash_L_list) $(dash_l_list) $(LDFLAGS) -o $@'; \	    $(LINKTOOL) -shared $(filter-out $(library_dependencies), $^) $$file_list \	        $(dash_L_list) $(dash_l_list) $(LDFLAGS) -o $@; \	    rm -r $$tmpdir; \	}endififeq "$(TARGET_TYPE)" "EXECUTABLE"dash_L_list := \    $(addprefix -L, $(sort $(dir $(library_dependencies))))dash_l_list := \    $(addprefix -l, $(basename $(patsubst lib%, %, $(notdir $(library_dependencies)))))$(TARGET): %: %.o $(OBJ) $(dependencies) $(EXTERNAL_STATIC_LINKS_WITH)	$(LINKTOOL) $(filter-out $(library_dependencies), $^) $(dash_L_list) -Xlinker --start-group $(dash_l_list) -Xlinker --end-group $(LDFLAGS) $(EXEFLAGS) -o $@	chmod a+x $@endififeq "$(TARGET_TYPE)" "MICROCODE"$(TARGET): $(OBJ)	$(SPASM) $(SPASMFLAGS) $^ -o $(UCODE_NAME).bin	$(SPBIN) $(SPBINFLAGS) -h $(UCODE_NAME).binifdef DEBUGUCODEBUILD	$(SPADE) $(SPADEFLAGS) -bin $(UCODE_NAME).bin -o $(UCODE_NAME)_debug.binendif	(echo -n "RMuint8 $(UCODE_NAME)_bin["; wc -c < $(UCODE_NAME)_release.bin | perl -pe 's/\n//'; echo "] = {"; od -v -An -tx1 $(UCODE_NAME)_release.bin | perl -pe 's/([0-9a-fA-f]+)/0x\1,/g'; echo "};") > $@	echo $(ROMFS_NAME) > .romfs_nameendififeq "$(TARGET_TYPE)" "BINARY_FILE"$(TARGET): $(EXE)# mips compiler generates a large quantity of informative and debug sections. # Keep only the required:	$(OBJCOPY) --remove-section=.reginfo -O binary $< $@# note: in a previous version of the updated inc.Makefile, each member of the $(EXE)# list was depending first on the corresponding .o file, then on the $(OBJ) list of# objects.# This unfortunately breaks the IRQ handler, since is guarantees that the init code# can never be laid out at the beginning of the object, thereby preventing the IRQ# handler from running altogether.# Whether something that specific (expecting a specific layout of the dependencies, # when not setting them explicitely) should be handled by a generic rule as that# below remains to be discussed.# In any case, it is said here that it is important that the order '$(OBJ) %.o'# below be kept as is, *and* that $(OBJ) never be sorted.$(EXE): %: $(OBJ) %.o $(dependencies) $(EXTERNAL_STATIC_LINKS_WITH)	$(LINKTOOL) $^ $(LDFLAGS) $(EXEFLAGS) -o $@	chmod a+x $@endif################################################################# dependencies must be acted upon whether they exist or not #################################################################$(dependencies): FORCE######################################################### include and compute if necessary the dependencies #########################################################ifeq '$(findstring clean, $(MAKECMDGOALS))' ''-include $(dep)endif################################ how to clean the project ################################cleanall_list := $(dependency_dirs:%=%cleanall).PHONY: cleanall $(cleanall_list)cleanall: clean $(cleanall_list).PHONY: cleanclean: 	$(RM) $(OBJ) $(MAIN_OBJ) $(dep) $(TARGET) $(TMP_FILES) $(EXTRA_CLEAN_FILES) *~ *.gdb############# RULES #############dependency_list := $(dependencies)ifdef NO_LIB_SUBDIRdependency_list := $(filter-out ../lib/%, $(dependency_list))dependency_list := $(filter-out ../../lib/%, $(dependency_list))cleanall_list := $(filter-out ../lib/%, $(cleanall_list))cleanall_list := $(filter-out ../../lib/%, $(cleanall_list))endif$(sort \$(cleanall_list) \$(dependency_list)):	$(MAKE) $(MAKEARGS) -C $(@D) $(@F)%.o: %.asm# Bug #5777 explains how ccache is currently incompatible with SPASM. Until the resolution of# that bug, ccache will be disabled for asm compilation.#	$(CCACHE) $(SPASM) $(SPASMFLAGS) -c $< -o $@	$(SPASM) $(SPASMFLAGS) -c $< -o $@# Do not use $(CROSS)-cpp because arm-elf-cpp does not recognize .asmifeq '$(filter -DEM86XX_CHIP=EM86XX_CHIPID_TANGO2, $(RMCFLAGS))' ''define depend_commandcpp $(MUM_KI) $(filter-out -nostdinc, $(PREPROCESSORFLAGS)) -MM -MG $< | sed 's%^$(*F).o:%$*.o:%' | sed 's%:% $@: $(LOCAL_MAKEFILE)%' > $@endefelse # Not Tango2define depend_command$(CROSS)cpp $(MUM_KI) $(filter-out -nostdinc, $(PREPROCESSORFLAGS)) -MM -MG $< | sed 's%^$(*F).o:%$*.o:%' | sed 's%:% $@: $(LOCAL_MAKEFILE)%' > $@endefendif%.d: %.c	$(depend_command)%.d: %.asm	$(depend_command)%.d: %.cpp	$(depend_command).PHONY: FORCEFORCE:

⌨️ 快捷键说明

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