Makefile的使用

使用makefile构建golang项目 前言 在golang的开发学习过程中,能经常需要执行go test 测试、go build编译、go install安装操作,简单的项目构建起来很方便。但遇到较复杂的项目,比如要跨平台交叉编译,选择性单元测试,性能测试,命令就要附加很多参数,敲起来麻烦,还容易忘记,时常要查看help。为了解决这个问题,我们可以编写shell,将常用操作封装在脚本中,虽然实现简单,但每个人编写、阅读能力不一,不利... 阅读详情

Makefile的使用

自动化编译脚本,这个东西就是,进行简单的设置,然后实现原码编成为相应程序,简单化自己进行相关操作的过程。不需要一个个自己进行全部进行输入。而且还有许多的简化书写方法。

​

这个Makefile的本质为一种脚本语言。

依赖文件

这个东西的本质就是使用蔬菜🥬做出来好吃的美食,而程序也是依赖源文件,才做出来的东西

img

使用make进程脚本的制造的时候,执行a,就一定会执行b。即使b的内容没有更新但是 a的内容更新了

变量

这里可以使用一些常用的符号代替相关的依赖文件(少书一些东西),书写简单一些。

=

可以使用这一个变量自己进行赋值,然后后面都用这个来替代

OBJ = main.o add.cpp
#进行赋值
$(OBJ) # 进行解析使用

g++

这个可以使用CXX进行替代,这个是系统之前默认设置过的相关的东西,不需要进行定义。

$^

对于依赖文件进行代替

main:main.cpp add.cpp mut.o
	g++ $^ 
	#这里的$^代替的上面的mian.cpp,add.cpp,mut.o文件。

$@

对于目标文件的替代

main:main.cpp add.cpp mut.o
	g++ $^  -o $@
	#这里就替代了main

系统常量

IMG_3493C2886F64-1

这些东西都可以进行替代,减轻相应的负担
变量使用的时候需要进行$()进行包含使用,里面存放相应的东西

伪目标

使用这个东西之后会直接进行更新,不用判是否为最新文件。

.PHONY:clean
#这样之后执行清除命令,就不需要填写make,直接使用clean解决问题。

c++11联合编译

对于c++11进行编译需要在上面添加-std=c++11

image-20230302200927706

MakeFile的使用 文章目录MakeFile的使用一、Linux环境下的编译流程二、静态库与动态库2.1 简述2.2 静态库2.3 动态库2.4 优缺点三、MakeFile的制作第1个版本第2个版本第3个版本第4个版本第5个版本静态库的MakeFile动态库的MakeFileover MakeFile的使用 一、Linux环境下的编译流程 主要是用于Linux环境下的C/C++编译 用过Windows环境下的Visual Stduio的朋友应该知道,我们在Windows环境下进行编译时,就是点击一下按钮的事情,非常方便,如果在 阅读详情

相关推荐

新手必看!无人机定高PID调参避坑指南:从理论到实战的完整流程

本文为无人机新手提供定高PID调参的完整指南,从传感器融合到抗风策略,详细解析多传感器融合、PID控制参数调试及环境干扰应对。通过实战案例和代码示例,帮助开发者快速掌握无人机定高技术,避免常见调参陷阱,提升飞行稳定性。

spark7igniter的博客 221

Linux下Makefile的使用

本文介绍了最简单的Makefile创建方法及其使用 介绍了文件组织形式、make的工作流程、Makefile的手动编写、Makefile的变量使用、用户自定义变量、预定义变量、自动变量、Makefile的包含和嵌套、Makefile的自动生成、Autotools工具、configure文件的生成以及介绍了用脚本辅助编译

@吹灭小山河的博客 5855

打造会自主学习的 AI 助手:OpenClaw 记忆系统完全指南

这不是科幻,这是我正在使用的系统。我的 AI 助手「小琳」已经运行了一段时间,积累了大量的知识和经验,而且还在不断学习成长。心跳(Heartbeat)是 OpenClaw 的定时轮询机制,可以让 AI 主动做一些事情。你有没有遇到过这样的困扰:每次和 AI 对话,它都像失忆了一样,之前聊过的内容完全不记得?设置定时任务:每天早上 8 点,查询天气和热点新闻,通过钉钉推送给我。让你的 AI 助手拥有持久记忆,能够自主学习、总结经验、不断成长。这不仅仅是一个「能记住事情的 AI」,而是一个。

Honmaple的博客 1633

