您的位置:首页 > 其它

uboot主Makefile分析2

2016-04-20 14:28 253 查看
《朱老师物联网大讲堂》学习笔记

学习地址:www.zhulaoshi.org

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


这里是关于静默编译的,

那什么是静默编译,

也就是执行脚本的时候,不去回显命令的执行,

编译时侯make -s即可,

这里-s作为MAKEFLAGS传给Makefile,

两种编译管理方法,

默认编译XX.c生成的XX.O会在同一文件夹下,这样做简单,但是会污染源文件,

如果项目涉及不同配置的版本,就无法使用这种方式来管理,

于是就出现了单独输出文件夹的方法,

即指定一个输出目录,

make O=输出目录,

或者

export BUILD DIR=输出目录,

这两种方式同时使用的话,按前一种来理解,

下面是配置代码:

#########################################################################
#
# 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.
#


然后我们去这么做的时候,报错了,

看readme中的介绍,

1. Add O= to the make command line invocations:

make O=/tmp/build distclean
make O=/tmp/build NAME_config
make O=/tmp/build all

不过好像还是没成功,
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息