📄 makefile.l
字号:
01 #02 # (C) Copyright 2000-200603 # Wolfgang Denk, DENX Software Engineering, wd@denx.de.04 #05 # See file CREDITS for list of people who contributed to this06 # project.07 #08 # This program is free software; you can redistribute it and/or09 # modify it under the terms of the GNU General Public License as10 # published by the Free Software Foundatio; either version 2 of11 # the License, or (at your option) any later version.12 #13 # This program is distributed in the hope that it will be useful,14 # but WITHOUT ANY WARRANTY; without even the implied warranty of15 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the16 # GNU General Public License for more details.17 #18 # You should have received a copy of the GNU General Public License19 # along with this program; if not, write to the Free Software20 # Foundation, Inc., 59 Temple Place, Suite 330, Boston,21 # MA 02111-1307 USA22 #23 24 VERSION = 125 PATCHLEVEL = 126 SUBLEVEL = 627 EXTRAVERSION =28 U_BOOT_VERSION = $(VERSION).$(PATCHLEVEL).$(SUBLEVEL)$(EXTRAVERSION)29 VERSION_FILE = $(obj)include/version_autogenerated.h30 31 HOSTARCH := $(shell uname -m | \32 sed -e s/i.86/i386/ \33 -e s/sun4u/sparc64/ \34 -e s/arm.*/arm/ \35 -e s/sa110/arm/ \36 -e s/powerpc/ppc/ \37 -e s/macppc/ppc/)38 39 HOSTOS := $(shell uname -s | tr '[:upper:]' '[:lower:]' | \40 sed -e 's/\(cygwin\).*/cygwin/')41 42 export HOSTARCH HOSTOS43 44 # Deal with colliding definitions from tcsh etc.45 VENDOR=46 47 #########################################################################48 #49 # U-boot build supports producing a object files to the separate external50 # directory. Two use cases are supported:51 #52 # 1) Add O= to the make command line53 # 'make O=/tmp/build all'54 #55 # 2) Set environement variable BUILD_DIR to point to the desired location56 # 'export BUILD_DIR=/tmp/build'57 # 'make'58 #59 # The second approach can also be used with a MAKEALL script60 # 'export BUILD_DIR=/tmp/build'61 # './MAKEALL'62 #63 # Command line 'O=' setting overrides BUILD_DIR environent variable.64 #65 # When none of the above methods is used the local build is performed and66 # the object files are placed in the source directory.67 #68 69 ifdef O70 ifeq ("$(origin O)", "command line")71 BUILD_DIR := $(O)72 endif73 endif74 75 ifneq ($(BUILD_DIR),)76 saved-output := $(BUILD_DIR)77 78 # Attempt to create a output directory.79 $(shell [ -d ${BUILD_DIR} ] || mkdir -p ${BUILD_DIR})80 81 # Verify if it was successful.82 BUILD_DIR := $(shell cd $(BUILD_DIR) && /bin/pwd)83 $(if $(BUILD_DIR),,$(error output directory "$(saved-output)" does not exist))84 endif # ifneq ($(BUILD_DIR),)85 86 OBJTREE := $(if $(BUILD_DIR),$(BUILD_DIR),$(CURDIR))87 SRCTREE := $(CURDIR)88 TOPDIR := $(SRCTREE)89 LNDIR := $(OBJTREE)90 export TOPDIR SRCTREE OBJTREE91 92 MKCONFIG := $(SRCTREE)/mkconfig93 export MKCONFIG94 95 ifneq ($(OBJTREE),$(SRCTREE))96 REMOTE_BUILD := 197 export REMOTE_BUILD98 endif99 100 # $(obj) and (src) are defined in config.mk but here in main Makefile101 # we also need them before config.mk is included which is the case for102 # some targets like unconfig, clean, clobber, distclean, etc.103 ifneq ($(OBJTREE),$(SRCTREE))104 obj := $(OBJTREE)/105 src := $(SRCTREE)/106 else107 obj :=108 src :=109 endif110 export obj src111 112 #########################################################################113 114 ifeq ($(OBJTREE)/include/config.mk,$(wildcard $(OBJTREE)/include/config.mk))115 116 # load ARCH, BOARD, and CPU configuration117 include $(OBJTREE)/include/config.mk118 export ARCH CPU BOARD VENDOR SOC119 120 ifndef CROSS_COMPILE121 ifeq ($(HOSTARCH),ppc)122 CROSS_COMPILE =123 else124 ifeq ($(ARCH),ppc)125 CROSS_COMPILE = powerpc-linux-126 endif127 ifeq ($(ARCH),arm)128 CROSS_COMPILE = arm-linux-129 endif130 ifeq ($(ARCH),i386)131 ifeq ($(HOSTARCH),i386)132 CROSS_COMPILE =133 else134 CROSS_COMPILE = i386-linux-135 endif136 endif137 ifeq ($(ARCH),mips)138 CROSS_COMPILE = mips_4KC-139 endif140 ifeq ($(ARCH),nios)141 CROSS_COMPILE = nios-elf-142 endif143 ifeq ($(ARCH),nios2)144 CROSS_COMPILE = nios2-elf-145 endif146 ifeq ($(ARCH),m68k)147 CROSS_COMPILE = m68k-elf-148 endif149 ifeq ($(ARCH),microblaze)150 CROSS_COMPILE = mb-151 endif152 ifeq ($(ARCH),blackfin)153 CROSS_COMPILE = bfin-elf-154 endif155 ifeq ($(ARCH),avr32)156 CROSS_COMPILE = avr32-157 endif158 endif159 endif160 161 export CROSS_COMPILE162 163 # load other configuration164 include $(TOPDIR)/config.mk165 166 #########################################################################167 # U-Boot objects....order is important (i.e. start must be first)168 169 OBJS = cpu/$(CPU)/start.o170 ifeq ($(CPU),i386)171 OBJS += cpu/$(CPU)/start16.o172 OBJS += cpu/$(CPU)/reset.o173 endif174 ifeq ($(CPU),ppc4xx)175 OBJS += cpu/$(CPU)/resetvec.o176 endif177 ifeq ($(CPU),mpc83xx)178 OBJS += cpu/$(CPU)/resetvec.o179 endif180 ifeq ($(CPU),mpc85xx)181 OBJS += cpu/$(CPU)/resetvec.o182 endif183 ifeq ($(CPU),mpc86xx)184 OBJS += cpu/$(CPU)/resetvec.o185 endif186 ifeq ($(CPU),bf533)187 OBJS += cpu/$(CPU)/start1.o cpu/$(CPU)/interrupt.o cpu/$(CPU)/cache.o188 OBJS += cpu/$(CPU)/cplbhdlr.o cpu/$(CPU)/cplbmgr.o cpu/$(CPU)/flush.o189 endif190 191 OBJS := $(addprefix $(obj),$(OBJS))192 193 LIBS = lib_generic/libgeneric.a194 LIBS += board/$(BOARDDIR)/lib$(BOARD).a195 LIBS += cpu/$(CPU)/lib$(CPU).a196 ifdef SOC197 LIBS += cpu/$(CPU)/$(SOC)/lib$(SOC).a198 endif199 LIBS += lib_$(ARCH)/lib$(ARCH).a200 LIBS += fs/cramfs/libcramfs.a fs/fat/libfat.a fs/fdos/libfdos.a fs/jffs2/libjffs2.a \201 fs/reiserfs/libreiserfs.a fs/ext2/libext2fs.a202 LIBS += net/libnet.a203 LIBS += disk/libdisk.a204 LIBS += rtc/librtc.a205 LIBS += dtt/libdtt.a206 LIBS += drivers/libdrivers.a207 LIBS += drivers/nand/libnand.a208 LIBS += drivers/nand_legacy/libnand_legacy.a209 LIBS += drivers/sk98lin/libsk98lin.a210 LIBS += post/libpost.a post/cpu/libcpu.a211 LIBS += common/libcommon.a212 LIBS += $(BOARDLIBS)213 214 LIBS := $(addprefix $(obj),$(LIBS))215 .PHONY : $(LIBS)216 217 # Add GCC lib218 PLATFORM_LIBS += -L $(shell dirname `$(CC) $(CFLAGS) -print-libgcc-file-name`) -lgcc219 220 # The "tools" are needed early, so put this first221 # Don't include stuff already done in $(LIBS)222 SUBDIRS = tools \223 examples \224 post \225 post/cpu226 .PHONY : $(SUBDIRS)227 228 ifeq ($(CONFIG_NAND_U_BOOT),y)229 NAND_SPL = nand_spl230 U_BOOT_NAND = $(obj)u-boot-nand.bin231 endif232 233 __OBJS := $(subst $(obj),,$(OBJS))234 __LIBS := $(subst $(obj),,$(LIBS))235 236 #########################################################################237 #########################################################################238 239 ALL = $(obj)u-boot.srec $(obj)u-boot.bin $(obj)System.map $(U_BOOT_NAND)240 241 all: $(ALL)242 243 $(obj)u-boot.hex: $(obj)u-boot244 $(OBJCOPY) ${OBJCFLAGS} -O ihex $< $@245 246 $(obj)u-boot.srec: $(obj)u-boot247 $(OBJCOPY) ${OBJCFLAGS} -O srec $< $@248 249 $(obj)u-boot.bin: $(obj)u-boot250 $(OBJCOPY) ${OBJCFLAGS} -O binary $< $@251 252 $(obj)u-boot.img: $(obj)u-boot.bin253 ./tools/mkimage -A $(ARCH) -T firmware -C none \254 -a $(TEXT_BASE) -e 0 \255 -n $(shell sed -n -e 's/.*U_BOOT_VERSION//p' $(VERSION_FILE) | \256 sed -e 's/"[ ]*$$/ for $(BOARD) board"/') \257 -d $< $@258 259 $(obj)u-boot.dis: $(obj)u-boot260 $(OBJDUMP) -d $< > $@261 262 $(obj)u-boot: depend version $(SUBDIRS) $(OBJS) $(LIBS) $(LDSCRIPT)263 UNDEF_SYM=`$(OBJDUMP) -x $(LIBS) |sed -n -e 's/.*\(__u_boot_cmd_.*\)/-u\1/p'|sort|uniq`;\264 cd $(LNDIR) && $(LD) $(LDFLAGS) $$UNDEF_SYM $(__OBJS) \265 --start-group $(__LIBS) --end-group $(PLATFORM_LIBS) \266 -Map u-boot.map -o u-boot267 268 $(OBJS):269 $(MAKE) -C cpu/$(CPU) $(if $(REMOTE_BUILD),$@,$(notdir $@))270 271 $(LIBS):272 $(MAKE) -C $(dir $(subst $(obj),,$@))273 274 $(SUBDIRS):275 $(MAKE) -C $@ all276 277 $(NAND_SPL): version278 $(MAKE) -C nand_spl/board/$(BOARDDIR) all279 280 $(U_BOOT_NAND): $(NAND_SPL) $(obj)u-boot.bin281 cat $(obj)nand_spl/u-boot-spl-16k.bin $(obj)u-boot.bin > $(obj)u-boot-nand.bin282 283 version:284 @echo -n "#define U_BOOT_VERSION \"U-Boot " > $(VERSION_FILE); \285 echo -n "$(U_BOOT_VERSION)" >> $(VERSION_FILE); \286 echo -n $(shell $(CONFIG_SHELL) $(TOPDIR)/tools/setlocalversion \287 $(TOPDIR)) >> $(VERSION_FILE); \288 echo "\"" >> $(VERSION_FILE)289 290 gdbtools:291 $(MAKE) -C tools/gdb all || exit 1292 293 updater:294 $(MAKE) -C tools/updater all || exit 1295 296 env:297 $(MAKE) -C tools/env all || exit 1298 299 depend dep:300 for dir in $(SUBDIRS) ; do $(MAKE) -C $$dir _depend ; done301 302 tags ctags:303 ctags -w -o $(OBJTREE)/ctags `find $(SUBDIRS) include \304 lib_generic board/$(BOARDDIR) cpu/$(CPU) lib_$(ARCH) \305 fs/cramfs fs/fat fs/fdos fs/jffs2 \306 net disk rtc dtt drivers drivers/sk98lin common \307 \( -name CVS -prune \) -o \( -name '*.[ch]' -print \)`308 309 etags:310 etags -a -o $(OBJTREE)/etags `find $(SUBDIRS) include \311 lib_generic board/$(BOARDDIR) cpu/$(CPU) lib_$(ARCH) \312 fs/cramfs fs/fat fs/fdos fs/jffs2 \313 net disk rtc dtt drivers drivers/sk98lin common \314 \( -name CVS -prune \) -o \( -name '*.[ch]' -print \)`315 316 $(obj)System.map: $(obj)u-boot317 @$(NM) $< | \318 grep -v '\(compiled\)\|\(\.o$$\)\|\( [aUw] \)\|\(\.\.ng$$\)\|\(LASH[RL]DI\)' | \319 sort > $(obj)System.map320 321 #########################################################################322 else323 all $(obj)u-boot.hex $(obj)u-boot.srec $(obj)u-boot.bin \324 $(obj)u-boot.img $(obj)u-boot.dis $(obj)u-boot \325 $(SUBDIRS) version gdbtools updater env depend \326 dep tags ctags etags $(obj)System.map:327 @echo "System not configured - see README" >&2328 @ exit 1329 endif330 331 .PHONY : CHANGELOG332 CHANGELOG:333 git log --no-merges U-Boot-1_1_5.. | \334 unexpand -a | sed -e 's/\s\s*$$//' > $@335 336 #########################################################################337 338 unconfig:339 @rm -f $(obj)include/config.h $(obj)include/config.mk \340 $(obj)board/*/config.tmp $(obj)board/*/*/config.tmp341 342 #========================================================================343 # PowerPC344 #========================================================================345 346 #########################################################################347 ## MPC5xx Systems348 #########################################################################349 350 canmb_config: unconfig351 @$(MKCONFIG) -a canmb ppc mpc5xxx canmb352 353 cmi_mpc5xx_config: unconfig354 @$(MKCONFIG) $(@:_config=) ppc mpc5xx cmi355 356 PATI_config: unconfig357 @$(MKCONFIG) $(@:_config=) ppc mpc5xx pati mpl358 359 #########################################################################360 ## MPC5xxx Systems361 #########################################################################362 363 aev_config: unconfig364 @$(MKCONFIG) -a aev ppc mpc5xxx tqm5200365 366 BC3450_config: unconfig367 @$(MKCONFIG) -a BC3450 ppc mpc5xxx bc3450368 369 cpci5200_config: unconfig370 @$(MKCONFIG) -a cpci5200 ppc mpc5xxx cpci5200 esd371 372 hmi1001_config: unconfig373 @$(MKCONFIG) hmi1001 ppc mpc5xxx hmi1001374 375 Lite5200_config \376 Lite5200_LOWBOOT_config \377 Lite5200_LOWBOOT08_config \378 icecube_5200_config \379 icecube_5200_LOWBOOT_config \380 icecube_5200_LOWBOOT08_config \381 icecube_5200_DDR_config \382 icecube_5200_DDR_LOWBOOT_config \
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -