Opening page…
Build automation — targets, variables, and pattern rules.
target: dep1 dep2
command
# Phony targets don't produce output files
.PHONY: clean test build
clean:
rm -rf dist/
test:
npm testfoo = barLazy (recursive) assignmentfoo := barImmediate assignmentfoo ?= barSet only if unsetfoo += barAppend to variablefoo != echo hiShell command result$(foo)Expand variable$@Current target name$<First prerequisite$^All prerequisites$*Stem of pattern rule match$(@D)Directory part of target-commandIgnore errors (continue on failure)@commandSuppress command echo+commandRun even in dry-run mode (make -n)$(wildcard *.c)Expand glob$(patsubst %.c,%.o,$(src))Pattern substitution$(shell find . -name "*.js")Shell command$(filter %.js,$(files))Filter by pattern$(strip $(var))Remove whitespacemake -eEnv vars override file varsmake -BRebuild all unconditionallymake -sSilent modemake -j4Parallel jobsmake -nDry run (print, no execute)