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