Makefile学习笔记之@ - 参数

Makefile命令参数、调用其他Makefile、嵌套 介绍make运行参数和调用其他makefile 阅读详情

作者:LGibsion 
原文:https://blog.youkuaiyun.com/LGibsion/article/details/70854565 

1.显示命令: 


一般默认make会把命令原样显示出来后再去执行命令,如果我们不需要原样显示命令,则可以在命令前面加一个“@”, 如:

echo building target...

make执行时会输出:

echo building target...
building target...

如果在命令前加了”@”,则不会把命令原样输出:

@echo building target...

make执行时实际在终端看到的输出显示是:

building target...

在调试自己写发Makefile时往往想知道自己写的对不对,但又不想执行Makefile中的命令,而是只想看看自己写的这些命令执行的顺序对不对,这是该怎么办呢? 
幸运的是make为我们提供了参数“-n”或者“–just-print”,只要在执行make时在其后面加上该参数即可。如

#:make -n <targetName>

如果嫌执行make后会有大量命令显示刷屏,可以在执行make后面添加参数 
“-s”或“–slient”,这样就不会显示任何命令了。 如:

#:make -s <targetName>


2.忽略出错的命令: 


如果不希望某条命令因为出错了而导致整个make执行被终止,可以在命令前面加上“-”,表示不管该命令出不出错,后面的命令都将继续执行下去。如:

mkdir dir

如果不加“-”并且dir已经存在,则这条命令就会出错,并将导致整个make执行被终止。 
要想不被终止,则要改成:

-mkdir dir

另外,make还有全局的办法: 

a. 给make加上参数“-i”或“–ignore-errors”,那么Makefile中的所欲命令都会被忽略错误。

如:

make -i <targetName>

b.如果一个规则是以“.IGNORE”作为目标的,那么这个规则中所有命令都将会忽略错误。如:

.PHONY:clean clean1 .IGNORE clean2
clean:clean1 .IGNORE  clean2
clean1:
    -rm test $(objs)
.IGNORE:
    rm xxxx
clean2:
    -rm test2 $(objs2)

假设目标 test (objs)test2(objs)test2(objs2)都存在,但是xxxx不存在,那么执行到rm xxxx时就会出错,由于rm xxxx是在.IGNORE规则下的,make会自动终止.IGNORE规则的执行,但会继续执行后面的clean2规则。如:

$ make clean
rm test test.o
rm xxxx
rm: cannot remove ‘xxxx’: No such file or directory
make: [.IGNORE] Error 1 (ignored)
rm test2 test2.o

如果这里的目标不是.IGNORE,那么执行make clean时就会因为rm xxxx出错而终止,后面的clean2规则的命令不会再被执行了。 
:

$ make clean
rm test test.o
rm xxxx
rm: cannot remove ‘xxxx’: No such file or directory
make: *** [clean3] Error 1


c.给make加上参数”-k”或者“–keep-going”,那么如果makefile中某规则中的命令出错了,make会终止改规则的执行,但继续执行接下来的其他规则。如:

make -k <targetName>

【makefile】顶层Makefile向下层Makefile传递参数 阅读详情

相关推荐

【Makefile】make参数

机器感知 一个专注于SLAM、机器视觉、Linux 等相关技术文章分享的公众号 注: 任何在makefile中的目标都可以被指定成终极目标,但是除了以“-”打头,或是包含了“=”的目标,因为有这些字符的目标,会被解析成命令行参数或是变量。 “-B”“--always-make”认为所有的目标都需要更新(重编译)。 “-C <dir>”“--direct...

公众号『机器感知』 3550

MakeFile中的@与$的作用

‘@’ 符号的使用 通常makefile会将其执行的命令行在执行前输出到屏幕上。如果将‘@’添加到命令行前,这个命令将不被make回显出来。 例如:@echo --compiling module----; // 屏幕输出 --compiling module---- echo --compiling module----; // 没有@ 屏幕输出echo --compiling mod...

迪迦 • 奥特曼 1万+

【工程化系列】makefile中“-“符号和“@“符号的使用

DATE: 2020.2.8 1、参考 2、makefile中“-”符号的使用 3、makefile中“@”符号的使用

