-
Notifications
You must be signed in to change notification settings - Fork 11
/
Makeinclude
125 lines (102 loc) · 4.01 KB
/
Makeinclude
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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
# Root includes for all Nimbus Makefiles,
# before including this file NIMBUS_ROOT needs to be set.
BOOST_ROOT = ${NIMBUS_ROOT}/extern/boost/
LEVELDB_ROOT = ${NIMBUS_ROOT}/extern/leveldb/
PROTOBUF_ROOT = ${NIMBUS_ROOT}/extern/protobuf/
# Set the compiler
# Configuration file for non-default compiler values (CPP)
-include ${NIMBUS_ROOT}/Makeconfig
# The Deafult value for CPP is CC -E
# If not changed by Makeconfig then set
ifeq ('$(CPP)', '$(CC) -E')
CPP = g++
endif
PROTOC = ${PROTOBUF_ROOT}/bin/protoc
# Flags for all cpp invocations
CFLAGS = -Wall -g -O3
# CFLAGS += -pg # flags for profiling with gprof
# CFLAGS += -fno-omit-frame-pointer -ggdb -pg # flags for profiling with perf
# CFLAGS += -D_NIMBUS_NO_DBG # flag to remove dbg statements
# CFLAGS += -D_NIMBUS_NO_LOG # flag to remove log statements
# CFLAGS += -DNDEBUG # flag for production compilation
# -I params for all cpp invocations
IFLAGS = -I${NIMBUS_ROOT} # Include nimbus headers
IFLAGS += -I${BOOST_ROOT}/include # Include boost headers
IFLAGS += -I${LEVELDB_ROOT}/include # Include leveldb headers
IFLAGS += -I${PROTOBUF_ROOT}/include # Include protobuf headers
# IFLAGS += -I/opt/local/include # Include MacPorts includes
# IFLAGS += -I/usr/local/include # Include boost and protocol buffer headers
# -l params for linking invocation, only for executables
# LFLAGS = -lnimbus -lboost_thread -lboost_system -lpthread -lprotobuf -lboost_program_options -ldl -lleveldb
LFLAGS = -lnimbus
LFLAGS += -lpthread -ldl
LFLAGS += -lleveldb
LFLAGS += -lprotobuf
LFLAGS += -lboost_thread -lboost_system -lboost_program_options -lboost_filesystem
# -L params for linking invocation, only for executables
LDFLAGS = -L${NIMBUS_ROOT}/lib # Link with nimbus library
LDFLAGS += -L${BOOST_ROOT}/lib # Link with boost library
LDFLAGS += -L${LEVELDB_ROOT} # Link with leveldb library
LDFLAGS += -L${PROTOBUF_ROOT}/lib # Link with protobuf library
# LDFLAGS += -L/opt/local/lib # Link with MacPorts libraries
# LDFLAGS += -L/usr/local/lib # Link with boost and protocol buffer libraries
# -rpath tells executable where to look for libraries, only for executables
LDFLAGS += -Wl,-rpath ${NIMBUS_ROOT}/lib
LDFLAGS += -Wl,-rpath ${BOOST_ROOT}/lib
LDFLAGS += -Wl,-rpath ${LEVELDB_ROOT}
LDFLAGS += -Wl,-rpath ${PROTOBUF_ROOT}/lib
# flags to defer linking, only for shared libraries
SHARED_FLAGS = -shared -fPIC
# Checking rules
NIMBUS_CCLINT = ${NIMBUS_ROOT}/tools/cpplint.py
NIMBUS_FILENAMES = ${NIMBUS_ROOT}/tools/cppfiles.sh
CFILES = $(wildcard *.cc)
HFILES = $(wildcard *.h)
CHECKDIR = checkdir
DEPNAMES = $(subst .cc,.cc.ck ,$(CFILES)) $(subst .h,.h.ck ,$(HFILES))
DEPFILES = $(addprefix $(CHECKDIR)/,$(DEPNAMES))
CHECKFILE = $(CHECKDIR)/checkfile
$(CHECKDIR)/%.ck: %
@/bin/echo -n "Checking code style in $^: "
@${NIMBUS_CCLINT} $^
@touch $@
$(CHECKDIR):
@mkdir -p $(CHECKDIR)
$(CHECKFILE):
@${NIMBUS_FILENAMES}
@mkdir -p $(CHECKDIR)
@touch $@
lint: $(CHECKDIR) ${DEPFILES}
fcheck: $(CHECKFILE)
check: fcheck lint
# General clean directives
clean-files:
@\rm -f *.o *~ \#*
@\rm -Rf $(CHECKDIR)
# Detect if we are running Darwin -- should be replaced by autoconf eventually
ifeq ($(findstring darwin, ${OSTYPE}), darwin)
OS_DARWIN=TRUE
else
ifeq ($(findstring Darwin, $(shell uname)), Darwin)
OS_DARWIN=TRUE
endif
endif
# Detect if we are running Linux -- should be replaced by autoconf eventually
ifeq (${OSTYPE}, linux)
OS_LINUX=TRUE
else
ifeq ($(findstring Linux, $(shell uname)), Linux)
OS_LINUX=TRUE
endif
endif
# # For reasons I do not understand need to disable two-level loading namespace
# # optimizations under Darwin -pal
# ifdef OS_DARWIN
# CFLAGS += -Wl,-no_implicit_dylibs
# endif
#
# ifdef OS_DARWIN
# LINK_FLAG = -install_name @rpath/$(LIBRARY)
# else
# LFLAGS += -lrt
# endif