This repository has been archived by the owner on Dec 21, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Makefile
84 lines (65 loc) · 2.41 KB
/
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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
#
# This makefile system follows the structuring conventions
# recommended by Peter Miller in his excellent paper:
#
# Recursive Make Considered Harmful
# http://aegis.sourceforge.net/auug97.pdf
#
# We create a listing of the root directories for access into
OBJDIR := obj
BINDIR := bin
SRCDIR := .
# Executable for protocol buffers
PROTOCEXE := $(PROTOB)/src/.libs/protoc
# '$(V)' controls whether the lab makefiles print verbose commands (the
# actual shell commands run by Make), as well as the "overview" commands
# (such as '+ cc lib/readline.c').
#
# For overview commands only, the line should read 'V = @'.
# For overview and verbose commands, the line should read 'V ='.
V = @
# Set the compiler and compile-time loaded libraries
CXX := g++
LDLIBRARYPATH :=
# For profiling (with gprof), this line should read 'PG = -pg'
# For fast execution, this line should read 'PG ='.
PG =
# For debugging (with gdb), this line should read 'DEBUG = -g'
# For fast execution, this line should read 'DEBUG ='
DEBUG = -g
# Set the flags for C++ to compile with (namely where to look for external
# libraries) and the linker libraries (again to look in the ext/ library)
CXXFLAGS := -g -MD $(PG) -I$(SRCDIR) -I$(OBJDIR) -std=c++1y
CXXFLAGS += -Wall -Werror
LDFLAGS := -lpthread -lrt $(PG)
# Lists that the */Makefile.inc makefile fragments will add to
OBJDIRS :=
TESTS :=
# Make sure that 'all' is the first target
all:
# Makefile template so that the makefrags are far less redundant
MAKEFILE_TEMPLATE := Makefile.template
# Makefile fragments for library code
include utils/Makefile.inc
include nodes/Makefile.inc
include core/Makefile.inc
test: $(TESTS)
clean:
rm -rf $(OBJDIR) $(BINDIR)
# This magic automatically generates makefile dependencies
# for header files included from C source files we compile,
# and keeps those dependencies up-to-date every time we recompile.
# See 'mergedep.pl' for more information.
$(OBJDIR)/.deps: $(foreach dir, $(OBJDIRS), $(wildcard $(OBJDIR)/$(dir)/*.d))
@mkdir -p $(@D)
@cat $^ /dev/null > $@
# @$(PERL) mergedep.pl $@ $^
-include $(OBJDIR)/.deps
always:
# Eliminate default suffix rules
.SUFFIXES:
# make it so that no intermediate .o files are ever deleted
.PRECIOUS: $(foreach dir, $(OBJDIRS), $(OBJDIR)/$(dir)/%.o) \
$(foreach dir, $(OBJDIRS), $(OBJDIR)/$(dir)/%.pb.cc) \
$(foreach dir, $(OBJDIRS), $(OBJDIR)/$(dir)/%.pb.h)
.PHONY: all always clean test