优快云明星博主,认证博客专家,视频、Matlab领域优质创作者。 1524

Makefile学习笔记<显示/隐藏命令 忽略命令错误>

1.显示命令: 一般默认make会把命令原样显示出来后再去执行命令,如果我们不需要原样显示命令,则可以在命令前面加一个“@”, 如:echo building target... make执行时会输出:echo building target... building target... 如果在命令前加了”@”,则不会把命令原样输出:@echo building target... make执行时实

LGibsion的博客 2万+

Scratch离线版部署指南:解决资源缺失与页面显示异常问题

本文提供了一份详尽的Scratch离线版部署指南,旨在解决网络依赖导致的资源缺失与页面显示异常问题。通过从基础文件获取、自动化资源抓取到生产环境部署的完整流程,帮助教育工作者和开发者在无网络环境下搭建功能完整的本地Scratch编辑器,确保编程教学的顺利进行。

wine的专栏 1264

8卡H20运行DeepSeek-V3-0324性能和推理实测

最近在一台 8卡H20 机器上,先后部署了 DeepSeek-R1-AWQ (671B)和最新的 DeepSeek-V3-0324 (685B) ,测试了下性能和数学问题跑分。服务器由火山引擎提供。

weixin_53138109的博客 3366

Makefile命令中的@和-符号

Makefile命令中的@和-符号

ask_true的博客 1514

Intel Realsense windows安装与入门

realsense400系列介绍: https://www.intelrealsense.com/stereo-depth/?utm_source=intelcom_website&utm_medium=button&utm_campaign=day-to-day&utm_content=D400_learn-more_button realsense 435i介绍: ...

hanshuning的专栏 1万+

makefile中的@ $ :

MKCONFIG := $(SRCTREE)/mkconfig smdk2410_config : unconfig @$(MKCONFIG) $(@:_config=) arm arm920t smdk2410 NULL s3c24x0 @$(MKCONFIG) @表示在执行命令时不输出命令本身(不回显),只输出命令执行的结果 ...

JustDoIt_201603的博客 4542

SAP开发实战:用FI_DOCUMENT_CHANGE BAPI批量修改FB03凭证抬头和行项目文本(附完整ABAP代码)

本文详细介绍了如何使用SAP的FI_DOCUMENT_CHANGE BAPI批量修改FB03凭证抬头和行项目文本,提供完整的ABAP代码实现方案。通过该BAPI,开发者可以高效完成财务凭证的批量修改,确保数据一致性和审计合规性,显著提升SAP财务模块的运维效率。

weixin_29224589的博客 383

2023年金蝶云星辰初级顾问认证参考试题(1)

