当前位置:网站首页>1217_使用SCons生成目标文件
1217_使用SCons生成目标文件
2022-04-23 17:28:00 【grey_csdn】
在使用Makefile的时候,生成可执行文件、二进制文件与生成目标文件其实在语法上没有太大的差异,都是要生成target。不同点在于规则的执行有差异,毕竟调用的不同命令甚至是不同的工具。
在SCons中,target这样的理念被换了一种叫法以及形式,感觉上这个工具管理构建过程的时候更加专注于子过程了。而且,即使是官方的手册,看起来也把目标文件的生成独立成了单独的小章节。
这样,根据上面的例子来复现构建一下这个过程。采用的hello.c是之前的测试中用过的,内容也简单,不再列述。
创建配置文件SConstruct,并写上上面的内容。运行scons,效果如下:
这安阳,可以看出运行的效果,跟上面的提示不同的地方在于默认的编译器是不同的。其实,在运行的过程中还生成了一个dblite文件,看名称应该是一个数据库文件。可以列出隐藏文件看到:
关于编译环境的搭建,之前我也考虑过采用数据库来替代掉Makefile的方式,印象中写入过自己的博客笔记。
值得注意的是,这一次的运行结果中并没有可执行文件生成。根据文档,在不同的平台上使用不同的编译器工具可能会有不同的效果,一般用来说明Windows平台的时候使用的编译器都是VS。在我自己接触的工作项目中,VS用得少,更多还是类似POSIX的这种用法。
文档中的两个关键词我涂黄了,这里提到了一个builder的概念,更准确说应该是builder method。这次用以生成object文件的Object就是一个典型的代表,以前用的Program应该也是。算是sSCons中的一个术语吧,我觉得可能是这一套工具体系中的一些元操作,后续我需要掌握积累的也就是类似的元素。
顺便补充一个之前没有总结的小知识点,那就是make clean的对等操作。在SCons中对等的操作是scons -c,具体的效果如下:
这个功能在上面简单的配置中就是已经支持的了,比较方便。可以看得出来,在初始的上手过程中scons相比Makefile来说还是有一些简单简洁的优势的。
增补一条知识:前面的编译的截图中看得到scons在执行编译的时候输出了很多提示信息,如何减少这样的信息输出呢?可以执行scons -Q,-Q的参数可以让输出信息减少。
版权声明
本文为[grey_csdn]所创,转载请带上原文链接,感谢
https://greyzhang.blog.csdn.net/article/details/124359447
边栏推荐
- freeCodeCamp----prob_ Calculator exercise
- Shell-awk命令的使用
- Flash project cross domain interception and DBM database learning [Baotou cultural and creative website development]
- Qt 修改UI没有生效
- Manually implement call, apply and bind functions
- First knowledge of go language
- How to use the input table one-way service to send (occupy less) picture files (body transmission)? FileReader built-in object involved
- Baidu Map Case - modify map style
- XTask与Kotlin Coroutine的使用对比
- Understanding and small examples of unity3d object pool
猜你喜欢
为什么有些人说单片机简单,我学起来这么吃力?
PC电脑使用无线网卡连接上手机热点,为什么不能上网
Clickhouse table engine
Use of todesk remote control software
Bottom processing of stack memory in browser
常用SQL语句总结
C# Task. Delay and thread The difference between sleep
[difference between Oracle and MySQL]
双闭环直流调速系统matlab/simulink仿真
[ES6] promise related (event loop, macro / micro task, promise, await / await)
随机推荐
SiteServer CMS5. 0 Usage Summary
ASP. NET CORE3. 1. Solution to login failure after identity registers users
Baidu Map Case - modify map style
Webapi + form form upload file
Low code development platform sorting
groutine
Router object, route object, declarative navigation, programmed navigation
Indexes and views in MySQL
Basic case of Baidu map
Summary of common websites
Using quartz under. Net core -- preliminary understanding of [2] operations and triggers
Oninput one function to control multiple oninputs (take the contents of this input box as parameters) [very practical, very practical]
Model problems of stock in and stock out and inventory system
Scope and scope chain in JS
How does matlab draw the curve of known formula and how does excel draw the function curve image?
Use of shell cut command
[related to zhengheyuan cutting tools]
.Net Core3. 1 use razorengine NETCORE production entity generator (MVC web version)
Further study of data visualization
Conversion between hexadecimal numbers