#########################################################################
# 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.o
OBJS += cpu/$(CPU)/reset.o
endif
ifeq ($(CPU),ppc4xx)
OBJS += cpu/$(CPU)/resetvec.o
endif
ifeq ($(CPU),mpc83xx)
OBJS += cpu/$(CPU)/resetvec.o
endif
ifeq ($(CPU),mpc85xx)
OBJS += cpu/$(CPU)/resetvec.o
endif
ifeq ($(CPU),mpc86xx)
OBJS += cpu/$(CPU)/resetvec.o
endif
ifeq ($(CPU),bf533)
OBJS += cpu/$(CPU)/start1.o cpu/$(CPU)/interrupt.o cpu/$(CPU)/cache.o
OBJS += cpu/$(CPU)/cplbhdlr.o cpu/$(CPU)/cplbmgr.o cpu/$(CPU)/flush.o
endif
OBJS := $(addprefix $(obj),$(OBJS)) #将$(obj)做为前缀添加在$(OBJS)中每个文件的前面
# $(addprefix prefix,names)参数prefix是前缀 将其添加在names(names代表文件名 之间用空格隔开)的前面
# 最后生成的每个文件也用空格隔开来
# 编译U-BOOT所需库文件
LIBS = lib_generic/libgeneric.a
LIBS += board/$(BOARDDIR)/lib$(BOARD).a
LIBS += cpu/$(CPU)/lib$(CPU).a
ifdef SOC
LIBS += cpu/$(CPU)/$(SOC)/lib$(SOC).a
endif
LIBS += lib_$(ARCH)/lib$(ARCH).a
LIBS += fs/cramfs/libcramfs.a fs/fat/libfat.a fs/fdos/libfdos.a fs/jffs2/libjffs2.a \
fs/reiserfs/libreiserfs.a fs/ext2/libext2fs.a
LIBS += net/libnet.a
LIBS += disk/libdisk.a
LIBS += rtc/librtc.a
LIBS += dtt/libdtt.a
LIBS += drivers/libdrivers.a
LIBS += drivers/nand/libnand.a
LIBS += drivers/nand_legacy/libnand_legacy.a
LIBS += drivers/sk98lin/libsk98lin.a
LIBS += post/libpost.a post/cpu/libcpu.a
LIBS += common/libcommon.a
LIBS += $(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_spl
U_BOOT_NAND = $(obj)u-boot-nand.bin
endif
__OBJS := $(subst $(obj),,$(OBJS)) #把$(obj)从$(OBJS)、$(LIBS)中删除
__LIBS := $(subst $(obj),,$(LIBS)) #$(obj)是$(OBJTREE)/ 或者为 空
#$(OBJTREE)是BUILD_DIR(自定义目录或者是源码目录)
# $(subst from,to,text) 在文本"text"中用"to"替换所有的"from"