-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathMakefile
More file actions
41 lines (29 loc) · 939 Bytes
/
Copy pathMakefile
File metadata and controls
41 lines (29 loc) · 939 Bytes
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
# 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++
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) -c $< -o $@ -MMD -MP -MF $(patsubst %.o,%.d,$@) $(CPPFLAGS) $(CXXFLAGS) $(WFLAGS)
# compile_commands.json can be generated with "make CXX=clang++"
.PHONY: compile_commands.json
compile_commands.json:
@$(MAKE) -n -B | grep "^$(CXX) -c" | ./convert-to-compile-commands.sh > compile_commands.json