# make

invocation

# override variables
make CFLAGS='-g -O'

arguments

variables

automatic variables

functions

sources   := $(wildcard *.src)
targets   := $(sources:.src=.trg)
filtered  := $(filter-out broken.src, $(sources))
term_cols := $(shell tput cols)

special targets

commands

pattern

loops

subdirs := $(wildcard */)

.PHONY: all
all: $(subdirs)

.PHONY: $(subdirs)
$(subdirs):
    $(MAKE) -C $@

conventions

variables

uppercase letters are traditional, however gnu recommends lowercase for internal purposes and uppercase for variables that control implicit rules or parameters intended to be overwritten by caller.

gnu standard targets