makefile if 使用

https://blog.youkuaiyun.com/liuzhuchen/article/details/51776820 1、在目标外使用if #这个ifeq else endif,在target 外部,关键字前边一定要有tab ifeq ("aaa","bbb") #内容前可以有空格,如果是tab时,解析为命令 #变量前可以多个空格 LIBS= -laaa else #+ech...

晴树的专栏 1万+

别再纠结Dify了!实测对比RAGFlow和Dify,聊聊企业知识库到底该怎么选

本文深度对比了RAGFlow和Dify在企业知识库选型中的实际表现,从技术架构、性能指标、部署成本等多维度进行分析。RAGFlow在复杂文档处理和准确率方面表现突出,适合有专职技术团队的企业;而Dify则以低门槛和快速部署见长。文章提供了六维度评估法,帮助企业根据文档复杂度、准确率要求等技术指标做出明智选择。

weixin_30897233的博客 669

content-pipeline:一条可落地的内容生产流水线

content-pipeline 是一种将内容创作工程化的系统性方法,其核心在于用确定性流程替代碎片化人工操作。它基于结构化提示(prompt)、预置叙事框架与品牌参数固化三大原理,实现从素材输入到多平台发布的端到端自动化。技术价值体现在显著降低认知负荷、保障输出一致性、支持本地化资源绑定与闭环反馈校验。典型应用场景包括技术教程批量生成、跨平台(公众号/小红书/即刻)内容适配、AI写作质量可控迭代等。本文深入解析其作为‘内容制造业’基础设施的底层设计逻辑与实操路径,尤其聚焦Claude Code环境下的真实

weixin_31199559的博客 269

Makefile 保姆级使用教程

Makefile 使用教程 设计思想 Makefile 菜鸟教程Makefile 规则 Makefile的使用介绍 make 命令的使用 即时变量、延时变量介绍和使用使用make命令编译多个文件假想目标 常用函数 1.$(foreach var,list,text) 2.$(wildcard pattern) 3.$(filter pattern...,text) 4.$(filter-out pattern...,text) 5.$(patsubstpattern,replacement,text)

wei_Embedded_z的博客 8565

【如何学习CAN总线测试】——AUTOSAR网络管理自动化测试(CAPL源码)

上一章介绍的是AUTOSAR网络管理如何测试、用例设计,对于不满足手工测试的同学,本章就介绍AUTOSAR网络管理自动化测试。

测试领域技术分享 6237

Makefile中使用变量

目录一、变量的基础二、变量中的变量三、变量高级用法四、追加变量值五、 override 指示符六、多行变量七、环境变量八、目标变量 在 Makefile 中的定义的变量,就像是 C/C++语言中的宏一样,他代表了一个文本字符串,在 Makefile 中执行的时候其会自动原模原样地展开在所使用的地方。其与 C/C++所不同的是,你可以在 Makefile 中改变其值。在 Makefile 中,变量可以使用在“目标”,“依赖目标”,“命令”或是 Makefile 的其它部分中。变量的命名字可以包含字符、数字,下

big_C的博客 7102

【git】git: ‘interpret-trailers’ is not a git command. See ‘git --help’

cents 7.6系统. yum源安装git最新版本是1.8.3 报错: git: 'interpret-trailers' is not a git command. See 'git --help'. cannot insert change-id line in .git/COMMIT_EDITMSG 解决: git add xxx git commit -m "xxx" 然后修改 vim .git/hooks/commit-msg #if test -n "${reviewurl}" ; th

machh的专栏 4758

数据架构师必看:大数据时代的架构演进与实践

数据架构是企业数据资产的“骨架”——它决定了数据能多快被处理、多准被分析、多安全被存储。本文将聚焦从传统架构到大数据架构的关键转折点,覆盖技术选型、典型场景、落地挑战三大核心命题,帮助读者建立“演进思维”而非“固定思维”。本文将按“历史演进→核心概念→技术原理→实战案例→趋势展望”的逻辑展开,用“超市仓库升级”贯穿始终,让抽象的技术概念具象化。传统数据仓库:精但小,适合结构化、批量分析。大数据架构:大但乱,适合全类型、海量数据存储。流批一体:解决实时+批量的效率问题。湖仓一体。

AI Agent Harness Engineering 913

Makefile详解及使用

Makefile简介 linux环境下,当用户编译文件过多的时候,使用makefile可以帮助模块化编译文件,makefile是一个脚本文件,根据规则,来执行相应的脚本文件,实现自动化编译。

