U-Boot-2013.07/Makefile

#
# (C) Copyright 2000-2012
# Wolfgang Denk, DENX Software Engineering, wd@denx.de.
#
# See file CREDITS for list of people who contributed to this
# project.
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License as
# published by the Free Software Foundatio; either version 2 of
# the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
# MA 02111-1307 USA
#


VERSION = 2013
PATCHLEVEL = 07
SUBLEVEL =
EXTRAVERSION =
ifneq "$(SUBLEVEL)" ""
U_BOOT_VERSION = $(VERSION).$(PATCHLEVEL).$(SUBLEVEL)$(EXTRAVERSION)
else
U_BOOT_VERSION = $(VERSION).$(PATCHLEVEL)$(EXTRAVERSION)
endif
TIMESTAMP_FILE = $(obj)include/generated/timestamp_autogenerated.h
VERSION_FILE = $(obj)include/generated/version_autogenerated.h


HOSTARCH := $(shell uname -m | \
sed -e s/i.86/x86/ \
   -e s/sun4u/sparc64/ \
   -e s/arm.*/arm/ \
   -e s/sa110/arm/ \
   -e s/ppc64/powerpc/ \
   -e s/ppc/powerpc/ \
   -e s/macppc/powerpc/\
   -e s/sh.*/sh/)

HOSTOS := $(shell uname -s | tr '[:upper:]' '[:lower:]' | \
        sed -e 's/\(cygwin\).*/cygwin/')

export  HOSTARCH HOSTOS   

使用$(error $(HOSTARCH))得x86_64
使用$(error $(HOSTOS))得linux
sed执行机器名字的替换,在64bits电脑上HOSTARCH是x86_64或者是amd64
tr ‘[:upper:]’ ‘[:lower:]’将大写字母转成小写字母,比如Linux转成linux

# Deal with colliding definitions from tcsh etc.
VENDOR=

#########################################################################
# Allow for silent builds
ifeq (,$(findstring s,$(MAKEFLAGS)))
XECHO = echo
else
XECHO = :
endif

findstring用于查找子字符串,若查不到返回空
MAKEFLAGS是make的命令行参数(通过make –help得到),比如make -s此时MAKEFLAGS值为s
make -t此时MAKEFLAGS值为t,make -s -k此时MAKEFLAGS值为sk,make -j 4此时MAKEFLAGS值为空。
这儿是检查是否执行make -s,-s的目的是不会打印编译过程中产生的信息,比如gcc -Wall -Wstrict-prototypes类似的信息, -s兴许可以减少编译过程中的不安。

#########################################################################
#
# U-boot build supports producing a object files to the separate external
# directory. Two use cases are supported:
#
# 1) Add O= to the make command line
# 'make O=/tmp/build all'
#
# 2) Set environement variable BUILD_DIR to point to the desired location
# 'export BUILD_DIR=/tmp/build'
# 'make'
#
# The second approach can also be used with a MAKEALL script
# 'export BUILD_DIR=/tmp/build'
# './MAKEALL'
#
# Command line 'O=' setting overrides BUILD_DIR environent variable.
#
# When none of the above methods is used the local build is performed and
# the object files are placed in the source directory.
#

ifdef O
ifeq ("$(origin O)", "command line")
BUILD_DIR := $(O)
endif
endif

若make O=/tmp/build-uboot使用$(error “$(origin O)”)可得”command line”,这里是大写字母O并不是数字0。
提供将编译成生成的文件放置到指定的目录里面,比如/tmp/build-uboot,这么做比较清爽。

# Call a source code checker (by default, "sparse") as part of the
# C compilation.
#
# Use 'make C=1' to enable checking of re-compiled files.
#
# See the linux kernel file "Documentation/sparse.txt" for more details,
# including where to get the "sparse" utility.

ifdef C
ifeq ("$(origin C)", "command line")
CHECKSRC := $(C)
endif
endif
ifndef CHECKSRC
  CHECKSRC = 0
endif
export CHECKSRC

