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