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