Question

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

Was it helpful?

Solution

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.

OTHER TIPS

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

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top