-
Notifications
You must be signed in to change notification settings - Fork 24
/
Makefile.am
308 lines (245 loc) · 8.98 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
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
AUTOMAKE_OPTIONS = subdir-objects
ACLOCAL_AMFLAGS = -I m4
if SOURCE_PROVIDED
# Render path to Mesos bundled gmock.
BUNDLE_SUBDIR = 3rdparty
GOOGLETEST = $(MESOS_BUILD_DIR)/$(BUNDLE_SUBDIR)/googletest-release-$(GOOGLETEST_VERSION)
include $(MESOS_ROOT)/$(BUNDLE_SUBDIR)/versions.am
GMOCK = $(GOOGLETEST)/googlemock
GTEST = $(GOOGLETEST)/googletest
ZOOKEEPER = $(MESOS_BUILD_DIR)/$(BUNDLE_SUBDIR)/zookeeper-$(ZOOKEEPER_VERSION)/src/c
NVML = $(MESOS_BUILD_DIR)/$(BUNDLE_SUBDIR)/nvml-$(NVML_VERSION)
GRPC = $(MESOS_BUILD_DIR)/$(BUNDLE_SUBDIR)/grpc-$(GRPC_VERSION)
endif
# We want to install modules in mesos directory.
pkglibdir = $(libdir)/mesos
# Initialize variables here so we can use += operator everywhere else.
pkglib_LTLIBRARIES =
bin_PROGRAMS =
BUILT_SOURCES =
CLEANFILES =
# Add compiler and linker flags for pthreads.
AM_CXXFLAGS = $(PTHREAD_CFLAGS) $(MESOS_CXXFLAGS)
AM_LIBS = $(PTHREAD_LIBS)
# Add top-level include dir to our include path.
MESOS_CPPFLAGS += -I$(top_srcdir)/include -I$(top_srcdir)/src -Iinclude -I$(top_srcdir)
# Setup CPPFLAGS that are used for most source files.
AM_CPPFLAGS = $(MESOS_CPPFLAGS)
# Setup the protobuf compiler.
PROTOC = @PROTOCOMPILER@
PROTOCFLAGS = -I$(srcdir)
if SOURCE_PROVIDED
PROTOCFLAGS += -I$(MESOS_ROOT)/include
endif
###############################################################################
# Dockercfg Remover Hook.
###############################################################################
# Library with the .dockercfg remover hook.
pkglib_LTLIBRARIES += libremovedockercfg.la
libremovedockercfg_la_SOURCES = \
dockercfg/remover.cpp
libremovedockercfg_la_LDFLAGS = \
-release $(PACKAGE_VERSION) \
-shared $(MESOS_LDFLAGS)
###############################################################################
# Journald ContainerLogger Module.
###############################################################################
# Library with the ContainerLogger module.
pkglib_LTLIBRARIES += libjournaldlogger.la
libjournaldlogger_la_SOURCES = \
journald/journald.hpp \
journald/lib_journald.hpp \
journald/lib_journald.cpp
libjournaldlogger_la_LDFLAGS = \
-release $(PACKAGE_VERSION) \
-shared $(MESOS_LDFLAGS)
# Companion binary for the ContainerLogger module.
bin_PROGRAMS += mesos-journald-logger
mesos_journald_logger_SOURCES = \
journald/journald.hpp \
journald/journald.cpp
SYSTEMD_JOURNALD = `pkg-config --cflags --libs libsystemd`
# NOTE: The modules build assumes that Mesos is built with
# `--enable-launcher-sealing` and `--disable-libtool-wrappers`.
# An internal symbol gated by this flag inside `src/linux/memfd.hpp`
# will be used by the logger.
mesos_journald_logger_LDFLAGS = \
$(MESOS_LDFLAGS) \
$(SYSTEMD_JOURNALD)
###############################################################################
# LogSink Anonymous Module.
###############################################################################
# Library with the LogSink module.
pkglib_LTLIBRARIES += liblogsink.la
liblogsink_la_SOURCES = \
logsink/logsink.hpp \
logsink/logsink.cpp
liblogsink_la_LDFLAGS = \
-release $(PACKAGE_VERSION) \
-shared $(MESOS_LDFLAGS)
###############################################################################
# Mesos Isolator Module.
###############################################################################
METRICS_PROTOS = \
metrics/messages.pb.cc \
metrics/messages.pb.h
# Targets for generating C++ protocol buffer code.
metrics/%.pb.cc metrics/%.pb.h: $(top_srcdir)/metrics/%.proto
$(PROTOC) $(PROTOCFLAGS) --cpp_out=. $^
BUILT_SOURCES += $(METRICS_PROTOS)
CLEANFILES += $(METRICS_PROTOS)
# Library with the MetricsIsolator module.
pkglib_LTLIBRARIES += libmetrics-module.la
libmetrics_module_la_SOURCES = \
metrics/isolator.hpp \
metrics/isolator.cpp \
${METRICS_PROTOS}
libmetrics_module_la_LDFLAGS = \
-release $(PACKAGE_VERSION) \
-shared $(MESOS_LDFLAGS)
###############################################################################
# Overlay Modules.
###############################################################################
OVERLAY_PROTOS = \
overlay/overlay.pb.cc \
overlay/overlay.pb.h \
overlay/messages.pb.cc \
overlay/messages.pb.h
# Targets for generating C++ protocol buffer code.
overlay/%.pb.cc overlay/%.pb.h: $(top_srcdir)/overlay/%.proto
$(PROTOC) $(PROTOCFLAGS) --cpp_out=. $^
BUILT_SOURCES += $(OVERLAY_PROTOS)
CLEANFILES += $(OVERLAY_PROTOS)
# Library with both master and agent anonymous modules.
pkglib_LTLIBRARIES += libmesos_network_overlay.la
libmesos_network_overlay_la_SOURCES = \
overlay/agent_metrics.cpp \
overlay/agent.cpp \
overlay/master_metrics.cpp \
overlay/master.cpp \
overlay/supervisor_metrics.cpp \
${OVERLAY_PROTOS}
libmesos_network_overlay_la_LDFLAGS = \
-release $(PACKAGE_VERSION) \
-shared $(MESOS_LDFLAGS)
###############################################################################
# Unit tests.
###############################################################################
if SOURCE_PROVIDED
check_PROGRAMS=
pkglib_LTLIBRARIES += libmesos_tests.la
libmesos_tests_la_SOURCES = \
tests/main.cpp \
tests/cluster.cpp \
tests/containerizer.cpp \
tests/environment.cpp \
tests/flags.cpp \
tests/mesos.cpp \
tests/module.cpp \
tests/mock_registrar.cpp \
tests/mock_slave.cpp \
tests/script.cpp \
tests/utils.cpp \
tests/containerizer/launcher.cpp \
tests/containerizer/memory_test_helper.cpp
# Additional flags needed to build the Mesos test helpers.
libmesos_tests_la_CPPFLAGS = \
-I$(MESOS_BUILD_DIR)/include/mesos \
-I$(ZOOKEEPER)/include \
-I$(ZOOKEEPER)/generated \
-I$(NVML) \
-I$(GRPC)/include \
-isystem $(GMOCK)/include \
-I$(GTEST)/include \
-DMODULES_BUILD_DIR=\"$(abs_top_builddir)\" \
-DSOURCE_DIR=\"$(MESOS_ROOT)\" \
-DBUILD_DIR=\"$(MESOS_BUILD_DIR)\" \
-DPKGMODULEDIR=\"nowhere\" \
-DLIBDIR=\"nowhere\" \
-DPKGLIBEXECDIR=\"nowhere\" \
-DTESTLIBEXECDIR=\"nowhere\" \
-DSBINDIR=\"nowhere\" \
-DPKGDATADIR=\"nowhere\" \
$(AM_CPPFLAGS)
libmesos_tests_la_LDFLAGS = \
-release $(PACKAGE_VERSION) \
-shared $(MESOS_LDFLAGS)
# Test (make check) binary for the dockercfg hook.
check_PROGRAMS += test-dockercfg
test_dockercfg_SOURCES = \
tests/dockercfg_tests.cpp
test_dockercfg_CPPFLAGS = \
$(libmesos_tests_la_CPPFLAGS)
test_dockercfg_LDADD = \
$(MESOS_LDFLAGS) \
$(MESOS_BUILD_DIR)/$(BUNDLE_SUBDIR)/.libs/libgmock.la \
$(MESOS_BUILD_DIR)/src/.libs/libmesos.la \
libmesos_tests.la \
libremovedockercfg.la
# Test (make check) binary for the journald module.
check_PROGRAMS += test-journald
test_journald_SOURCES = \
tests/journald_tests.cpp
test_journald_CPPFLAGS = \
$(libmesos_tests_la_CPPFLAGS)
test_journald_LDADD = \
$(MESOS_LDFLAGS) \
$(MESOS_BUILD_DIR)/$(BUNDLE_SUBDIR)/.libs/libgmock.la \
$(MESOS_BUILD_DIR)/src/.libs/libmesos.la \
libmesos_tests.la \
libjournaldlogger.la
# Test (make check) binary for the LogSink module.
check_PROGRAMS += test-logsink
test_logsink_SOURCES = \
tests/logsink_tests.cpp
test_logsink_CPPFLAGS = \
$(libmesos_tests_la_CPPFLAGS)
test_logsink_LDADD = \
$(MESOS_LDFLAGS) \
$(MESOS_BUILD_DIR)/$(BUNDLE_SUBDIR)/.libs/libgmock.la \
$(MESOS_BUILD_DIR)/src/.libs/libmesos.la \
libmesos_tests.la \
liblogsink.la
# Test (make check) binary for the Metrics module.
check_PROGRAMS += test-metrics
test_metrics_SOURCES = \
tests/metrics_tests.cpp
test_metrics_CPPFLAGS = \
$(libmesos_tests_la_CPPFLAGS)
test_metrics_LDADD = \
$(MESOS_LDFLAGS) \
$(MESOS_BUILD_DIR)/$(BUNDLE_SUBDIR)/.libs/libgmock.la \
$(MESOS_BUILD_DIR)/src/.libs/libmesos.la \
libmesos_tests.la \
libmetrics-module.la
# Test (make check) binary for the overlay modules.
check_PROGRAMS += test-overlay
test_overlay_SOURCES = \
tests/overlay_tests.cpp
test_overlay_CPPFLAGS = \
$(libmesos_tests_la_CPPFLAGS)
test_overlay_LDADD = \
$(MESOS_LDFLAGS) \
$(MESOS_BUILD_DIR)/$(BUNDLE_SUBDIR)/.libs/libgmock.la \
$(MESOS_BUILD_DIR)/src/.libs/libmesos.la \
libmesos_tests.la \
libmesos_network_overlay.la
# Test (make check) binary for the common functions
check_PROGRAMS += test-common
test_common_SOURCES = \
tests/common_tests.cpp
test_common_CPPFLAGS = \
$(libmesos_tests_la_CPPFLAGS)
test_common_LDADD = \
$(MESOS_LDFLAGS) \
$(MESOS_BUILD_DIR)/$(BUNDLE_SUBDIR)/.libs/libgmock.la \
$(MESOS_BUILD_DIR)/src/.libs/libmesos.la \
libmesos_tests.la
endif
check-local: $(check_PROGRAMS)
./test-common --verbose
./test-dockercfg
./test-journald --verbose
./test-logsink --verbose
./test-metrics --verbose
LIBPROCESS_IP=127.0.0.1 LIBPROCESS_PORT=5050 ./test-overlay --verbose