Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

$+ meaning in makefile

What does $+ in a GNU makefile mean?
Also, please give me some good lookup manual for writing makefiles.

like image 465
Arjun Singri Avatar asked Oct 21 '25 15:10

Arjun Singri


2 Answers

From the make manual:

$^    The names of all the prerequisites, with spaces between them. For prerequisites which are archive members, only the member named is used (see Archives). A target has only one prerequisite on each other file it depends on, no matter how many times each file is listed as a prerequisite. So if you list a prerequisite more than once for a target, the value of $^ contains just one copy of the name. This list does not contain any of the order-only prerequisites; for those see the `$|' variable, below.

$+    This is like `$^', but prerequisites listed more than once are duplicated in the order they were listed in the makefile. This is primarily useful for use in linking commands where it is meaningful to repeat library file names in a particular order.

like image 131
rampion Avatar answered Oct 23 '25 08:10

rampion


In both cases, all I can say is RTFM... or RTFI in this case. Type

info make

at a command prompt and all the information you could ever want will be at your fingertips.

For $+ specifically: it refers to the names of all the prerequisites of the current rule. See for example http://uw714doc.sco.com/cgi-bin/info2html?(make.info)Automatic&lang=en

like image 20
David Z Avatar answered Oct 23 '25 08:10

David Z