当前位置:网站首页>General introduction to gun make (2)
General introduction to gun make (2)
2022-06-26 01:55:00 【Chen_ Hulk】
1.makefile File naming
By default ,make Will search in the working directory according to the file order makefile Document and execute :
GUNmakefile,makefile,Makefile
If make The program cannot find any of the three files in the working directory , It will not read any other files as parsing objects .
here , Need to pass through -f NAME / --file=NAME Option to specify make Read the makefile file .
notes :
When the directory does not exist GUNmakefile,makefile,Makefile Command ,
When a source file exists in the directory getaddinfo.c when , We can use make getaddrinfo.o To use make The implicit rules of are automatically generated getaddrinfo.o:
2. Include others makefile file
If in a makefile The file needs to contain another makefile file , Keyword required include.
include The indicator tells make Pause reading current makefile, And turn to read include One or more files specified , Continue with the current... After completion makefile Read .
Format :
include FILENAME...
include Between and file name 、 Use spaces or... Between multiple files [tab] Key separation .
If include The indicated file is not an absolute address , And this file does not exist in the current directory ,make An attempt will be made to find... In the following directory based on the file name :
- First , Use command line options -I perhaps --include-dir Specified directory , If the specified file is found , Then use this file ; Otherwise, continue to search the following directories in turn ( If there is ): /user/gun/include 、 /user/local/include 、 /use/include
- secondly , When these directories are not found include Specified file time ,make You will be prompted with a warning that the containing file is not found , But not immediately , But continue to deal with makefile Follow up content .
- Last , When finished reading the entire makefile after ,make Trying to use rules to create pass indicators include Specified but not found file , When it cannot be created ,make A fatal error will be prompted and exit .( have access to -include Instead of include To ignore the error prompt because the file does not exist or cannot be created .)
3. makefile Enforcement rules
The first stage :
- Read variables in turn MAKEFILES Defined makefile File list .
- Read... In the working directory makefile file , Query sequentially GUNmakefile, makefile, Makefile.
- Read the working directory in turn makefile Use the indicator in the file include Included files .
- Find and rebuild all read makefile The rules of the document .
- Initialize variable values and expand variables and functions that need to be expanded immediately , And determine the execution branch according to the preset conditions .
- according to The ultimate goal And other target dependencies Dependency linked list .
The second stage :
- Carry out division The ultimate goal Rules for all goals other than .
- perform The rule of the ultimate goal .
4. Immediate and delayed deployment
- stay make In the first stage of execution, if the variables and functions are expanded , This expansion is called immediate expansion . Non immediate expansion , Until subsequent rules need to be used or make They only unfold in the second stage of processing , Become a postponement .
- When a variable uses the append symbol += when , If the previous variable is a simple variable , Use := Definition , It is considered to be immediately unfolded , Other situations are called Postpone the start of .
- Where conditional statements are used ,ifdef, ifeq, ifdef, ifneq,make The program will expand the correct branch according to the preset conditions , This deployment is immediate .
- Targets and dependencies refer to other variables , Is immediately expanded . The variable reference in the rule command will be expanded later .
边栏推荐
- PTA class a simulated first bomb: 1132-1135
- 浅谈接口测试(一)
- On the difference between strlen and sizeof
- 17.11 std:: atomic continuation, std:: async in-depth discussion
- Redis7.0的安装步骤
- 通俗易懂C语言关键字static
- Tengwenze, a hot-blooded boy, was invited to serve as the image ambassador of the global finals of the sixth season perfect children's model
- PTA class a simulated fifth bomb: 1148-1151
- 王老吉药业“关爱烈日下最可爱的人”公益活动在杭启动
- Loss function of depth model
猜你喜欢
GNN (graph neural network) introduction vernacular
recv & send
Dataframe to list
Interpretation of script corresponding to postman assertion
二造实务案例答题技巧和举例汇总,满满都是精髓
Disruptor(一)Sequence
Sweet cool girl jinshuyi was invited to be the spokesperson for the global finals of the sixth season perfect children's model
The 19th - 22nd week of scientific research training - about tnet and memnet
Principle of voice wake-up
Postman断言对应脚本的解释
随机推荐
pixel 6 root
Perfdog
秀场精灵陈梓桐 受邀担任第六季完美童模全球总决赛首席体验官
Postman断言对应脚本的解释
Eight principles of element positioning
readv & writev
JQ获取对象的几种方式
Pointnet/Pointnet++学习
PTA class a simulated ninth bullet: 1114-1117
Wanglaoji pharmaceutical's public welfare activity of "caring for the most lovely people under the scorching sun" was launched in Hangzhou
大周建议自媒体博主前期做这4件事
cyclegan:unpaired image-to-image translation using cycle-consistent adversarial network
Find the multiplication order of n
GUN make (7) 执行make
通俗易懂C语言关键字static
Explication du script correspondant à l'assertion Postman
Differences and functions of export set env in makefile
俏皮少女王艺璇 受邀担任第六季完美童模全球总决赛推广大使
Abnova丨抗GBA单克隆抗体解决方案
Cross validation -- a story that cannot be explained clearly