The default target is some_binary, because it is first. This file will make some_binary the first time, and the second time notice it’s already made, binary option full in make: ‘some_binary’ is up to date.
This will always make both targets, because some_binary depends on other. Similarly, if the clean file is older than the some_binary file, the clean rule will not be called. Adding PHONY to a target will prevent make from confusing the phony target with a file name. In this example, if clean is created, make clean will still be run. PHONY is great to use, but I’ll skip it in the rest of the examples for simplicity.
1 file2 some_binary Here’s a blah. Implicit command of: “cc -c blah. Do not put a comment inside of the blah. We can use wildcards in the target, prerequisites, or commands.
Use vpath to specify where some set of prerequisites exist. Double-Colon Rules are rarely used, but allow the same target to run commands from multiple targets. If these were single colons, an warning would be printed and only the second set of commands would run. We use it to make a temporary file, that doesn’t interfere with others if there is some parallel builds going on. There is such a target that updates it, so it runs that rule before including the file.
This will happen for all targets, not just the one it is before like PHONY. It’s a good idea to always use this, even though make does not for historical reasons. The export directive takes a variable and makes it accessible to sub-make commands. You need to export variables to have them run in the shell as well. Simply expanded allows you to append to a variable. It has nothing with being a function. Note here that it’s a bit different than having a semi-colon between commands, because each is run in a seperate shell, as expected.