1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
|
# This being the first target defined, it is the default that will be
# built when you run "make". The standard "make" utility has built-in
# rules that tell it how to build programs from source files, but not
# for C++:
#
# https://pubs.opengroup.org/onlinepubs/9699919799/
#
# Here we implement something similar for C++ programs contained in
# .cc source files. This, we hope, ensures that this Makefile will
# work with non-GNU implementations of Make.
example: example.o
# POSIX does not specify a default for this, so we try "c++"
# because that's what GNU Make does.
CXX ?= c++
LIBS ?= -lLfunction
.SUFFIXES: .cc .o
.cc.o:
$(CXX) -c $(CXXFLAGS) $(CPPFLAGS) -o $@ $<
.o:
$(CXX) $(LDFLAGS) $< $(LIBS) -o $@
.PHONY: clean
clean:
rm -f example.o example
|