接上文,修改gcc 的-std标准后,.depend文件处理仍然出现了错误:

五、错误:make中命令报错(sed找不到需要的文件)

错误告警如下

 make -C examples/api all
make[]: 进入目录“/u-boot-2010.09/u-boot-2010.09/examples/api”
sed -i 's/d:\//\/cygdrive\/d\//g' .depend
sed:无法读取 .depend:No such file or directory
make[]: *** 没有规则可以创建“all”需要的目标“.depend”。 停止。
make[]: 离开目录“/u-boot-2010.09/u-boot-2010.09/examples/api”
Makefile:: recipe for target `examples/api' failed
make: *** [examples/api] Error

1、分析
错误提示比较明显,是 examples/api中,没有.depend规则的产生。

而之前 sed命令,是需要.depend文件存在的。

2、解决思路1:首先会想到if...else来实现

又有两种思路,一种是make自身带的,一种是shell工具。该部分单独讨论,不再本文描述。(大家可以自己尝试)

3、解决思路2:先建立一个空.depend文件

原始代码如下:

 $(obj).depend:    $(src)Makefile $(TOPDIR)/config.mk $(SRCS) $(HOSTSRCS)
@rm -f $@
@for f in $(SRCS); do \
g=`basename $$f | sed -e 's/\(.*\)\.\w/\1.o/'`; \
$(CC) -M $(CPPFLAGS) -MQ $(obj)$$g $$f >> $@ ; \
done
@for f in $(HOSTSRCS); do \
g=`basename $$f | sed -e 's/\(.*\)\.\w/\1.o/'`; \
$(HOSTCC) -M $(HOSTCPPFLAGS) -MQ $(obj)$$g $$f >> $@ ; \
done
sed -i 's/d:\//\/cygdrive\/d\//g' $@

只需要在第2行后,增加 touch $@ 即可

4、解决思路3:利用make的忽视错误规则

make 对其规则中调用的外部程序返回的错误可选的应对。

To ignore errors in a recipe line, write a ‘-’ at the beginning of the line’s text

(after theinitial tab). The ‘-’ is discarded before the line is passed to the shell for execution.

可知,如果将“-”放置到调用命令之前,就可以忽视外部命令的错误。

可以利用: - sed -i 's/d:\//\/cygdrive\/d\//g' $@

来忽视相关错误。

扩展:对于include这个内部命令也可以这样用,但还有一种别名:sinclude (相当于 -include)。

前文 autoconf.mk.dep 格式错误时,涉及到sinclude。其主要是解决引用找不到文件等错误,如果文件内部错误,sinclude也无法避免。

详细信息参见:https://www.gnu.org/software/make/manual/make.html#Errors

5、后记

make错误信息含义:

https://www.gnu.org/software/make/manual/make.html#Error-Messages

之前,make的错误为:multiple target patterns. Stop.

 ‘missing target pattern. Stop.’
‘multiple target patterns. Stop.’
‘target pattern contains no ‘%’. Stop.’
‘mixed implicit and static pattern rules. Stop.’
These are generated for malformed static pattern rules.
The first means there’s no pattern in the target section of the rule;
the second means there are multiple patterns in the target section;
the third means the target doesn’t contain a pattern character (%);
and the fourth means that all three parts of the static pattern rule
contain pattern characters (%)–only the first two parts should.
If you see these errors and you aren’t trying to create a static pattern rule,
check the value of any variables in your target and prerequisite lists
to be sure they do not contain colons.

===【未完待续】===

基于cygwin构建u-boot(三)make错误忽视的更多相关文章

  1. 基于cygwin构建u-boot(一)环境搭建

    从本文开始,更系统的描述基于cygwin构建u-boot. 之前<痛苦的版本对齐>系列,对于cygwin环境下Sourcery CodeBench,u-boot-1.1.6的构建有侧面的说 ...

  2. 基于cygwin构建u-boot(五)结尾:shell 工具

    结尾,基于cygwin对u-boot的处理,很大一部分都是再处理 路径等相关的问题,只有一个涉及到gcc的参数配置. 为了达到顺利编译的目的,使用shell下的部分工具进行处理. 1.sed sed简 ...

  3. 基于cygwin构建u-boot(四)libgcc引用

    接上文,config.mk文件修改后,即使没有.depend也可以正常处理了: 六.错误:gcclib引用错误 完成之前几篇的工作后,程序就可以一直执行了,直到最后生成u-boot, 出现如下错误告警 ...

  4. 基于cygwin构建u-boot(二)gcc的C语言标准版本号(-std=)

    接上文,修改Makefile和config.mk中,.depend相关文件格式后继续编译. 四.tools文件夹的文件编译错误 错误告警如下[多行信息,请使用右侧滚动条查看]: gcc -Wall - ...

  5. 三十二张图告诉你,Jenkins构建Spring Boot 有多简单~

    持续原创输出,点击上方蓝字关注我 目录 前言 如何安装Jenkins? 环境准备 开始安装Jenkins 初始化配置 访问首页 输入管理员密码 安装插件 创建管理员 实例配置 配置完成 构建Sprin ...

  6. 基于Raft构建弹性伸缩的存储系统的一些实践

    基于Raft构建弹性伸缩的存储系统的一些实践 原创 2016-07-18 黄东旭 聊聊架构 最近几年来,越来越多的文章介绍了 Raft 或者 Paxos 这样的分布式一致性算法,但主要集中在算法细节和 ...

  7. Springboot(一):使用Intellij中的Spring Initializr来快速构建Spring Boot工程

    使用Intellij中的Spring Initializr来快速构建Spring Boot工程 New---Project 可以看到图所示的创建功能窗口.其中Initial Service Url指向 ...

  8. DevOps实践之一:基于Docker构建企业Jenkins CI平台

    基于Docker构建企业Jenkins CI平台 一.什么是CI 持续集成(Continuous integration)是一种软件开发实践,每次集成都通过自动化的构建(包括编译,发布,自动化测试)来 ...

  9. 基于C#程序设计语言的三种组合算法

    目录 基于C#程序设计语言的三种组合算法 1. 总体思路 1.1 前言 1.2 算法思路 1.3 算法需要注意的点 2. 三种组合算法 2.1 普通组合算法 2.2 与自身进行组合的组合算法 2.3 ...

随机推荐

  1. Linux下的管道命令有这些:

    Linux下的管道命令有这些: 选取命令:cat grep 排序命令:sort wc uniq 双向重定向:tee 字符转换命令: tr, col, join, paste, expand 切割命令: ...

  2. JAVA_build_ant_Tstamp

    Description Sets the DSTAMP, TSTAMP, and TODAY properties in the current project. By default, the DS ...

  3. android技术下载

    http://www.linuxidc.com/Linux/2011-08/41339.htm http://linux.linuxidc.com/2011%E5%B9%B4%E8%B5%84%E6% ...

  4. Sessions, Window Stations and Desktops(GetDesktopWindow函数得到的桌面句柄, 是Csrss.exe创建的一个窗口)

    由于不是搞安全的,对这块的东西一直不是很清楚,今天特意整理下. 总的来说,他们的关系如下: 我们知道Windows是支持多用户的,Session可以理解为每个用户登录,比如当前登录和远程登陆.Wind ...

  5. VS2010安装与测试编译问题(fatal error LNK1123: failure during conversion to COFF: file invalid or corrupt)

    由于第三方库的各种原因,与编译冲突问题,公司又决定把整个项目都统一改用VS2010来编译.所以我把我开发机上的VS2008卸载了,又重新安装了VS2010.无奈出现了COFF格式转换问题.搜索了下.完 ...

  6. 定时关机命令-shutdown

    定时关机命令-shutdown 一般会用到的定时关机命令有两种: Shutdown -s -t 3600 1小时后自动关机(3600秒) at 12:00 Shutdown -s 12:00自动关闭计 ...

  7. ops

    consists several key projects separately stand-alone connected entities massive scalability massive ...

  8. 在线服装零售商Betabrand获得650万美元风投 - 投资风向 - 创业邦

    在线服装零售商Betabrand获得650万美元风投 - 投资风向 - 创业邦 在线服装零售商Betabrand获得650万美元风投

  9. poj 1286 Necklace of Beads (polya(旋转+翻转)+模板)

      Description Beads of red, blue or green colors are connected together into a circular necklace of ...

  10. wex5添加视频播放

    我使用的播放器是ckplayer http://www.ckplayer.com/ ckplayer存放路,项目路径下: 方法一: 在monitor.w里加一个div标签 <div id=&qu ...