接上文,修改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. NET SignalR 与 LayIM2.0

    ASP.NET SignalR 与 LayIM2.0 配合轻松实现Web聊天室(五) 之 加好友,加群流程,消息管理和即时消息提示的实现   前言 前前一篇留了个小问题,在上一篇中忘了写了,就是关于L ...

  2. JAVA_build_ant_mapper

    ant里面mapper的详细用法   ant里面mapper标签是和fileset配合使用的,目的就是把fileset取出的文件名转成指定的样式.其实看懂官方文档后,感觉真心没啥好写的.但是还是写一下 ...

  3. m2eclipse插件安装

    一.给Eclipse安装maven的插件 m2eclipse 1 打开eclipse 2 Help -->Eclipse MarketPlace,在打开的界面搜索框中输入maven查找m2ecl ...

  4. Qt创建和使用动态链接库

    一.创建共享库 1.新其他建项目,选择C++库 2.选择共享库,并取项目名称,单击下一步.这里取名位mylib 3.按默认配置单击下一步至模块选项,选择所需支持的模块.这里勾选Qtcore和QtGui ...

  5. using 1.7 requires using android build tools version 19 or later

    这意思大概是adt用了1.7,abt(android build tools)就要用19或更高,可是abt在哪设置呢,原来是在sdk manager中 之前我已安装的最高的abt是17,然后~~~,F ...

  6. cf437D The Child and Zoo

    D. The Child and Zoo time limit per test 2 seconds memory limit per test 256 megabytes input standar ...

  7. Android 读取手机某个文件夹目录及子文件夹中所有的txt文件

    1. activity_main.xml文件 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/andro ...

  8. Hybrid App开发模式中, IOS/Android 和 JavaScript相互调用方式

    IOS:Objective-C 和 JavaScript 的相互调用 iOS7以前,iOS SDK 并没有原生提供 js 调用 native 代码的 API.但是 UIWebView 的一个 dele ...

  9. android widget 开发实例 : 桌面便签程序的实现具体解释和源代码 (上)

    如有错漏请不吝拍砖指正,转载请注明出处,很感谢 桌面便签软件是android上经常使用软件的一种,比方比較早的Sticky Note,就曾很流行, Sticky Note的介绍能够參见 http:// ...

  10. UIView的setNeedsLayout, layoutIfNeeded 和 layoutSubviews 方法之间的关系解释

    转自:http://blog.csdn.net/meegomeego/article/details/39890385 layoutSubviews总结 ios layout机制相关方法 - (CGS ...