-
Notifications
You must be signed in to change notification settings - Fork 18
Expand file tree
/
Copy pathMakefile.am
More file actions
296 lines (255 loc) · 9.83 KB
/
Copy pathMakefile.am
File metadata and controls
296 lines (255 loc) · 9.83 KB
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
# Copyright 2010 Google Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
# * Neither the name of Google Inc. nor the names of its contributors
# may be used to endorse or promote products derived from this software
# without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
CODE_COVERAGE_DIRS =
#
# Supporting logic to run our custom testsuite.
#
TESTS_ENVIRONMENT = PKG_CONFIG_PATH=$(prefix)/lib/pkgconfig
if HAVE_ASAN
# NB: the trailing comma is intentional. I hate automake not allowing `:=` use on subsequent lines.
if HAVE_LSAN
LSAN_OPTIONS = detect_leaks=1,
else
LSAN_OPTIONS =
endif
# Some of the testcases trigger false positives as they pass
# `SIZE_MAX - 1`, etc, to malloc(3).
ASAN_OPTIONS = ${LSAN_OPTIONS}allocator_may_return_null=1
TESTS_ENVIRONMENT+= ASAN_OPTIONS=${ASAN_OPTIONS}
endif
if HAVE_UBSAN
TESTS_ENVIRONMENT+= UBSAN_OPTIONS=print_stacktrace=1:halt_on_error=1
endif
ACLOCAL_AMFLAGS = -I m4
doc_DATA = AUTHORS COPYING NEWS README.md
noinst_DATA = INSTALL.md README.md
EXTRA_DIST = $(doc_DATA) INSTALL.md README.md
LUTOK_CFLAGS = -I$(srcdir)/include $(LUA_CFLAGS)
LUTOK_LIBS = liblutok.la $(LUA_LIBS)
pkginclude_HEADERS = c_gate.hpp
pkginclude_HEADERS += debug.hpp
pkginclude_HEADERS += exceptions.hpp
pkginclude_HEADERS += operations.hpp
pkginclude_HEADERS += stack_cleaner.hpp
pkginclude_HEADERS += state.hpp
pkginclude_HEADERS += state.ipp
pkginclude_HEADERS += test_utils.hpp
EXTRA_DIST += include/lutok/README
EXTRA_DIST += include/lutok/c_gate.hpp
EXTRA_DIST += include/lutok/debug.hpp
EXTRA_DIST += include/lutok/exceptions.hpp
EXTRA_DIST += include/lutok/operations.hpp
EXTRA_DIST += include/lutok/stack_cleaner.hpp
EXTRA_DIST += include/lutok/state.hpp
EXTRA_DIST += include/lutok/state.ipp
lib_LTLIBRARIES = liblutok.la
liblutok_la_SOURCES = c_gate.cpp
liblutok_la_SOURCES += c_gate.hpp
liblutok_la_SOURCES += debug.cpp
liblutok_la_SOURCES += debug.hpp
liblutok_la_SOURCES += exceptions.cpp
liblutok_la_SOURCES += exceptions.hpp
liblutok_la_SOURCES += operations.cpp
liblutok_la_SOURCES += operations.hpp
liblutok_la_SOURCES += stack_cleaner.cpp
liblutok_la_SOURCES += stack_cleaner.hpp
liblutok_la_SOURCES += state.cpp
liblutok_la_SOURCES += state.hpp
liblutok_la_SOURCES += state.ipp
liblutok_la_SOURCES += test_utils.hpp
liblutok_la_CPPFLAGS = $(LUTOK_CFLAGS)
liblutok_la_LDFLAGS = -version-info 3:0:0
liblutok_la_LIBADD = $(LUA_LIBS)
pkgconfig_DATA = lutok.pc
CLEANFILES = lutok.pc
EXTRA_DIST += lutok.pc.in
lutok.pc: $(srcdir)/lutok.pc.in Makefile
$(AM_V_GEN)sed -e 's#__INCLUDEDIR__#$(includedir)#g' \
-e 's#__LIBDIR__#$(libdir)#g' \
-e 's#__LUA_CFLAGS__#$(LUA_CFLAGS)#g' \
-e 's#__LUA_LIBS__#$(LUA_LIBS)#g' \
-e 's#__PC_CXXFLAGS__#$(pc_cxxflags)#g' \
-e 's#__PC_LDFLAGS__#$(pc_ldflags)#g' \
-e 's#__VERSION__#$(PACKAGE_VERSION)#g' \
<$(srcdir)/lutok.pc.in >lutok.pc.tmp; \
mv lutok.pc.tmp lutok.pc
CLEAN_TARGETS =
DIST_HOOKS =
PHONY_TARGETS =
examplesdir = $(docdir)/examples
examples_DATA = examples/Makefile
examples_DATA += examples/bindings.cpp
examples_DATA += examples/hello.cpp
examples_DATA += examples/interpreter.cpp
examples_DATA += examples/raii.cpp
EXTRA_DIST += $(examples_DATA)
if WITH_ATF
tests_DATA = Kyuafile
EXTRA_DIST += $(tests_DATA)
tests_PROGRAMS = c_gate_test
c_gate_test_SOURCES = c_gate_test.cpp test_utils.hpp
c_gate_test_CXXFLAGS = $(LUTOK_CFLAGS) $(ATF_CXX_CFLAGS)
c_gate_test_LDADD = $(LUTOK_LIBS) $(ATF_CXX_LIBS)
tests_PROGRAMS += debug_test
debug_test_SOURCES = debug_test.cpp test_utils.hpp
debug_test_CXXFLAGS = $(LUTOK_CFLAGS) $(ATF_CXX_CFLAGS)
debug_test_LDADD = $(LUTOK_LIBS) $(ATF_CXX_LIBS)
tests_SCRIPTS = examples_test
CLEANFILES += examples_test
EXTRA_DIST += examples_test.sh
examples_test: $(srcdir)/examples_test.sh
$(AM_V_GEN)sed -e 's,__ATF_SH__,$(ATF_SH),g' \
-e 's,__CXX__,$(CXX),g' \
-e 's,__EXAMPLESDIR__,$(examplesdir),g' \
-e 's,__LIBDIR__,$(libdir),g' \
<$(srcdir)/examples_test.sh >examples_test.tmp; \
chmod +x examples_test.tmp; \
rm -f examples_test; \
mv examples_test.tmp examples_test
tests_PROGRAMS += exceptions_test
exceptions_test_SOURCES = exceptions_test.cpp
exceptions_test_CXXFLAGS = $(LUTOK_CFLAGS) $(ATF_CXX_CFLAGS)
exceptions_test_LDADD = $(LUTOK_LIBS) $(ATF_CXX_LIBS)
tests_PROGRAMS += operations_test
operations_test_SOURCES = operations_test.cpp test_utils.hpp
operations_test_CXXFLAGS = $(LUTOK_CFLAGS) $(ATF_CXX_CFLAGS)
operations_test_LDADD = $(LUTOK_LIBS) $(ATF_CXX_LIBS)
tests_PROGRAMS += stack_cleaner_test
stack_cleaner_test_SOURCES = stack_cleaner_test.cpp test_utils.hpp
stack_cleaner_test_CXXFLAGS = $(LUTOK_CFLAGS) $(ATF_CXX_CFLAGS)
stack_cleaner_test_LDADD = $(LUTOK_LIBS) $(ATF_CXX_LIBS)
tests_PROGRAMS += state_test
state_test_SOURCES = state_test.cpp test_utils.hpp
state_test_CXXFLAGS = $(LUTOK_CFLAGS) $(ATF_CXX_CFLAGS)
state_test_LDADD = $(LUTOK_LIBS) $(ATF_CXX_LIBS)
check-local: check-kyua
PHONY_TARGETS += check-kyua
check-kyua:
$(TESTS_ENVIRONMENT) kyua test \
--kyuafile='$(top_srcdir)/Kyuafile' --build-root='$(top_builddir)'
INSTALLCHECK_TARGETS =
testsdir = $(exec_prefix)/tests/$(PACKAGE)
installcheck-local: installcheck-kyua
PHONY_TARGETS += installcheck-kyua
if HAVE_KYUA
INSTALLCHECK_TARGETS += installcheck-kyua
installcheck-kyua:
set +e; cd $(testsdir) && $(TESTS_ENVIRONMENT) \
$(KYUA) --config='$(KYUA_TEST_CONFIG_FILE)' test; \
ret=$$?; \
echo $$ret; \
if [ -n "$$JUNIT_OUTPUT" ]; then \
cd $(testsdir) && $(TESTS_ENVIRONMENT) \
$(KYUA) --config='$(KYUA_TEST_CONFIG_FILE)' \
report-junit --output="$$JUNIT_OUTPUT"; \
sed -i '.orig' 's/encoding="iso-8859-1"/encoding="utf-8"/' "$$JUNIT_OUTPUT"; \
rm -f "$$JUNIT_OUTPUT.orig"; \
fi; \
cd $(testsdir) && $(TESTS_ENVIRONMENT) \
$(KYUA) --config='$(KYUA_TEST_CONFIG_FILE)' report --verbose; \
exit $$ret
if CODE_COVERAGE
CODE_COVERAGE_EXCLUDES = '/usr/include/*' '/usr/local/include/*'
CODE_COVERAGE_OUTPUT_DIR ?= code_coverage
EXTRA_GENHTML_ARGS ?=
INSTALLCHECK_TARGETS+= installcheck-kyua-lcov
installcheck-kyua-lcov: installcheck-kyua
mkdir -p $(CODE_COVERAGE_OUTPUT_DIR)/html
$(LCOV) --capture --directory $(srcdir) \
--output-file $(CODE_COVERAGE_OUTPUT_DIR)/lcov.info
$(LCOV) --remove $(CODE_COVERAGE_OUTPUT_DIR)/lcov.info \
$(CODE_COVERAGE_EXCLUDES) \
--output-file $(CODE_COVERAGE_OUTPUT_DIR)/lcov-filtered.info
$(GENHTML) -o $(CODE_COVERAGE_OUTPUT_DIR)/html $(EXTRA_GENHTML_ARGS) \
$(CODE_COVERAGE_OUTPUT_DIR)/lcov-filtered.info
endif
endif
else
DIST_HOOKS += dist-no-atf
PHONY_TARGETS += dist-no-atf
dist-no-atf:
@echo "Sorry; cannot build a distfile without atf"
@false
endif
if CODE_COVERAGE
PHONY_TARGETS += mostlyclean-code-coverage
mostlyclean-local: mostlyclean-code-coverage
mostlyclean-code-coverage:
-for dir in $(CODE_COVERAGE_DIRS); do \
find $$dir \( -name \*.gcda -or -name \*.gcno \) -delete -print; \
done
endif
installcheck-local: $(INSTALLCHECK_TARGETS)
if WITH_DOXYGEN
# This should probably be html-local, but it seems better to generate the
# documentation in all cases to get warnings about missing documentation every
# time the code is modified. (And, after all, the documentation is not
# installed so generating it unconditionally is not a big problem.)
all-local: api-docs/api-docs.tag
api-docs/api-docs.tag: $(builddir)/Doxyfile $(SOURCES)
$(AM_V_GEN)rm -rf api-docs; \
mkdir -p api-docs; \
${DOXYGEN} $(builddir)/Doxyfile 2>&1 | tee api-docs/warnings; \
rm -f api-docs/html/installdox
api-docs/html: api-docs/api-docs.tag
CLEAN_TARGETS += clean-api-docs
clean-api-docs:
rm -rf api-docs
EXTRA_DIST += api-docs/html
else
DIST_HOOKS += dist-no-doxygen
PHONY_TARGETS += dist-no-doxygen
dist-no-doxygen:
@echo "Sorry; cannot build a distfile without Doxygen"
@false
endif
install-data-local: install-api-docs
install-api-docs: install-docDATA
@echo "Installing HTML documentation into $(DESTDIR)$(htmldir)"
@if [ -d api-docs/html ]; then \
test -z "$(htmldir)" || $(MKDIR_P) "$(DESTDIR)$(htmldir)"; \
( cd api-docs/html && tar cf - . ) | \
( cd "$(DESTDIR)$(htmldir)" && tar xf - ); \
elif [ -d "$(srcdir)/api-docs/html" ]; then \
test -z "$(htmldir)" || $(MKDIR_P) "$(DESTDIR)$(htmldir)"; \
( cd "$(srcdir)/api-docs/html" && tar cf - . ) | \
( cd "$(DESTDIR)$(htmldir)" && tar xf - ); \
else \
echo "Doxygen not installed and prebuilt documents not found"; \
fi
uninstall-local: uninstall-api-docs
uninstall-api-docs:
find "$(DESTDIR)$(htmldir)" -type d -exec chmod 755 {} \;
rm -rf "$(DESTDIR)$(htmldir)"
clean-local: $(CLEAN_TARGETS)
PHONY_TARGETS += clean-all
clean-all:
GIT="$(GIT)" $(SH) $(srcdir)/admin/clean-all.sh
dist-hook: $(DIST_HOOKS)
.PHONY: $(PHONY_TARGETS)
# vim: syntax=make:noexpandtab:shiftwidth=8:softtabstop=8