First of all, the manual is at the GNU site.
Setting a variable to the result of a shell operation:
CURRENTDIR=$(shell pwd); or
Creating a directory including all intermediate ones:
mkdir -p $(BUILD).
Simple suffix substitution in filenames:
HFILES=$(CFILES:.cpp=.h); a more complex case (involving a change of directory), using
OFILES= $(foreach cfile,$(CFILES),$(BUILD)/$(cfile:.cpp=.o))
another way to do the same:
Standard compilation rule:
%.o: %.cpp g++ $(OPTIONS) -c $< -o $@
Cleaning files without getting errors when they do not exist:
Including another Makefile:
Multiple targets: just list them to the left of ":".
Finally, escaping dollar signs:
© M. Vallisneri 2012 — last modified on 2010/01/29
Tantum in modicis, quantum in maximis