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