检查代码,属于用户自定义配置的解析,make C=1和make -s是不同的概念,后者是make自己可以解析的,前者需要在Makefile中使用上述代码进行解析,最终导出一个全局变量

ifneq ($(BUILD_DIR),)
saved-output := $(BUILD_DIR)

# Attempt to create a output directory.
$(shell [ -d ${BUILD_DIR} ] || mkdir -p ${BUILD_DIR})

# Verify if it was successful.
BUILD_DIR := $(shell cd $(BUILD_DIR) && /bin/pwd)
$(if $(BUILD_DIR),,$(error output directory "$(saved-output)" does not exist))
endif # ifneq ($(BUILD_DIR),)

前面并对变量BUILD_DIR进行过设置,它从无中来本是空。这段ifneq语句并没有执行。

OBJTREE     := $(if $(BUILD_DIR),$(BUILD_DIR),$(CURDIR))
SPLTREE     := $(OBJTREE)/spl
SRCTREE     := $(CURDIR)
TOPDIR      := $(SRCTREE)
LNDIR       := $(OBJTREE)
export  TOPDIR SRCTREE OBJTREE SPLTREE

MKCONFIG    := $(SRCTREE)/mkconfig
export MKCONFIG

CURDIR是Makefile的内嵌变量,表示当前目录。

MKCONFIG    := $(SRCTREE)/mkconfig
export MKCONFIG
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
configuration written to .config # make[2]: Leaving directory '/home/lkuser/SDK/Hi3519DV500_SDK_V2.0.0.2/mini_sdk/boot/u-boot/u-boot-2022.07' pushd /home/lkuser/SDK/Hi3519DV500_SDK_V2.0.0.2/mini_sdk/boot/u-boot/u-boot-2022.07;make LLVM= CROSS_COMPILE=aarch64-v01c01-linux-gnu- 1>/dev/null;popd ~/SDK/Hi3519DV500_SDK_V2.0.0.2/mini_sdk/boot/u-boot/u-boot-2022.07 ~/SDK/Hi3519DV500_SDK_V2.0.0.2/mini_sdk/boot/u-boot ===================== WARNING ====================== This board does not use CONFIG_DM_ETH (Driver Model for Ethernet drivers). Please update the board to use CONFIG_DM_ETH before the v2020.07 release. Failure to update by the deadline may result in board removal. See doc/develop/driver-model/migration.rst for more info. ==================================================== ===================== WARNING ====================== This board does not use CONFIG_TIMER (Driver Model for Timer drivers). Please update the board to use CONFIG_TIMER before the v2023.01 release. Failure to update by the deadline may result in board removal. See doc/develop/driver-model/migration.rst for more info. ==================================================== ===================== WARNING ====================== This board does not use CONFIG_DM_SERIAL (Driver Model for Serial drivers). Please update the board to use CONFIG_DM_SERIAL before the v2023.04 release. Failure to update by the deadline may result in board removal. See doc/develop/driver-model/migration.rst for more info. ==================================================== ~/SDK/Hi3519DV500_SDK_V2.0.0.2/mini_sdk/boot/u-boot echo "gzip" gzip make -C /home/lkuser/SDK/Hi3519DV500_SDK_V2.0.0.2/mini_sdk/boot/u-boot/../gzip/ make[2]: Entering directory '/home/lkuser/SDK/Hi3519DV500_SDK_V2.0.0.2/mini_sdk/boot/u-boot' make[2]: *** /home/lkuser/SDK/Hi3519DV500_SDK_V2.0.0.2/mini_sdk/boot/u-boot/../gzip/: No such file or directory. Stop. make[2]: Leaving directory '/home/lkuser/SDK/Hi3519DV500_SDK_V2.0.0.2/mini_sdk/boot/u-boot' make[1]: *** [Makefile:51: all] Error 2 make[1]: Leaving directory '/home/lkuser/SDK/Hi3519DV500_SDK_V2.0.0.2/mini_sdk/boot/u-boot' make: *** [Makefile:287: boot] Error 2什么意思
06-09

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值