当前位置:网站首页>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 .
边栏推荐
猜你喜欢

元气少女王钰洁 受邀担任第六季完美童模全球总决赛代言人

Pointnet/Pointnet++学习

丨EGFR FISH 探针解决方案

Redis7.0的安装步骤

How to add a "security lock" to the mobile office of government and enterprises?

Differences and functions of TOS cos DSCP

Abnova丨CSV 单克隆抗体解决方案

cyclegan:unpaired image-to-image translation using cycle-consistent adversarial network

recvmsg & sendmsg

Sweet girl lisixia was invited to be the little host of the global finals of the sixth season perfect child model
随机推荐
Use of redis
Finding the sum of N multiplications
浅谈接口测试(一)
Rollback Protection
Detailed explanation of memory leak check tools
Distributed systems (II) understanding of distributed transactions
On the difference between strlen and sizeof
Detailed explanation of WiFi related knowledge
GUN make (3) Makefile的规则
GUN make (1) 简介
Cs144 environment configuration
Exploring temporary information for dynamic network embedding
pixel 6 root
LeetCode 31 ~ 40
PTA class a simulated 11th bomb: 1124-1131
代码覆盖率测试(一)
Postman斷言對應脚本的解釋
Talking about interface test (2)
web测试
通俗易懂C語言關鍵字static