4920262a3ef112c66c403100ab0674259edffcb6
[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         makekeys.py \
8         src/xkbcomp/keywords.gperf \
9         test/data \
10         README.md \
11         doc/quick-guide.md \
12         doc/keymap-format-text-v1.txt \
13         doc/rules-format.txt
14
15 AM_CPPFLAGS = \
16         -DDFLT_XKB_CONFIG_ROOT='"$(XKBCONFIGROOT)"' \
17         -I$(top_srcdir)/src \
18         -I$(top_srcdir)/src/xkbcomp \
19         -I$(top_builddir)/src/xkbcomp \
20         -include $(top_builddir)/src/config.h
21
22 AM_CFLAGS = $(BASE_CFLAGS)
23
24 AM_LDFLAGS = -no-undefined
25 if HAVE_NO_UNDEFINED
26 AM_LDFLAGS += -Wl,--no-undefined
27 endif
28
29 AM_YFLAGS = -d -p _xkbcommon_
30
31 xkbcommonincludedir = $(includedir)/xkbcommon
32 xkbcommoninclude_HEADERS = \
33         xkbcommon/xkbcommon.h \
34         xkbcommon/xkbcommon-compat.h \
35         xkbcommon/xkbcommon-keysyms.h \
36         xkbcommon/xkbcommon-names.h
37
38 lib_LTLIBRARIES = libxkbcommon.la
39 libxkbcommon_la_SOURCES = \
40         src/xkbcomp/action.c \
41         src/xkbcomp/action.h \
42         src/xkbcomp/ast.h \
43         src/xkbcomp/ast-build.c \
44         src/xkbcomp/ast-build.h \
45         src/xkbcomp/compat.c \
46         src/xkbcomp/expr.c \
47         src/xkbcomp/expr.h \
48         src/xkbcomp/include.c \
49         src/xkbcomp/include.h \
50         src/xkbcomp/keycodes.c \
51         src/xkbcomp/keymap.c \
52         src/xkbcomp/keymap-dump.c \
53         src/xkbcomp/keywords.c \
54         src/xkbcomp/parser.y \
55         src/xkbcomp/parser-priv.h \
56         src/xkbcomp/rules.c \
57         src/xkbcomp/rules.h \
58         src/xkbcomp/scanner.c \
59         src/xkbcomp/symbols.c \
60         src/xkbcomp/types.c \
61         src/xkbcomp/vmod.c \
62         src/xkbcomp/vmod.h \
63         src/xkbcomp/xkbcomp.c \
64         src/xkbcomp/xkbcomp-priv.h \
65         src/atom.c \
66         src/atom.h \
67         src/context.c \
68         src/context.h \
69         src/context-priv.c \
70         src/compat.c \
71         src/darray.h \
72         src/keysym.c \
73         src/keysym.h \
74         src/keysym-utf.c \
75         src/ks_tables.h \
76         src/keymap.c \
77         src/keymap.h \
78         src/keymap-priv.c \
79         src/scanner-utils.h \
80         src/state.c \
81         src/text.c \
82         src/text.h \
83         src/utf8.c \
84         src/utf8.h \
85         src/utils.c \
86         src/utils.h
87 libxkbcommon_la_LDFLAGS = -Wl,--version-script=${srcdir}/xkbcommon.map
88
89 if ENABLE_X11
90 pkgconfig_DATA += xkbcommon-x11.pc
91
92 xkbcommon_x11includedir = $(xkbcommonincludedir)
93 xkbcommon_x11include_HEADERS = \
94         xkbcommon/xkbcommon-x11.h
95
96 lib_LTLIBRARIES += libxkbcommon-x11.la
97
98 libxkbcommon_x11_la_CFLAGS = $(AM_CFLAGS) $(XCB_XKB_CFLAGS)
99 libxkbcommon_x11_la_CPPFLAGS = $(AM_CPPFLAGS) -I$(top_srcdir)/src/x11
100 libxkbcommon_x11_la_LIBADD = libxkbcommon.la $(XCB_XKB_LIBS)
101 libxkbcommon_x11_la_LDFLAGS = -Wl,--version-script=${srcdir}/xkbcommon-x11.map
102
103 libxkbcommon_x11_la_SOURCES = \
104         src/x11/keymap.c \
105         src/x11/state.c \
106         src/x11/util.c \
107         src/x11/x11-priv.h \
108         src/context.h \
109         src/context-priv.c \
110         src/keymap.h \
111         src/keymap-priv.c \
112         src/atom.h \
113         src/atom.c
114 endif ENABLE_X11
115
116 BUILT_SOURCES = \
117         src/xkbcomp/parser.c \
118         src/xkbcomp/parser.h
119 CLEANFILES = $(BUILT_SOURCES)
120
121 src/xkbcomp/parser.c: $(top_builddir)/src/$(am__dirstamp) $(top_builddir)/src/xkbcomp/$(am__dirstamp)
122 src/xkbcomp/parser.h: $(top_builddir)/src/$(am__dirstamp) $(top_builddir)/src/xkbcomp/$(am__dirstamp)
123
124 ##
125 # Documentation
126 ##
127
128 if ENABLE_DOCS
129 if HAVE_DOXYGEN
130 doc: doc/stamp-doxygen
131 clean-doc: clean-doxygen
132 all-local:: doc
133 clean-local:: clean-doc
134
135 doc/stamp-doxygen: $(top_srcdir)/xkbcommon/*.h
136         $(AM_V_GEN)$(DOXYGEN) doc/Doxyfile
137         touch $@
138
139 clean-doxygen:
140         rm -rf doc/html doc/stamp-doxygen
141
142 install-data-local:: doc
143         $(MKDIR_P) $(DESTDIR)$(htmldir)
144         $(INSTALL_DATA) doc/html/* $(DESTDIR)$(htmldir)
145
146 uninstall-local::
147         rm -rf $(DESTDIR)$(htmldir)
148 endif HAVE_DOXYGEN
149 endif ENABLE_DOCS
150
151 ##
152 # Tests
153 ##
154
155 # Some tests need to use unexported symbols, so we link them against
156 # a private copy of libxkbcommon with all symbols exposed.
157 check_LTLIBRARIES = libtest.la
158 libtest_la_CFLAGS = $(AM_CFLAGS) -fvisibility=default
159 libtest_la_SOURCES = \
160         $(libxkbcommon_la_SOURCES) \
161         test/common.c \
162         test/test.h \
163         test/evdev-scancodes.h
164
165 AM_TESTS_ENVIRONMENT = \
166         XKB_LOG_LEVEL=debug; export XKB_LOG_LEVEL; \
167         XKB_LOG_VERBOSITY=10; export XKB_LOG_VERBOSITY; \
168         $(XORG_MALLOC_DEBUG_ENV)
169
170 TESTS = \
171         test/keysym \
172         test/filecomp \
173         test/context \
174         test/rules-file \
175         test/stringcomp \
176         test/buffercomp \
177         test/log \
178         test/atom \
179         test/utf8 \
180         test/state \
181         test/keyseq \
182         test/rulescomp
183 check_PROGRAMS = \
184         test/rmlvo-to-kccgst \
185         test/print-compiled-keymap \
186         test/bench-key-proc
187
188 TESTS_LDADD = libtest.la
189
190 test_keysym_LDADD = $(TESTS_LDADD)
191 test_filecomp_LDADD = $(TESTS_LDADD)
192 test_context_LDADD = $(TESTS_LDADD)
193 test_rules_file_CFLAGS = $(AM_CFLAGS) -Wno-declaration-after-statement
194 test_rules_file_LDADD = $(TESTS_LDADD) -lrt
195 test_stringcomp_LDADD = $(TESTS_LDADD)
196 test_buffercomp_LDADD = $(TESTS_LDADD)
197 test_log_LDADD = $(TESTS_LDADD)
198 test_atom_LDADD = $(TESTS_LDADD)
199 test_utf8_LDADD = $(TESTS_LDADD)
200 test_state_LDADD = $(TESTS_LDADD)
201 test_keyseq_LDADD = $(TESTS_LDADD)
202 test_rulescomp_LDADD = $(TESTS_LDADD) -lrt
203 test_rmlvo_to_kccgst_LDADD = $(TESTS_LDADD)
204 test_print_compiled_keymap_LDADD = $(TESTS_LDADD)
205 test_bench_key_proc_LDADD = $(TESTS_LDADD) -lrt
206
207 if BUILD_LINUX_TESTS
208 check_PROGRAMS += \
209         test/interactive-evdev
210
211 test_interactive_evdev_LDADD = $(TESTS_LDADD)
212 endif BUILD_LINUX_TESTS
213
214 if ENABLE_X11
215 TESTS += \
216         test/x11 \
217         test/x11comp
218 check_PROGRAMS += \
219         test/interactive-x11
220
221 TESTS_X11_LDADD = $(XCB_XKB_LIBS) $(TESTS_LDADD) libxkbcommon-x11.la
222 TESTS_X11_CFLAGS = $(XCB_XKB_CFLAGS)
223
224 test_x11_LDADD = $(TESTS_X11_LDADD)
225 test_x11_CFLAGS = $(TESTS_X11_CFLAGS)
226 test_x11comp_LDADD = $(TESTS_X11_LDADD)
227 test_x11comp_CFLAGS = $(TESTS_X11_CFLAGS)
228 test_interactive_x11_LDADD = $(TESTS_X11_LDADD)
229 test_interactive_x11_CFLAGS = $(TESTS_X11_CFLAGS)
230 endif ENABLE_X11
231
232 check_PROGRAMS += $(TESTS)
233
234 ##
235 # Custom targets
236 ##
237
238 # This sed script strips out lines that start with '#define _' which
239 # removes #define _OSF_Keysyms and such.  The XK_Ydiaeresis case is to
240 # handle a duplicate definition in HPkeysyms.h which kicks in if it's
241 # not already defined.
242 X11_INCLUDEDIR = /usr/include/X11
243 KEYSYMDEFS = \
244          $(X11_INCLUDEDIR)/keysymdef.h \
245          $(X11_INCLUDEDIR)/XF86keysym.h \
246          $(X11_INCLUDEDIR)/Sunkeysym.h \
247          $(X11_INCLUDEDIR)/DECkeysym.h \
248          $(X11_INCLUDEDIR)/HPkeysym.h
249 update-keysyms:
250         echo -en '#ifndef _XKBCOMMON_KEYSYMS_H\n#define _XKBCOMMON_KEYSYMS_H\n\n' > $(top_srcdir)/xkbcommon/xkbcommon-keysyms.h
251         echo -en '/* This file is autogenerated from Makefile.am; please do not commit directly. */\n\n' >> $(top_srcdir)/xkbcommon/xkbcommon-keysyms.h
252         echo -en '#define XKB_KEY_NoSymbol                    0x000000  /* Special KeySym */\n\n' >> $(top_srcdir)/xkbcommon/xkbcommon-keysyms.h
253         sed -e '/XK_Ydiaeresis\s*0x100000ee/d' \
254             -e '/#define _/d' \
255             -e 's/#define\s*\(\w*\)XK_/#define XKB_KEY_\1/' \
256             -e '/\(#ifdef\|#ifndef\|#endif\)/d' $(KEYSYMDEFS) >> $(top_srcdir)/xkbcommon/xkbcommon-keysyms.h
257         echo -en '\n\n#endif\n' >> $(top_srcdir)/xkbcommon/xkbcommon-keysyms.h
258         LC_CTYPE=C python $(top_srcdir)/makekeys.py $(top_srcdir)/xkbcommon/xkbcommon-keysyms.h > $(top_srcdir)/src/ks_tables.h
259
260 # Run this if you add/remove a new keyword to the xkbcomp scanner,
261 # or just want to regenerate the gperf file.
262 update-keywords:
263         $(AM_V_GEN)gperf < $(top_srcdir)/src/xkbcomp/keywords.gperf > $(top_srcdir)/src/xkbcomp/keywords.c
264
265 ##
266 # Android stuff
267 ##
268
269 Android_build.mk: Makefile $(BUILT_SOURCES)
270         androgenizer \
271         -:PROJECT libxkbcommon \
272         -:REL_TOP $(top_srcdir) -:ABS_TOP $(abs_top_srcdir) \
273         \
274         -:STATIC libxkbcommon \
275         -:TAGS eng debug \
276         -:SOURCES $(filter-out %.l %.y,$(libxkbcommon_la_SOURCES)) $(BUILT_SOURCES) \
277         -:CFLAGS $(DEFS) $(DEFAULT_INCLUDES) $(AM_CPPFLAGS) $(AM_CFLAGS) \
278         -:LDFLAGS $(AM_LDFLAGS) \
279         \
280         -:PASSTHROUGH 'libxkbcommon-clean: clean-libxkbcommon' \
281         > $@