In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/03 Report--
1 basic rules of makefile
TARGET... : DEPENDENCIES...
COMMAND
...
Files produced by TARGET programs, such as executable files and object files; targets can also be actions to be performed, such as "clean".
DEPENDENCIES is the input file used to generate a target, and a target usually depends on multiple files.
A command (COMMAND) is an action performed by make, and one can have multiple commands, each on a line. Note: the starting character of each command line must be a TAB character!
If there are one or more file updates in DEPENDENCIES, COMMAND will execute, which is the core content of Makefile.
1.1 makefile uses pseudo-target .PHONY
1.2 makefile uses variables
1.2.1 makefile automation variables
2 make automatic derivation
GNU's make is very powerful, it can automatically derive the commands behind files and file dependencies, so there is no need to write similar commands after every [.o] file, because our make will automatically recognize and derive the commands.
As long as make sees a [.o] file, it automatically adds the [.c] file to the dependency. If make finds a whatever.o, then whatever.c will be a dependent file for whatever.o. And gcc-c whatever.c will also be deduced.
Common functions in 3 makefile Universal Edition 3.1 makefile
-- wildcard function
Files that match patterns in 's current directory for example: src=$ (wildcard .c)
-- notdir function
removal path for example: $(notdir $src)
-- patsubst function
pattern matching replacement for example: $(patsubst%.c,%.o,$src)
is equivalent to $(src:.c=.o)
-- shell function
executes the shell command for example: $(shell ls-d /)
3.2 Multi-level directory makefile
there is one thing to note here, if you compile C++ files with Gmail +, the libraries used must be compiled and generated by Gmail +, otherwise you will not be able to link.
With regard to + and gcc, although Gmail + is used to compile .cpp and gcc is used to compile .c, it can't be said that there is no overlap between the two.
in fact, both can compile C and C++ code, but:,
1) gcc treats .c files as C programs and Gmail + as C++ programs; for .cpp files, both think of C++ programs
2) so, during the compilation phase, gcc is called by Gmail +, which is equivalent to C++ code, but because the gcc command does not automatically link with the libraries compiled by Gmail +, it is usually done with Gmail +.
therefore, for convenience's sake, compile our library files with glossy +.
At the end of , there is an article http://m.blog.csdn.net/zhujianwei31415/article/details/50725569 that I saw.
The compatibility between gcc and Gmail + compiling link library files is easy to understand.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.