The GNU make manual introduces order-only prerequisites:
target: prerequisite1 prerequisite2 | orderonlyprerequisite1 orderonlyprerequisite2
However, while that manual page gives an example and describes the purpose of order-only prerequisites, at no point does the manual page answer the question in the title: What is an order-only prerequisite?
Can you give a precise definition how order-only prerequisites behave?
Basically, the prerequisites in Makefile have two functions: They are checked and, if necessary, are built before the target. If any of the prerequisites gets rebuilt (or is simply newer than the target) then the target will also be rebuilt.
The order of rules is not significant, except for determining the default goal : the target for make to consider, if you do not otherwise specify one. The default goal is the target of the first rule in the first makefile. If the first rule has multiple targets, only the first target is taken as the default.
The variable $@ represents the name of the target and $< represents the first prerequisite required to create the output file.
A dependency is a file that is used as input to create the target. A target often depends on several files. A command is an action that make carries out. A rule may have more than one command, each on its own line.
First, let's recall what the ordinary prerequisites are.
Basically, the prerequisites in Makefile have two functions:
Now, the order-only prerequisites do 1., i.e. impose build-order, but not 2.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With