分类: 嵌入式
2010-05-20 23:31:54
在$(installdir)\vxworks-6.4\target\h\make\rules.vxWorks中,有编译脚本语句,大概在142行,附在了本文的后面。红色部分是使用工程方式编译要走到的分支,其中$(LD_EXTRA_MODULES_LIST)对应的编译输出是prjExtraModules.lst,既用户自己的库文件和obj文件,可以调整一下顺序,把它放到$(LD_LINK_PATH) $(COMP_LIBS) $(LIBS)与$(LD_PARTIAL_END_GROUP)之间。prjObjs.lst既bsp部分不要换位置,这个lst中的内容跟usrEntry绑定,涉及到整个image的入口。 rules.vxWorks 的内容: ifeq ($(SRC_BUILD), TRUE) $(warning building vxWorks from source) COMP_OBJ_LIST = $(OPTION_PASS_TO_LD)$(OPTION_INDIRECT_FILE)$(PRJ_FULL_PATH)/compObjs.lst CC_LIB += $(CC_LIBINTRINSICS) partialImage.o: version.o usrEntry.o $(PRJ_FULL_PATH)/compObjs.lst src_build $(PRJ_OBJS_FILE) \ $(PRJ_OBJS) $(EXTRA_MODULES) $(RM_EXTRA_MODULES_LIST) $(CREATE_EXTRA_MODULES_LIST) $(LD_PARTIAL) usrEntry.o $(PRJ_OBJS_FOR_LD_PARTIAL) $(COMP_OBJ_LIST) \ $(LD_EXTRA_MODULES_LIST) version.o $(LD_PARTIAL_START_GROUP) \ $(LD_LINK_PATH) -L $(PRJ_FULL_PATH) $(COMP_LIBS) \ $(LD_PARTIAL_END_GROUP) $(CC_LIB) -o $@ $(MAPCMD) else partialImage.o: $(LDDEPS) $(PRJ_OBJS) $(EXTRA_MODULES) \ $(patsubst -l%,lib%.a,$(COMP_LIBS)) \ $(patsubst -l%,lib%.a,$(LIBS)) $(CC_LIB) $(PRJ_OBJS_FILE) version.o usrEntry.o $(RM_EXTRA_MODULES_LIST) $(CREATE_EXTRA_MODULES_LIST) - @ $(RM) $@ ifneq ($(findstring vxWorks_rom, $(DEFAULT_RULE)),) $(LD_PARTIAL) usrEntry.o $(PRJ_OBJS_FOR_LD_PARTIAL) \ $(LD_EXTRA_MODULES_LIST) version.o \ $(LD_PARTIAL_START_GROUP) \ $(LD_LINK_PATH) $(COMP_LIBS) $(LIBS) \ $(LD_PARTIAL_END_GROUP) $(CC_LIB) -o $@ $(MAPCMD) else $(LD_PARTIAL) $(PRJ_OBJS_FOR_LD_PARTIAL) $(LD_EXTRA_MODULES_LIST) \ version.o $(LD_PARTIAL_START_GROUP) \ $(LD_LINK_PATH) $(COMP_LIBS) $(LIBS) $(LD_PARTIAL_END_GROUP) $(CC_LIB) -o $@ $(MAPCMD) endif endif ifeq ($(REMOVE_DEADWEIGHT),TRUE) $(TRIM_TOOL) $@ $@_trim $(MV) $@_trim $@ endif 例子(把一部分obj文件从prjObj.lst中拆出来放到myObj.lst中): $(LD_PARTIAL) -Wl,@../bspObj.lst \ version.o $(LD_PARTIAL_START_GROUP) \ $(LD_LINK_PATH) $(COMP_LIBS) $(LIBS) -Wl,@../myObj.lst $(LD_PARTIAL_END_GROUP) $(CC_LIB) -o $@ $(MAPCMD) |