build/autotools: make doxygen's input relative
[platform/upstream/libxkbcommon.git] / Makefile.am
1 ACLOCAL_AMFLAGS = -I m4 ${ACLOCAL_FLAGS}
2
3 pkgconfigdir = $(libdir)/pkgconfig
4 pkgconfig_DATA = xkbcommon.pc
5
6 EXTRA_DIST = \
7         scripts/makeheader \
8         scripts/makekeys \
9         scripts/update-keysyms \
10         scripts/update-keywords \
11         scripts/doxygen-wrapper \
12         src/xkbcomp/keywords.gperf \
13         test/data \
14         README.md \
15         doc/quick-guide.md \
16         doc/compat.md \
17         doc/keymap-format-text-v1.md \
18         doc/rules-format.txt \
19         doc/doxygen-extra.css \
20         xkbcommon.map \
21         xkbcommon-x11.map \
22         PACKAGING \
23         LICENSE \
24         meson.build \
25         meson_options.txt \
26         test/symbols-leak-test.bash
27
28 # The constants are added here instead of using AC_DEFINE_UNQUOTED
29 # because it does not expand variables recursively.
30 AM_CPPFLAGS = \
31         -DDFLT_XKB_CONFIG_ROOT='"$(XKBCONFIGROOT)"' \
32         -DXLOCALEDIR='"$(XLOCALEDIR)"' \
33         -I$(top_srcdir)/src \
34         -I$(top_builddir)/src/xkbcomp \
35         -include $(top_builddir)/src/config.h
36
37 AM_CFLAGS = $(BASE_CFLAGS)
38
39 AM_LDFLAGS = -no-undefined
40 if HAVE_NO_UNDEFINED
41 AM_LDFLAGS += -Wl,--no-undefined
42 endif
43
44 AM_YFLAGS = -d -p _xkbcommon_
45
46 xkbcommonincludedir = $(includedir)/xkbcommon
47 xkbcommoninclude_HEADERS = \
48         xkbcommon/xkbcommon.h \
49         xkbcommon/xkbcommon-compat.h \
50         xkbcommon/xkbcommon-compose.h \
51         xkbcommon/xkbcommon-keysyms.h \
52         xkbcommon/xkbcommon-names.h
53
54 lib_LTLIBRARIES = libxkbcommon.la
55 libxkbcommon_la_SOURCES = \
56         src/compose/parser.c \
57         src/compose/parser.h \
58         src/compose/paths.c \
59         src/compose/paths.h \
60         src/compose/state.c \
61         src/compose/table.c \
62         src/compose/table.h \
63         src/xkbcomp/action.c \
64         src/xkbcomp/action.h \
65         src/xkbcomp/ast.h \
66         src/xkbcomp/ast-build.c \
67         src/xkbcomp/ast-build.h \
68         src/xkbcomp/compat.c \
69         src/xkbcomp/expr.c \
70         src/xkbcomp/expr.h \
71         src/xkbcomp/include.c \
72         src/xkbcomp/include.h \
73         src/xkbcomp/keycodes.c \
74         src/xkbcomp/keymap.c \
75         src/xkbcomp/keymap-dump.c \
76         src/xkbcomp/keywords.c \
77         src/xkbcomp/parser.y \
78         src/xkbcomp/parser-priv.h \
79         src/xkbcomp/rules.c \
80         src/xkbcomp/rules.h \
81         src/xkbcomp/scanner.c \
82         src/xkbcomp/symbols.c \
83         src/xkbcomp/types.c \
84         src/xkbcomp/vmod.c \
85         src/xkbcomp/vmod.h \
86         src/xkbcomp/xkbcomp.c \
87         src/xkbcomp/xkbcomp-priv.h \
88         src/atom.c \
89         src/atom.h \
90         src/context.c \
91         src/context.h \
92         src/context-priv.c \
93         src/darray.h \
94         src/keysym.c \
95         src/keysym.h \
96         src/keysym-utf.c \
97         src/ks_tables.h \
98         src/keymap.c \
99         src/keymap.h \
100         src/keymap-priv.c \
101         src/scanner-utils.h \
102         src/state.c \
103         src/text.c \
104         src/text.h \
105         src/utf8.c \
106         src/utf8.h \
107         src/utils.c \
108         src/utils.h
109 if HAVE_VERSION_SCRIPT
110 libxkbcommon_la_LDFLAGS = -Wl,--version-script=${top_srcdir}/xkbcommon.map
111 endif HAVE_VERSION_SCRIPT
112
113 if ENABLE_X11
114 pkgconfig_DATA += xkbcommon-x11.pc
115
116 xkbcommon_x11includedir = $(xkbcommonincludedir)
117 xkbcommon_x11include_HEADERS = \
118         xkbcommon/xkbcommon-x11.h
119
120 lib_LTLIBRARIES += libxkbcommon-x11.la
121
122 libxkbcommon_x11_la_CFLAGS = $(AM_CFLAGS) $(XCB_XKB_CFLAGS)
123 libxkbcommon_x11_la_CPPFLAGS = $(AM_CPPFLAGS)
124 libxkbcommon_x11_la_LIBADD = libxkbcommon.la $(XCB_XKB_LIBS)
125 if HAVE_VERSION_SCRIPT
126 libxkbcommon_x11_la_LDFLAGS = -Wl,--version-script=${top_srcdir}/xkbcommon-x11.map
127 endif HAVE_VERSION_SCRIPT
128
129 libxkbcommon_x11_la_SOURCES = \
130         src/x11/keymap.c \
131         src/x11/state.c \
132         src/x11/util.c \
133         src/x11/x11-priv.h \
134         src/context.h \
135         src/context-priv.c \
136         src/keymap.h \
137         src/keymap-priv.c \
138         src/atom.h \
139         src/atom.c
140 endif ENABLE_X11
141
142 BUILT_SOURCES = \
143         src/xkbcomp/parser.c \
144         src/xkbcomp/parser.h
145 CLEANFILES = $(BUILT_SOURCES)
146
147 src/xkbcomp/parser.c: $(top_builddir)/src/$(am__dirstamp) $(top_builddir)/src/xkbcomp/$(am__dirstamp)
148 src/xkbcomp/parser.h: $(top_builddir)/src/$(am__dirstamp) $(top_builddir)/src/xkbcomp/$(am__dirstamp)
149
150 ##
151 # Documentation
152 ##
153
154 if ENABLE_DOCS
155 if HAVE_DOXYGEN
156 doxygen_input = \
157         README.md \
158         doc/quick-guide.md \
159         doc/compat.md \
160         xkbcommon/xkbcommon.h \
161         xkbcommon/xkbcommon-names.h \
162         xkbcommon/xkbcommon-x11.h \
163         xkbcommon/xkbcommon-compose.h
164
165 doc/html: doc/Doxyfile $(doxygen_input)
166         $(AM_V_GEN)(\
167             cat $<; \
168             echo "INPUT = $(doxygen_input)"; \
169             echo "OUTPUT_DIRECTORY = $(abs_top_builddir)/doc"; \
170         ) | $(top_srcdir)/scripts/doxygen-wrapper "$(DOXYGEN)" - "$(abs_top_srcdir)"
171 clean-doxygen:
172         rm -rf doc/html
173
174 doc: doc/html
175 clean-doc: clean-doxygen
176 all-local:: doc
177 clean-local:: clean-doc
178
179 install-data-local:: doc
180         $(MKDIR_P) $(DESTDIR)$(htmldir)
181         $(INSTALL_DATA) doc/html $(DESTDIR)$(htmldir)
182
183 uninstall-local::
184         rm -rf $(DESTDIR)$(htmldir)
185 endif HAVE_DOXYGEN
186 endif ENABLE_DOCS
187
188 ##
189 # Tests
190 ##
191
192 # Some tests need to use unexported symbols, so we link them against
193 # a private copy of libxkbcommon with all symbols exposed.
194 check_LTLIBRARIES = libtest.la
195 libtest_la_SOURCES = \
196         $(libxkbcommon_la_SOURCES) \
197         test/common.c \
198         test/test.h \
199         test/evdev-scancodes.h
200
201 AM_TESTS_ENVIRONMENT = \
202         XKB_LOG_LEVEL=debug; export XKB_LOG_LEVEL; \
203         XKB_LOG_VERBOSITY=10; export XKB_LOG_VERBOSITY; \
204         $(XORG_MALLOC_DEBUG_ENV) \
205         top_srcdir=$(top_srcdir)
206
207 build_run_tests = \
208         test/keysym \
209         test/keymap \
210         test/filecomp \
211         test/context \
212         test/rules-file \
213         test/stringcomp \
214         test/buffercomp \
215         test/log \
216         test/atom \
217         test/utf8 \
218         test/state \
219         test/keyseq \
220         test/rulescomp \
221         test/compose
222 build_only_tests = \
223         test/rmlvo-to-kccgst \
224         test/print-compiled-keymap
225 run_only_tests = \
226         test/symbols-leak-test.bash
227
228 TESTS_LDADD = libtest.la
229
230 test_keysym_LDADD = $(TESTS_LDADD)
231 test_keymap_LDADD = $(TESTS_LDADD)
232 test_filecomp_LDADD = $(TESTS_LDADD)
233 test_context_LDADD = $(TESTS_LDADD)
234 test_rules_file_CFLAGS = $(AM_CFLAGS) -Wno-declaration-after-statement
235 test_rules_file_LDADD = $(TESTS_LDADD)
236 test_stringcomp_LDADD = $(TESTS_LDADD)
237 test_buffercomp_LDADD = $(TESTS_LDADD)
238 test_log_LDADD = $(TESTS_LDADD)
239 test_atom_LDADD = $(TESTS_LDADD)
240 test_utf8_LDADD = $(TESTS_LDADD)
241 test_state_LDADD = $(TESTS_LDADD)
242 test_keyseq_LDADD = $(TESTS_LDADD)
243 test_rulescomp_LDADD = $(TESTS_LDADD)
244 test_rmlvo_to_kccgst_LDADD = $(TESTS_LDADD)
245 test_print_compiled_keymap_LDADD = $(TESTS_LDADD)
246 test_compose_LDADD = $(TESTS_LDADD) $(RT_LIBS)
247
248 if BUILD_LINUX_TESTS
249 build_only_tests += \
250         test/interactive-evdev
251
252 test_interactive_evdev_LDADD = $(TESTS_LDADD)
253 endif BUILD_LINUX_TESTS
254
255 if ENABLE_X11
256 build_run_tests += \
257         test/x11
258 # test/x11comp is meant to be run, but it is (temporarily?) disabled.
259 # See: https://github.com/xkbcommon/libxkbcommon/issues/30
260 build_only_tests += \
261         test/x11comp \
262         test/interactive-x11
263
264 TESTS_X11_LDADD = $(XCB_XKB_LIBS) $(TESTS_LDADD) libxkbcommon-x11.la
265 TESTS_X11_CFLAGS = $(XCB_XKB_CFLAGS)
266
267 test_x11_LDADD = $(TESTS_X11_LDADD)
268 test_x11_CFLAGS = $(TESTS_X11_CFLAGS)
269 test_x11comp_LDADD = $(TESTS_X11_LDADD)
270 test_x11comp_CFLAGS = $(TESTS_X11_CFLAGS)
271 test_interactive_x11_LDADD = $(TESTS_X11_LDADD)
272 test_interactive_x11_CFLAGS = $(TESTS_X11_CFLAGS)
273 endif ENABLE_X11
274
275 if ENABLE_WAYLAND
276 build_only_tests += \
277         test/interactive-wayland
278
279 TESTS_WAYLAND_LDADD = $(WAYLAND_LIBS) $(TESTS_LDADD)
280 TESTS_WAYLAND_CFLAGS = $(WAYLAND_CFLAGS)
281
282 .SECONDEXPANSION:
283
284 define protostability
285 $(if $(findstring unstable,$1),unstable,stable)
286 endef
287
288 define protoname
289 $(shell echo $1 | sed 's/\([a-z\-]\+\)-[a-z]\+-v[0-9]\+/\1/')
290 endef
291
292 %-protocol.c: $(WAYLAND_PROTOCOLS_DATADIR)/$$(call protostability,$$*)/$$(call protoname,$$*)/$$*.xml
293         $(AM_V_GEN)$(MKDIR_P) $(dir $@) && $(wayland_scanner) code < $< > $@
294 %-client-protocol.h: $(WAYLAND_PROTOCOLS_DATADIR)/$$(call protostability,$$*)/$$(call protoname,$$*)/$$*.xml
295         $(AM_V_GEN)$(MKDIR_P) $(dir $@) && $(wayland_scanner) client-header < $< > $@
296
297 INTERACTIVE_WL_XDG_SHELL_SRCS = \
298         xdg-shell-unstable-v6-protocol.c \
299         xdg-shell-unstable-v6-client-protocol.h
300
301 test_interactive_wayland_SOURCES = \
302         test/interactive-wayland.c \
303         $(INTERACTIVE_WL_XDG_SHELL_SRCS)
304 test_interactive_wayland_LDADD = $(TESTS_WAYLAND_LDADD)
305 test_interactive_wayland_CFLAGS = $(TESTS_WAYLAND_CFLAGS)
306
307 BUILT_SOURCES += \
308         $(INTERACTIVE_WL_XDG_SHELL_SRCS)
309 endif
310
311 check_PROGRAMS = $(build_run_tests) $(build_only_tests)
312 TESTS = $(build_run_tests) $(run_only_tests)
313
314 ##
315 # Benchmarks
316 ##
317 check_LTLIBRARIES += libbench.la
318 libbench_la_SOURCES = \
319         bench/bench.c \
320         bench/bench.h
321 BENCH_LDADD  = libbench.la
322 BENCH_LDADD += $(TESTS_LDADD) $(RT_LIBS)
323
324 check_PROGRAMS += \
325         bench/key-proc \
326         bench/rules \
327         bench/rulescomp \
328         bench/compose
329 bench_key_proc_LDADD = $(BENCH_LDADD)
330 bench_rules_LDADD = $(BENCH_LDADD)
331 bench_rulescomp_LDADD = $(BENCH_LDADD)
332 bench_compose_LDADD = $(BENCH_LDADD)