1 # Copyright 2010 Google Inc.
4 # Redistribution and use in source and binary forms, with or without
5 # modification, are permitted provided that the following conditions are
8 # * Redistributions of source code must retain the above copyright
9 # notice, this list of conditions and the following disclaimer.
10 # * Redistributions in binary form must reproduce the above copyright
11 # notice, this list of conditions and the following disclaimer in the
12 # documentation and/or other materials provided with the distribution.
13 # * Neither the name of Google Inc. nor the names of its contributors
14 # may be used to endorse or promote products derived from this software
15 # without specific prior written permission.
17 # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
18 # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
19 # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
20 # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
21 # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
22 # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
23 # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
24 # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
25 # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
27 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 ACLOCAL_AMFLAGS = -I m4
31 doc_DATA = AUTHORS COPYING NEWS README
32 noinst_DATA = INSTALL README
33 EXTRA_DIST = $(doc_DATA) INSTALL README
35 LUTOK_CFLAGS = -I$(srcdir)/include $(LUA_CFLAGS)
36 LUTOK_LIBS = liblutok.la $(LUA_LIBS)
38 pkginclude_HEADERS = c_gate.hpp
39 pkginclude_HEADERS += debug.hpp
40 pkginclude_HEADERS += exceptions.hpp
41 pkginclude_HEADERS += operations.hpp
42 pkginclude_HEADERS += stack_cleaner.hpp
43 pkginclude_HEADERS += state.hpp
44 pkginclude_HEADERS += state.ipp
45 pkginclude_HEADERS += test_utils.hpp
47 EXTRA_DIST += include/lutok/README
48 EXTRA_DIST += include/lutok/c_gate.hpp
49 EXTRA_DIST += include/lutok/debug.hpp
50 EXTRA_DIST += include/lutok/exceptions.hpp
51 EXTRA_DIST += include/lutok/operations.hpp
52 EXTRA_DIST += include/lutok/stack_cleaner.hpp
53 EXTRA_DIST += include/lutok/state.hpp
54 EXTRA_DIST += include/lutok/state.ipp
56 lib_LTLIBRARIES = liblutok.la
57 liblutok_la_SOURCES = c_gate.cpp
58 liblutok_la_SOURCES += c_gate.hpp
59 liblutok_la_SOURCES += debug.cpp
60 liblutok_la_SOURCES += debug.hpp
61 liblutok_la_SOURCES += exceptions.cpp
62 liblutok_la_SOURCES += exceptions.hpp
63 liblutok_la_SOURCES += operations.cpp
64 liblutok_la_SOURCES += operations.hpp
65 liblutok_la_SOURCES += stack_cleaner.cpp
66 liblutok_la_SOURCES += stack_cleaner.hpp
67 liblutok_la_SOURCES += state.cpp
68 liblutok_la_SOURCES += state.hpp
69 liblutok_la_SOURCES += state.ipp
70 liblutok_la_SOURCES += test_utils.hpp
71 liblutok_la_CPPFLAGS = $(LUTOK_CFLAGS)
72 liblutok_la_LDFLAGS = -version-info 3:0:0
73 liblutok_la_LIBADD = $(LUA_LIBS)
75 pkgconfig_DATA = lutok.pc
77 EXTRA_DIST += lutok.pc.in
78 lutok.pc: $(srcdir)/lutok.pc.in Makefile
79 $(AM_V_GEN)sed -e 's#__INCLUDEDIR__#$(includedir)#g' \
80 -e 's#__LIBDIR__#$(libdir)#g' \
81 -e 's#__LUA_CFLAGS__#$(LUA_CFLAGS)#g' \
82 -e 's#__LUA_LIBS__#$(LUA_LIBS)#g' \
83 -e 's#__VERSION__#$(PACKAGE_VERSION)#g' \
84 <$(srcdir)/lutok.pc.in >lutok.pc.tmp; \
85 mv lutok.pc.tmp lutok.pc
91 examplesdir = $(docdir)/examples
92 examples_DATA = examples/Makefile
93 examples_DATA += examples/bindings.cpp
94 examples_DATA += examples/hello.cpp
95 examples_DATA += examples/interpreter.cpp
96 examples_DATA += examples/raii.cpp
97 EXTRA_DIST += $(examples_DATA)
100 tests_DATA = Kyuafile
101 EXTRA_DIST += $(tests_DATA)
103 tests_PROGRAMS = c_gate_test
104 c_gate_test_SOURCES = c_gate_test.cpp test_utils.hpp
105 c_gate_test_CXXFLAGS = $(LUTOK_CFLAGS) $(ATF_CXX_CFLAGS)
106 c_gate_test_LDADD = $(LUTOK_LIBS) $(ATF_CXX_LIBS)
108 tests_PROGRAMS += debug_test
109 debug_test_SOURCES = debug_test.cpp test_utils.hpp
110 debug_test_CXXFLAGS = $(LUTOK_CFLAGS) $(ATF_CXX_CFLAGS)
111 debug_test_LDADD = $(LUTOK_LIBS) $(ATF_CXX_LIBS)
113 tests_SCRIPTS = examples_test
114 CLEANFILES += examples_test
115 EXTRA_DIST += examples_test.sh
116 examples_test: $(srcdir)/examples_test.sh
117 $(AM_V_GEN)sed -e 's,__ATF_SH__,$(ATF_SH),g' \
118 -e 's,__CXX__,$(CXX),g' \
119 -e 's,__EXAMPLESDIR__,$(examplesdir),g' \
120 -e 's,__LIBDIR__,$(libdir),g' \
121 <$(srcdir)/examples_test.sh >examples_test.tmp; \
122 chmod +x examples_test.tmp; \
123 rm -f examples_test; \
124 mv examples_test.tmp examples_test
126 tests_PROGRAMS += exceptions_test
127 exceptions_test_SOURCES = exceptions_test.cpp
128 exceptions_test_CXXFLAGS = $(LUTOK_CFLAGS) $(ATF_CXX_CFLAGS)
129 exceptions_test_LDADD = $(LUTOK_LIBS) $(ATF_CXX_LIBS)
131 tests_PROGRAMS += operations_test
132 operations_test_SOURCES = operations_test.cpp test_utils.hpp
133 operations_test_CXXFLAGS = $(LUTOK_CFLAGS) $(ATF_CXX_CFLAGS)
134 operations_test_LDADD = $(LUTOK_LIBS) $(ATF_CXX_LIBS)
136 tests_PROGRAMS += stack_cleaner_test
137 stack_cleaner_test_SOURCES = stack_cleaner_test.cpp test_utils.hpp
138 stack_cleaner_test_CXXFLAGS = $(LUTOK_CFLAGS) $(ATF_CXX_CFLAGS)
139 stack_cleaner_test_LDADD = $(LUTOK_LIBS) $(ATF_CXX_LIBS)
141 tests_PROGRAMS += state_test
142 state_test_SOURCES = state_test.cpp test_utils.hpp
143 state_test_CXXFLAGS = $(LUTOK_CFLAGS) $(ATF_CXX_CFLAGS)
144 state_test_LDADD = $(LUTOK_LIBS) $(ATF_CXX_LIBS)
147 check-local: check-kyua
148 PHONY_TARGETS += check-kyua
150 $(TESTS_ENVIRONMENT) kyua test \
151 --kyuafile='$(top_srcdir)/Kyuafile' --build-root='$(top_builddir)'
153 installcheck-local: installcheck-kyua
154 PHONY_TARGETS += installcheck-kyua
156 cd $(testsdir) && $(TESTS_ENVIRONMENT) kyua test
159 DIST_HOOKS += dist-no-atf
160 PHONY_TARGETS += dist-no-atf
162 @echo "Sorry; cannot build a distfile without atf"
167 # This should probably be html-local, but it seems better to generate the
168 # documentation in all cases to get warnings about missing documentation every
169 # time the code is modified. (And, after all, the documentation is not
170 # installed so generating it unconditionally is not a big problem.)
171 all-local: api-docs/api-docs.tag
173 api-docs/api-docs.tag: $(builddir)/Doxyfile $(SOURCES)
174 $(AM_V_GEN)rm -rf api-docs; \
176 ${DOXYGEN} $(builddir)/Doxyfile 2>&1 | tee api-docs/warnings; \
177 rm -f api-docs/html/installdox
178 api-docs/html: api-docs/api-docs.tag
180 CLEAN_TARGETS += clean-api-docs
184 EXTRA_DIST += api-docs/html
186 DIST_HOOKS += dist-no-doxygen
187 PHONY_TARGETS += dist-no-doxygen
189 @echo "Sorry; cannot build a distfile without Doxygen"
193 install-data-local: install-api-docs
194 install-api-docs: install-docDATA
195 @echo "Installing HTML documentation into $(DESTDIR)$(htmldir)"
196 @if [ -d api-docs/html ]; then \
197 test -z "$(htmldir)" || $(MKDIR_P) "$(DESTDIR)$(htmldir)"; \
198 ( cd api-docs/html && tar cf - . ) | \
199 ( cd "$(DESTDIR)$(htmldir)" && tar xf - ); \
200 elif [ -d "$(srcdir)/api-docs/html" ]; then \
201 test -z "$(htmldir)" || $(MKDIR_P) "$(DESTDIR)$(htmldir)"; \
202 ( cd "$(srcdir)/api-docs/html" && tar cf - . ) | \
203 ( cd "$(DESTDIR)$(htmldir)" && tar xf - ); \
205 echo "Doxygen not installed and prebuilt documents not found"; \
208 uninstall-local: uninstall-api-docs
210 find "$(DESTDIR)$(htmldir)" -type d -exec chmod 755 {} \;
211 rm -rf "$(DESTDIR)$(htmldir)"
213 clean-local: $(CLEAN_TARGETS)
215 PHONY_TARGETS += clean-all
217 GIT="$(GIT)" $(SH) $(srcdir)/admin/clean-all.sh
219 dist-hook: $(DIST_HOOKS)
221 .PHONY: ${PHONY_TARGETS}