Define command package
If the makefile contains some identical command sequences, we can define a variable for these identical command sequences. The syntax for defining this command sequence starts with "Define" and ends with "endef", for example:
Define run-YACC
YACC $ (firstword $ ^)
Mv y. Tab. C $ @
Endef
Here, "Run-YACC" is the name of the command package. It should not be the same as the variable name in makefile. The two lines in "Define" and "endef" are command sequences. The first command in this command package is to run YACCProgramBecause the YACC program always generates a file named "Y. Tab. c", the command on the second line is to change the file name. Let's take a look at this command package in an example.
Foo. C: Foo. Y
$ (Run-YACC)
We can see that to use this command package, we are just like using variables. In the use of this command package, "$ ^" in the Command package "Run-YACC" is "foo. Y ","$ @" Is "Foo. C "(for this special variable starting with" $ ", we will introduce it later). When executing the command package, make will execute each command in the Command package independently.
Original
Http://wiki.ubuntu.org.cn/index.php? Title = % E8 % B7 % 9f % E6 % 88% 91% E4 % B8 % 80% E8 % B5 % B7 % E5 % 86% 99 makefile: % E4 % B9 % a6 % E5 % 86% 99% E5 % 91% BD % E4 % BB % A4 & variant = ZH-HANT