3 prism_languages: [makefile]
11 uglify = $(uglify) # lazy assignment
12 compressor := $(uglify) # immediate assignment
13 prefix ?= /usr/local # safe assignment
14 hello += world # append
17 `=` expressions are only evaluated when they're being used.
24 $< # "src.c" (first prerequisite)
25 $^ # "src.c src.h" (all prerequisites)
28 $* # the 'stem' with which an implicit rule matches ("foo" in "foo.c")
31 $+ # prerequisites (all, with duplication)
32 $? # prerequisites (new ones)
33 $| # prerequisites (order-only?)
35 $(@D) # target directory
40 | Prefix | Description |
41 | ------ | ------------------------------------------- |
42 | `-` | Ignore errors |
43 | `@` | Don't print command |
44 | `+` | Run even if Make is in 'don't execute' mode |
57 js_files := $(wildcard test/*.js)
58 all_files := $(shell find images -name "*")
64 file = $(SOURCE:.cpp=.o) # foo.cpp => foo.o
65 outputs = $(files:src/%.coffee=lib/%.js)
67 outputs = $(patsubst %.c, %.o, $(wildcard *.c))
68 assets = $(patsubst images/%, assets/%, $(wildcard images/*))
74 $(strip $(string_var))
76 $(filter %.less, $(files))
77 $(filter-out %.less, $(files))
84 ffmpeg -i $< > $@ # Input and output
98 -e, --environment-overrides
102 -j, --jobs=N # parallel processing
110 $(CC) -o foo $(objects) $(libs_for_gcc)
112 $(CC) -o foo $(objects) $(normal_libs)
125 - [isaacs's Makefile](https://gist.github.com/isaacs/62a2d1825d04437c6f08)
126 - [Your Makefiles are wrong](https://tech.davis-hansson.com/p/make/)
127 - [Manual](https://www.gnu.org/software/make/manual/html_node/index.html)