当前位置:网站首页>1217_ Generating target files using scons

1217_ Generating target files using scons

2022-04-23 17:36:00 grey_ csdn

All learning summary : GitHub - GreyZhang/g_SCons: A new member in my toolbox, looking forward to replacing make tool later.

In the use of Makefile When , Generate executable files 、 In fact, there is not much difference in syntax between binary file and generated object file , All to be generated target. The difference is that the execution of rules is different , After all, different commands and even different tools are called .

stay SCons in ,target Such a form of idea has been changed , It seems that this tool is more focused on sub processes when managing the construction process . and , Even the official manual , It seems that the generation of the target file is also separated into a separate small chapter .

such , Repeat this process according to the above example . Adopted hello.c It's used in previous tests , The content is also simple , Don't list .

create profile SConstruct, And write it down . function scons, The effect is as follows :

This is Anyang , You can see the effect of running , The difference from the above tips is that the default compiler is different . Actually , In the process of running, a dblite file , Look, the name should be a database file . You can list hidden files and see :

On the construction of compilation environment , I also considered using database to replace Makefile The way , I wrote my blog notes in my impression .

It is worth noting that , There is no executable file generated in this run . According to the document , Using different compiler tools on different platforms may have different effects , Generally used to illustrate Windows The compilers used in the platform are VS. In my own work projects ,VS Use less , More or similar POSIX This usage of .

I painted two key words in the document yellow , There is a reference to builder The concept of , More accurately, it should be builder method. This time to generate object Of documents Object Is a typical representative , Used to Program It should be . Count as sSCons A term in , I think it may be some meta operations in this tool system , Later, I need to master the accumulation of similar elements .

By the way, I would like to add a little knowledge that I haven't summarized before , That's it make clean Peer to peer operations . stay SCons The equivalent operation in is scons -c, The specific effects are as follows :

This function is already supported in the above simple configuration , It's more convenient . You can see that , In the initial starting process scons comparison Makefile There are still some advantages of simplicity .

Add a piece of knowledge : You can see from the screenshot of the previous compilation scons When compiling, a lot of prompt information is output , How to reduce such information output ? It can be executed scons -Q,-Q The parameters of can reduce the output information .

版权声明
本文为[grey_ csdn]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204231728376121.html