forked from facebookarchive/scribe
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile.am
executable file
·171 lines (141 loc) · 6.03 KB
/
Makefile.am
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
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
@GLOBAL_HEADER_MK@
@PRODUCT_MK@
all:
# IMPORTANT THINGS TO FOLLOW
# Do not use relative paths to refer to sources, objects, libs etc not located in the current component dir or its subdirectories.
# Use $(top_srcdir), $(top_buildir), $(srcdir) which are provided by automake.
# Example:
# Use /xxx/yyy OR $(xxx_home)/yyy/.. to refer to paths outside the root of this project.
# To refer to sources or other input files use $(top_srcdir)/... if outside of current dir but in this project.
# To refer to all *generated* files, objects, libs etc [ if not in current dir or its subdir], use $(top_builddir)
# Follow naming conventions for global, common and specific flags.
# Make build configuratiion and rules readable.
# Break up into logical sections.
# Set up command line options, default paths in configure.ac.
# Generate gen-cpp in current dir not in other locations.
# Do no create new targets especially if build time is small
# Default setting is opt mode. Use --disable-opt to turn this off.
# Default setting is static library . Use --disable-debug to turn on shared.
# Section 1 #########################################################################
# Set up User defined flags, variables and switches here.
# It is preferable to define these variables in configure.ac.
# User specified path variables set in configure.ac.
# thrift_home
# jvm_lib
# smc_home
# fb_home
# fb303_home
# hadoop_home
#
THRIFT = $(thrift_home)/bin/thrift
THRIFT_INCLUDES = -I $(fb303_home)/share/
THRIFT_OPTS = $(THRIFT_INCLUDES) --gen cpp:pure_enums --gen py --gen php --gen java
# User defined conditionals and conditonal statements set up in configure.ac.
# FACEBOOK set in configure.ac
if FACEBOOK
FB_SOURCES = gen-cpp/ServiceManager_types.cpp gen-cpp/ServiceManager.cpp
FB_CPPFLAGS = -I$(fb_home)
ENV_SOURCES = env_facebook.cpp
else
ENV_SOURCES = env_default.cpp
endif
if DEBUG
DEBUG_CPPFLAGS = -DDEBUG_TIMING
endif
# Set libraries external to this component.
EXTERNAL_LIBS = -L$(thrift_home)/lib -L$(fb303_home)/lib -L$(hadoop_home)/lib -lfb303 -lthrift -lthriftnb
EXTERNAL_LIBS += -levent -lpthread -lz
if USE_SCRIBE_HDFS
EXTERNAL_LIBS += -lhdfs -ljvm
endif
if USE_SCRIBE_CASSANDRA
EXTERNAL_LIBS += -lcassandra -ljansson
endif
if USE_SCRIBE_MYSQL
EXTERNAL_LIBS += -lmysqlclient -lboost_regex-mt -lboost_date_time-mt
endif
if USE_SCRIBE_HYPERTABLE
EXTERNAL_LIBS += -ljansson -L$(hypertable_home)/lib -lHyperThrift \
-lHyperCommon -lHypertable -lthrift -levent -llog4cpp
endif
# Section 2 ############################################################################
# Set common flags recognized by automake.
# DO NOT USE CPPFLAGS, CXXFLAGS, CFLAGS, LDFLAGS here! Set in configure.ac and|or override on command line.
# USE flags AM_CXXFLAGS, AM_CFLAGS, AM_CPPFLAGS, AM_LDFLAGS, LDADD in this section.
AM_CPPFLAGS = -I..
AM_CPPFLAGS += -I$(thrift_home)/include
AM_CPPFLAGS += -I$(thrift_home)/include/thrift
AM_CPPFLAGS += -I$(fb303_home)/include/thrift
AM_CPPFLAGS += -I$(fb303_home)/include/thrift/fb303
AM_CPPFLAGS += -I$(hadoop_home)/include
AM_CPPFLAGS += $(BOOST_CPPFLAGS)
AM_CPPFLAGS += $(FB_CPPFLAGS) $(DEBUG_CPPFLAGS)
AM_CPPFLAGS += -DT_GLOBAL_DEBUG_VIRTUAL=0 -DHAVE_INTTYPES_H -DHAVE_NETINET_IN_H
AM_LDFLAGS = -Wl,--no-as-needed $(BOOST_LDFLAGS) $(BOOST_SYSTEM_LIB) $(BOOST_FILESYSTEM_LIB) $(BOOST_IOSTREAMS_LIB) $(BOOST_REGEX_LIB)
if USE_SCRIBE_HYPERTABLE
AM_CPPFLAGS += -I$(hypertable_home)/include -D_REENTRANT
AM_LDFLAGS += -rdynamic
#-I/opt/hypertable/current/include/thrift
endif
# Section 3 #############################################################################
# GENERATE BUILD RULES
# Set Program/library specific flags recognized by automake.
# Use <progname|libname>_<FLAG> to set prog / lib specific flag s
# foo_CXXFLAGS foo_CPPFLAGS foo_LDFLAGS foo_LDADD
# Static -- multiple libraries can be defined
if STATIC
lib_LIBRARIES = libscribe.a libdynamicbucketupdater.a
libscribe_a_SOURCES = gen-cpp/scribe.cpp gen-cpp/scribe_types.cpp gen-cpp/scribe_constants.cpp
libdynamicbucketupdater_a_SOURCES = gen-cpp/BucketStoreMapping.cpp gen-cpp/bucketupdater_constants.cpp gen-cpp/bucketupdater_types.cpp
INTERNAL_LIBS = libscribe.a libdynamicbucketupdater.a
endif
# Shared -- multiple libraries can be defined
if SHARED
shareddir = $(prefix)/lib
shared_PROGRAMS = libscribe.so
libscribe_so_SOURCES = gen-cpp/scribe.cpp gen-cpp/scribe_types.cpp
libscribe_so_CXXFLAGS = $(SHARED_CXXFLAGS)
libscribe_so_LDFLAGS = $(SHARED_LDFLAGS)
INTERNAL_LIBS = libscribe.so
endif
# Binaries -- multiple progs can be defined.
bin_PROGRAMS = scribed
scribed_SOURCES = store.cpp store_queue.cpp conf.cpp file.cpp conn_pool.cpp scribe_server.cpp network_dynamic_config.cpp dynamic_bucket_updater.cpp $(FB_SOURCES) $(ENV_SOURCES)
if USE_SCRIBE_HDFS
scribed_SOURCES += HdfsFile.cpp
endif
if USE_SCRIBE_CASSANDRA
scribed_SOURCES += CassandraStore.cpp
endif
if USE_SCRIBE_MYSQL
scribed_SOURCES += MysqlStore.cpp CombineStore.cpp
endif
if USE_SCRIBE_HYPERTABLE
scribed_SOURCES += HypertableStore.cpp
endif
scribed_LDADD = $(INTERNAL_LIBS) $(EXTERNAL_LIBS)
if SHARED
scribed_DEPENDENCIES = libscribe.so
endif
# Section 4 ##############################################################################
# Set up Thrift specific activity here.
# We assume that a <name>+types.cpp will always be built from <name>.thrift.
$(eval $(call thrift_template,.,$(srcdir)/../if/scribe.thrift,$(THRIFT_OPTS)))
$(eval $(call thrift_template,.,$(srcdir)/../if/bucketupdater.thrift,$(THRIFT_OPTS)))
if FACEBOOK
$(eval $(call thrift_template,.,$(smc_home)/if/ServiceManager.thrift,--gen cpp))
endif
BUILT_SOURCES = thriftstyle
# Section 5 [OPTIONAL] ##################################################################################
# Create user specific targets [ OPTIONAL]
# Overrides pre-existing target "all". Use only if required.
# all: <all-special>
# Add to pre-existing target clean
clean-local: clean-common
# Add to pre-existing target all:
#all-local: scribed
# @mkdir -p $(top_srcdir)/bin
# cp $(bin_PROGRAMS) $(top_srcdir)/bin
# Special targets.
#server-opt : $(BUILT_SOURCES) scribed
@GLOBAL_FOOTER_MK@