梅山 1万+

【FPGA教程案例96】控制案例1——基于FPGA的自适应PID控制器verilog实现

首先,我们复习下课程传统的PID控制器,往往存在调整速度较慢,超调过大等缺点。为了解决这个问题,在实际的PID应用中,需要实时的调整PID的控制参数,以达到加快PID控制速度,降低超调等目标。目前,自适应PID控制器,一般有误差反馈调整,模糊控制器调整,神经网络调整。其中模糊控制器调整,神经网络调整较为复杂,在入门案例中不做介绍,在本课程中,我们将实现相对略微简单点的基于误差反馈调整的自适应PID控制器。

FPGA/MATLAB学习教程/源码/项目合作开发 6203

Makefile的安装与使用

所需软件在 Linux 系统中使用 Makefile,需要安装 make 工具,此外,根据你的项目类型,可能还需要安装相应的编译器,例如 C/C++ 项目需要安装 gcc 和 g++。安装方法Debian 或 Ubuntu 系统执行上述命令后,系统会自动下载并安装所需的软件包。CentOS 或 Fedora 系统安装完成后,同样可以使用 make --version 命令来验证 make 是否安装成功。

2401_87145357的博客 3114

汉书HE8,好用的汇编代码编写工具

汉书HE8,好用的汇编代码编写工具早期编写汇编代码所用功能强大

visio安装包

Microsoft Office Visio 是一款专业的制图软件。利用经过更新的形状、协作工具和数据链接图表,创建专业级图表以简化复杂的信息。

【Makefile】Makefile的使用

Makefile的使用

weixin_50964793的博客 2860

深度学习工具包 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简明使用教程

这里我的理解是每一个.c文件都会生成一行对应的处理,正如上面完整的makefile文件中注释掉的那一部分,对于每一行来说第一个依赖文件和所有的依赖文件来说是一样的都是对应的那个.c文件。make有一种机制,会根据目标文件的修改和依赖文件的修改时间来判定要不要重新构建,按照上面的写法,某一个源文件稍作改动,所有文件都会重新编译。比较直观的写法,hello 为要构建的目标,main.c和message.c文件为依赖文件,下一行为生成目标要执行的命令。文件,可以通过-f参数来指定要使用的makefile文件。

ApexYuan 1074

NTscan扫描工具

ntscan是一个扫描器,可以扫描没有密码和弱密码的共享,先到配置文件中填写猜测的用户名和密码,扫描过程中右侧出现的是扫描日志。

【Makefile】Makefile规则和使用

Makefile的规则和使用

Thenunaoer的博客 1151

使用Makefile管理项目

Makefile 是一种用于自动化编译和构建程序的文件,它包含了一系列的规则(rules),这些规则指定了如何编译和链接程序中的源文件以生成可执行文件或其他非源代码文件。Makefile 使得编译过程更加高效和可重复,尤其是在处理包含多个源文件和复杂依赖关系的项目时。注释:以开头的行为注释。变量:Makefile 中可以定义变量来存储文件名、编译器选项等,以便在多处重复使用。规则(Rules):Makefile 中的核心部分,每个规则定义了如何生成一个或多个目标文件(通常是可执行文件或对象文件)。

dcq715的博客 1162

Makefile使用

当执行 make main 时,如果 main.o 或 function.o 源代码比目标文件新,或者目标文件不存在,那么会先编译这些源代码文件,然后再链接生成 main 可执行文件;Makefile的一般结构包括变量定义、规则(rule)和命令。Makefile由一系列规则和命令组成,用于描述项目中各个源文件之间的依赖关系,并指示如何从源代码生成目标文件(如可执行程序或库文件)若main的依赖文件main.o function.o比较新或者不存在时,会向下寻找对应的目标执行命令。

weixin_44491256的博客 389

Makefile中变量的使用

(1)在Makefile中,使用变量只是简单的将其内容进行替换,变量的使用格式见下例:Objects=a.o b.o c.oProgram:$(Objects)             gcc $(Objects) -o Program(2)变量也可以使用在其后定义的变量,见下例:Obj1=$(Obj2)Obj2=

sdn_bupt的专栏 326
上一篇: 进程控制
下一篇: TCP网络连接的书写
assibe
博客等级 码龄5年 1640粉丝 84原创
评论 4
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

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

抵扣说明:

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

余额充值