make
followed immediately by make
-> no build.Makefile
.cd examples/no-makefile
make hello.o
make hello
slides.html
.slides.html
is slides.md
which must be built/exist first.slides.md
is not a target, so not built by Make.slides.html
does not exist, build it.slides.md
is newer than slides.html
, rebuild slides.html
.slides.html: slides.md Makefile
filepp slides.md | pandoc -t s5 -V s5-url=../s5/default -s -o slides.html
clean:
rm -f *.html
.PHONY: clean
clean
target which removes intermediate files.clean
can also be used to force a full rebuild..PHONY
: Stops Make being confused by file with same name as target.VAR = VALUE
.VAR ?= VALUE
.make VAR=VALUE
.$(VAR)
.SHELL
.CFLAGS
.$@
: Full target filename (i.e. what will be built).$*
: Target filename without the suffix, e.g. hello.o
becomes hello
.$<
: The file which triggered this rule.CC = clang
CFLAGS = -Weverything -Werror
SOURCES = hello.c
OBJECTS = $(subst .c,.o,$(SOURCES))
EXECUTABLE = hello
$(EXECUTABLE): $(OBJECTS)
$(CC) $(OBJECTS) -o $(EXECUTABLE)
%.o: %.c
$(CC) $(CFLAGS) -c $< -o $@
clean:
-rm -f $(OBJECTS) $(EXECUTABLE)
.PHONY: clean
-n
: Show commands which would be run.-j [number]
.--output-sync
does what it says (>= 4.0).cd src && $(MAKE) $@
.make
and a POSIX shell (usually bash
)../configure && make && sudo make install
.Makefile.am
-> Makefile.in
../configure
turns Makefile.in
into a platform-specific Makefile
(via config.status
)./bin/sh
by default (override with SHELL=
).Makefile
does not cause targets to be rebuilt.?=
can have unintended behaviour.