forked from mmilankg/nchat
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
44 lines (32 loc) · 858 Bytes
/
Makefile
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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
# Makefile based on the Mecklenberg book (Mecklenberg, Managing Projects with GNU Make, 3E, 2005)
programs :=
sources :=
objects = $(subst .cpp,.o, $(sources))
dependencies = $(subst .cpp,.d, $(sources))
include_dirs := include
CPPFLAGS += $(addprefix -I, $(include_dirs))
CXXFLAGS += -O0 -g3 -std=c++11
WFLAGS += -Wall -pedantic
vpath %.h $(include_dirs)
CXX := g++
MV := mv -f
RM := rm -f
SED := sed
all:
include src/build.mk
include src/server/build.mk
include src/client/build.mk
.PHONY: all
all: $(programs)
.PHONY: clean
clean:
$(RM) $(objects) $(programs) $(dependencies)
ifneq "$(MAKECMDGOALS)" "clean"
include $(dependencies)
endif
%.o: %.cpp
$(CXX) -o $@ -c $(CPPFLAGS) $(CXXFLAGS) $(WFLAGS) $<
%.d: %.cpp
$(CXX) $(CXXFLAGS) $(CPPFLAGS) -M $< | \
$(SED) 's,\($(notdir $*)\.o\) *:,$(dir $@)\1 $@: ,' > $@.tmp
$(MV) $@.tmp $@