u-Boot 顶层Makefile解析(四)
u-Boot -Makefile(四) 声明 : 以下解析大部分来自网络大神之手 所以可以放心阅读 参考地址不可考 有事请留言 Good luck########################################################################## U-Boot objects....order is important (i.e. start must be first)# 目标文件的顺序很重要 start要排第一OBJS = cpu/$(CPU)/start.o#start.o必须放在目标文件的第一位 因为uboot执行的第一段代码就是start.S# # 某些架构的CPU需要另外的一些目标文件ifeq ($(CPU),i386)OBJS += cpu/$(CPU)/start16.oOBJS += cpu/$(CPU)/reset.oendififeq ($(CPU),ppc4xx)OBJS += cpu/$(CPU)/resetvec.oendififeq ($(CPU),mpc83xx)OBJS += cpu/$(CPU)/resetvec.oendififeq ($(CPU),mpc85xx)OBJS += cpu/$(CPU)/resetvec.oendififeq ($(CPU),mpc86xx)OBJS += cpu/$(CPU)/resetvec.oendififeq ($(CPU),bf533)OBJS += cpu/$(CPU)/start1.ocpu/$(CPU)/interrupt.ocpu/$(CPU)/cache.oOBJS += cpu/$(CPU)/cplbhdlr.ocpu/$(CPU)/cplbmgr.ocpu/$(CPU)/flush.oendifOBJS := $(addprefix $(obj),$(OBJS))#将$(obj)做为前缀添加在$(OBJS)中每个文件的前面# $(addprefix prefix,names)参数prefix是前缀 将其添加在names(names代表文件名 之间用空格隔开)的前面# 最后生成的每个文件也用空格隔开来# 编译U-BOOT所需库文件LIBS = lib_generic/libgeneric.aLIBS += board/$(BOARDDIR)/lib$(BOARD).aLIBS += cpu/$(CPU)/lib$(CPU).aifdef SOCLIBS += cpu/$(CPU)/$(SOC)/lib$(SOC).aendifLIBS += lib_$(ARCH)/lib$(ARCH).aLIBS += fs/cramfs/libcramfs.a fs/fat/libfat.a fs/fdos/libfdos.a fs/jffs2/libjffs2.a \fs/reiserfs/libreiserfs.a fs/ext2/libext2fs.aLIBS += net/libnet.aLIBS += disk/libdisk.aLIBS += rtc/librtc.aLIBS += dtt/libdtt.aLIBS += drivers/libdrivers.aLIBS += drivers/nand/libnand.aLIBS += drivers/nand_legacy/libnand_legacy.aLIBS += drivers/sk98lin/libsk98lin.aLIBS += post/libpost.a post/cpu/libcpu.aLIBS += common/libcommon.aLIBS += $(BOARDLIBS)LIBS := $(addprefix $(obj),$(LIBS)).PHONY : $(LIBS)# .PHONY声明伪目标# Add GCC lib#添加GCC库PLATFORM_LIBS += -L $(shell dirname `$(CC) $(CFLAGS) -print-libgcc-file-name`) -lgcc# The "tools" are needed early, so put this first# Don't include stuff already done in $(LIBS)SUBDIRS= tools \#伪目标SUBDIRS 用于执行tools、examples、post、post\cpu子目录下的make文件 examples \ post \ post/cpu.PHONY : $(SUBDIRS)# .PHONY声明伪目标ifeq ($(CONFIG_NAND_U_BOOT),y)NAND_SPL = nand_splU_BOOT_NAND = $(obj)u-boot-nand.binendif__OBJS := $(subst $(obj),,$(OBJS))#把$(obj)从$(OBJS)、$(LIBS)中删除__LIBS := $(subst $(obj),,$(LIBS))#$(obj)是$(OBJTREE)/ 或者为 空#$(OBJTREE)是BUILD_DIR(自定义目录或者是源码目录)# $(subst from,to,text) 在文本"text"中用"to"替换所有的"from"