最新积累的考试真题,答案只供参考(49分T~T),欢迎大佬们更正,私聊我修改,有新的试题也可以私聊我,日后会完善题库!大家一起努力,预祝大家顺利通过!1.【简单】生产环节中,客户老板希望掌握材料的超发或漏发情况,,以便分析用料情况,对材料浪费进行管控,可以查看什么报表?⒉[中等】客户主营电气柜的生产销售,商品为非标品需定制,又因交期效短,需要边生产边补料,以下哪个功能最适合该客户场景?15.【简单】在给商品设置科目关联时,分别按照单个商品,商品类别,所有商品设置了对应客户,()优先级最高。

MLX00的博客 7977

makefile中命令前@

通常,make会把其要执行的命令行在命令执行前输出到屏幕上。当我们用“@”字符在命令 行前,那么,这个命令将不被make显示出来,最具代表性的例子是,我们用这个功能来像 屏幕显示一些信息。如: @echo 正在编译XXX模块...... 当make执行时,会输出“正在编译XXX模块......”字串,但不会输出命令,如果没有“@ ”,那么,make将输出: echo 正在编译XXX模块

yongqingjiao的博客 1万+

Qt Creator设计器里也能拖拽?5步将你的QML自定义控件变成可视化插件(Qt6.5+)

本文详细介绍了如何在Qt Creator设计器中实现QML自定义控件的可视化拖拽功能(Qt6.5+)。通过5个步骤,从构建可插件化的QML控件基础到部署插件到设计器环境,帮助开发者将自定义控件转化为设计器插件,提升团队协作效率。特别适合需要频繁调整UI样式的开发场景。

weixin_29214559的博客 171

Makefile常用参数

一、make编译过程 //预处理,#开头的代码全被解决掉(预编译,包含库,宏定义等等)hello.i上千行. gcc -E hello.c >> hello.i //编译,检查语法错误,生成.s文件,汇编代码,大概26行. gcc -S hello.i //汇编。产生后缀.o的object目标文件,二进制,不可以运行,缺少库信息. gcc -c hello.s 总结:预处理.i => 编译.s => 汇编.o => 链接 二、常见参数 -f :执行make的时候,

他的博客 3393

【AUTOSAR-DEM】-2.1-APP SWC设置UDS/OBD DTC检出和恢复

点击返回「《Autosar_BSW高阶配置》总目录」 案例背景(共6页精讲): DEM模块提供两种不同类型的Event: • BSW-related events:DEM_EVENT_KIND_BSW(通过C-API报告 - Dem_SetEventStatus) • SW-C-related events:DEM_EVENT_KIND_SWC(通过RTE operation - SetEventStatus) 下面我们讲讲在APP SWC中设置BusOff(总线关闭) DTC故障成立/恢复(其它

「汽车电子助手」的博客 3945

Cadence OrCAD Capture 软件自带元件原理图符号库目录与介绍图文视频教程

硬件工程师在开始原理图设计时,应该首先拥有自己的元件原理图符号库。基于Capture进行原理图设计的一个很大的优点就是,软件自带的元件库比较全。本文简单介绍Capture软件自带元件库。

fydar的博客 5579

makefile学习笔记

作用:告诉make,.PHONY:后面跟着的名称不是指文件名,如果makefile中xxxx 写在.PHONY:后面,那么make xxxx 就表示执行xxxx :指定的命令,而不是要(make)生成xxxx;不同于info,waning和error,在Makefile中使用echo打印调试信息时,echo必须在某个目标下面,且在书写echo打印规则时,前面必须使用TAB键,否则会报错。不会执行命令,这个功能很有利于我们调试我们的Makefile,看看我们书写的命令是执行起来是什么样子的或是什么顺序的。

weixin_48067074的博客 1319

深度学习工具包 DeepLearningToolbox

深度学习工具包Deprecation notice.-----This toolbox is outdated and no longer maintained.There are much better tools available for deep learning than this toolbox, e.g. [Theano](http://deeplearning.net/software/theano/), [torch](http://torch.ch/) or [tensorflow](http://www.tensorflow.org/)I would suggest you use one of the tools mentioned above rather than use this toolbox.Best, Rasmus.DeepLearnToolbox================A Matlab toolbox for Deep Learning.Deep Learning is a new subfield of machine learning that focuses on learning deep hierarchical models of data.It is inspired by the human brain's apparent deep (layered, hierarchical) architecture.A good overview of the theory of Deep Learning theory is[Learning Deep Architectures for AI](http://www.iro.umontreal.ca/~bengioy/papers/ftml_book.pdf)For a more informal introduction, see the following videos by Geoffrey Hinton and Andrew Ng.* [The Next Generation of Neural Networks](http://www.youtube.com/watch?v=AyzOUbkUf3M) (Hinton, 2007)* [Recent Developments in Deep Learning](http://www.youtube.com/watch?v=VdIURAu1-aU) (Hinton, 2010)* [Unsupervised Feature Learning and Deep Learning](http://www.youtube.com/watch?v=ZmNOAtZIgIk) (Ng, 2011)If you use this toolbox in your research please cite [Prediction as a candidate for learning deep hierarchical models of data](http://www2.imm.dtu.dk/pubdb/views/publication_details.php?id=6284)```@MASTERSTHESIS\{IMM2012-06284, author = "R. B. Palm", title = "Prediction as a candidate for learning deep hierarchical models of data", year = "2012",}```Contact: rasmusbergpalm at gmail dot comDirectories included in the toolbox-----------------------------------`NN/` - A library for Feedforward Backpropagation Neural Networks`CNN/` - A library for Convolutional Neural Networks`DBN/` - A library for Deep Belief Networks`SAE/` - A library for Stacked Auto-Encoders`CAE/` - A library for Convolutional Auto-Encoders`util/` - Utility functions used by the libraries`data/` - Data used by the examples`tests/` - unit tests to verify toolbox is workingFor references on each library check REFS.mdSetup-----1. Download.2. addpath(genpath('DeepLearnToolbox'));Example: Deep Belief Network---------------------```matlabfunction test_example_DBNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit RBM and visualize its weightsrand('state',0)dbn.sizes = [100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);figure; visualize(dbn.rbm{1}.W'); % Visualize the RBM weights%% ex2 train a 100-100 hidden unit DBN and use its weights to initialize a NNrand('state',0)%train dbndbn.sizes = [100 100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);%unfold dbn to nnnn = dbnunfoldtonn(dbn, 10);nn.activation_function = 'sigm';%train nnopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.10, 'Too big error');```Example: Stacked Auto-Encoders---------------------```matlabfunction test_example_SAEload mnist_uint8;train_x = double(train_x)/255;test_x = double(test_x)/255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit SDAE and use it to initialize a FFNN% Setup and train a stacked denoising autoencoder (SDAE)rand('state',0)sae = saesetup([784 100]);sae.ae{1}.activation_function = 'sigm';sae.ae{1}.learningRate = 1;sae.ae{1}.inputZeroMaskedFraction = 0.5;opts.numepochs = 1;opts.batchsize = 100;sae = saetrain(sae, train_x, opts);visualize(sae.ae{1}.W{1}(:,2:end)')% Use the SDAE to initialize a FFNNnn = nnsetup([784 100 10]);nn.activation_function = 'sigm';nn.learningRate = 1;nn.W{1} = sae.ae{1}.W{1};% Train the FFNNopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.16, 'Too big error');```Example: Convolutional Neural Nets---------------------```matlabfunction test_example_CNNload mnist_uint8;train_x = double(reshape(train_x',28,28,60000))/255;test_x = double(reshape(test_x',28,28,10000))/255;train_y = double(train_y');test_y = double(test_y');%% ex1 Train a 6c-2s-12c-2s Convolutional neural network %will run 1 epoch in about 200 second and get around 11% error. %With 100 epochs you'll get around 1.2% errorrand('state',0)cnn.layers = { struct('type', 'i') %input layer struct('type', 'c', 'outputmaps', 6, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %sub sampling layer struct('type', 'c', 'outputmaps', 12, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %subsampling layer};cnn = cnnsetup(cnn, train_x, train_y);opts.alpha = 1;opts.batchsize = 50;opts.numepochs = 1;cnn = cnntrain(cnn, train_x, train_y, opts);[er, bad] = cnntest(cnn, test_x, test_y);%plot mean squared errorfigure; plot(cnn.rL);assert(er<0.12, 'Too big error');```Example: Neural Networks---------------------```matlabfunction test_example_NNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);% normalize[train_x, mu, sigma] = zscore(train_x);test_x = normalize(test_x, mu, sigma);%% ex1 vanilla neural netrand('state',0)nn = nnsetup([784 100 10]);opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samples[nn, L] = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.08, 'Too big error');%% ex2 neural net with L2 weight decayrand('state',0)nn = nnsetup([784 100 10]);nn.weightPenaltyL2 = 1e-4; % L2 weight decayopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex3 neural net with dropoutrand('state',0)nn = nnsetup([784 100 10]);nn.dropoutFraction = 0.5; % Dropout fraction opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex4 neural net with sigmoid activation functionrand('state',0)nn = nnsetup([784 100 10]);nn.activation_function = 'sigm'; % Sigmoid activation functionnn.learningRate = 1; % Sigm require a lower learning rateopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex5 plotting functionalityrand('state',0)nn = nnsetup([784 20 10]);opts.numepochs = 5; % Number of full sweeps through datann.output = 'softmax'; % use softmax outputopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex6 neural net with sigmoid activation and plotting of validation and training error% split training data into training and validation datavx = train_x(1:10000,:);tx = train_x(10001:end,:);vy = train_y(1:10000,:);ty = train_y(10001:end,:);rand('state',0)nn = nnsetup([784 20 10]); nn.output = 'softmax'; % use softmax outputopts.numepochs = 5; % Number of full sweeps through dataopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, tx, ty, opts, vx, vy); % nntrain takes validation set as last two arguments (optionally)[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');```[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/rasmusbergpalm/deeplearntoolbox/trend.png)](https://bitdeli.com/free "Bitdeli Badge")

makefile中命令前加一个@。。

通常,make会把其要执行的命令行在命令执行前输出到屏幕上。当我们用“@”字符在命令 行前,那么,这个命令将不被make显示出来,最具代表性的例子是,我们用这个功能来像 屏幕显示一些信息。如: @echo 正在编译XXX模块...... 当make执行时,会输出“正在编译XXX模块......”字串,但不会输出命令,如果没有“@ ”,那么,make将输出: echo 正在编译XXX模块......

xuan_h的专栏 3149

假人有限元模型

假人模型,车辆碰撞假人有限元模型,适合做乘员安全的研究者利用

WINCC7.3破解文件

WINCC7.3硬件够破解文件,有需要的下载!WINCC7.3硬件够破解文件,有需要的下载!

MakeFile-几个符号说明-$-@---

编译代码时,会进程接触makefile,会涉及到一些符号,由于不明白有些意思经常出现问题,在此归纳一下。 '@'符号的使用 通常makefile会将其执行的命令行在执行前输出到屏幕上。如果将‘@’添加到命令行前,这个命令将不被make回显出来。 例如:@echo--compiling module----; // 屏幕输出--compiling ...

酸豆角的博客 1133

Makefile中的@

Makefile中的@ 通常,make会把其要执行的命令行在命令执行前输出到屏幕上。当我们用“@”字符在命令行前,那么,这个命令将不被make显示出来,最具代表性的例子是,我们用这个功能来像屏幕显示一些信息。如:      @echo 正在编译XXX模块......  当make执行时,会输出“正在编译XXX模块......”字串,但不会输出命令,如果没有“@”,那么,m

txk15619567977的专栏 933

Makefile学习笔记

命令export?.PHONY:=总结提示:这里对文章进行总结:例如:以上就是今天要讲的内容,本文仅仅简单介绍了pandas的使用,而pandas提供了大量能使我们快速便捷地处理数据的函数和方法。

weixin_44290938的博客 861

makefile中的shell语法 || Makefile中的@

在Makefile中写shell代码有点诡异,和不同的shell语法不太一样,如果不了解,看Makefile会莫名其妙。下面总结了一些。

IT的乐章 1496

makefile中命令前加一个@

makefile中命令前加一个@。。 makefile中命令前加一个@。。 好像是不显示错误的信息,不加也是可以的 以上理解有误。。下面是正确的。 通常,make会把其要执行的命令行在命令执行前输出到屏幕上。当我们用“@”字符在命令 行前,那么,这个命令将不被make显示出来,最具代表性的例子是,我们用这个功能来像 屏幕显示一些信息。如: @echo 正在编译XXX模

剪烛西窗 2240

[工具使用:Makefile] Makefile学习笔记

如果执行总控 Makefile 时,make 命令带有参数或者在上层的 Makefile 中定义了这个变量,那么 MAKEFLAGS 变量的值将会是 make 命令传递的参数,并且会传递到下层的 Makefile 中,这是一个系统级别的环境变量。它会继续载入其它的文件,一旦完成makefile的读取,make会再重试这些没有找到,或是不能读取的文件,如果还是不行,make才会出现一条致命信息。当使用 make 的选项 “-C” 的时候,命令就会进入指定的目录中,然后此变量就会被重新赋值。

stm32stu的博客 3275

Makefile 之 make参数

Makefile 之 make参数

xiaozhi 1288
上一篇: Linux内核线程kernel thread详解--Linux进程的管理与调度(十)
下一篇: SumatraPDF开启多窗口
Estrellas_
博客等级 码龄9年 273粉丝 233原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

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

抵扣说明:

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

余额充值