|
1 | 1 |
|
| 2 | +# VARIABLES # |
| 3 | + |
| 4 | +# Instruct make to warn us when we use an undefined variable (e.g., misspellings). |
| 5 | +MAKEFLAGS += --warn-undefined-variables |
| 6 | + |
| 7 | +# Define the default target: |
| 8 | +.DEFAULT_GOAL := all |
| 9 | + |
| 10 | +# Define the `SHELL` variable to avoid issues on systems where the variable may be inherited from the environment. |
| 11 | +# |
| 12 | +# ## Notes |
| 13 | +# |
| 14 | +# * We use `bash` so that we can use `pipefail`. |
| 15 | +# |
| 16 | +# |
| 17 | +# [1]: https://www.gnu.org/prep/standards/html_node/Makefile-Basics.html#Makefile-Basics |
| 18 | +# [2]: http://clarkgrubb.com/makefile-style-guide |
| 19 | +SHELL := bash |
| 20 | + |
| 21 | +# Define shell flags. |
| 22 | +# |
| 23 | +# ## Notes |
| 24 | +# |
| 25 | +# * `.SHELLFLAGS` was introduced in GNU Make 3.82 and has no effect on the version of GNU Make installed on Mac OS X, which is 3.81. |
| 26 | +# * The `-e` flag causes `bash` to exit immediately if a `bash` executed command fails. |
| 27 | +# * The `-u` flag causes `bash` to exit with an error message if a variable is accessed without being defined. |
| 28 | +# * The `pipefail` option specifies that, if any of the commands in a pipeline fail, the entire pipeline fails. Otherwise the return value of a pipeline is the return value of the last command. |
| 29 | +# * The `-c` flag is in the default value of `.SHELLFLAGS`, which must be preserved, as this is how `make` passes the script to be executed to `bash`. |
| 30 | +# |
| 31 | +.SHELLFLAGS := -eu -o pipefail -c |
| 32 | + |
| 33 | +# Remove targets if its recipe fails. |
| 34 | +# |
| 35 | +# ## Notes |
| 36 | +# |
| 37 | +# * Mentioning this target anywhere in a Makefile prevents a user from re-running make and using an incomplete or invalid target. |
| 38 | +# * When debugging, it may be necessary to comment this line out so the incomplete or invalid target can be inspected. |
| 39 | +# |
| 40 | +# [1]: https://www.gnu.org/software/make/manual/html_node/Special-Targets.html |
| 41 | +.DELETE_ON_ERROR: |
| 42 | + |
| 43 | +# Remove all the default suffixes, preferring to define all rules explicitly. |
| 44 | +# |
| 45 | +# [1]: https://www.gnu.org/software/make/manual/html_node/Suffix-Rules.html#Suffix-Rules |
| 46 | +# [2]: https://www.gnu.org/software/make/manual/html_node/Suffix-Rules.html#Suffix-Rules |
| 47 | +.SUFFIXES: |
| 48 | + |
| 49 | + |
2 | 50 | # DEPENDENCIES # |
3 | 51 |
|
4 | 52 | # Order is important: |
|
0 commit comments