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