utils: add {un,}map_file to read an entire file
[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/keymap.c \
40         src/xkbcomp/keymap-dump.c \
41         src/xkbcomp/parser.y \
42         src/xkbcomp/parser-priv.h \
43         src/xkbcomp/rules.c \
44         src/xkbcomp/rules.h \
45         src/xkbcomp/scanner.l \
46         src/xkbcomp/scanner-utils.h \
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.c \
69         src/utils.h
70
71 BUILT_SOURCES = \
72         src/xkbcomp/parser.c \
73         src/xkbcomp/parser.h \
74         src/xkbcomp/scanner.c
75 CLEANFILES = $(BUILT_SOURCES)
76
77 src/xkbcomp/parser.c: $(top_builddir)/src/$(am__dirstamp) $(top_builddir)/src/xkbcomp/$(am__dirstamp)
78 src/xkbcomp/parser.h: $(top_builddir)/src/$(am__dirstamp) $(top_builddir)/src/xkbcomp/$(am__dirstamp)
79 src/xkbcomp/scanner.c: $(top_builddir)/src/$(am__dirstamp) $(top_builddir)/src/xkbcomp/$(am__dirstamp)
80
81 # Documentation
82
83 if ENABLE_DOCS
84 if HAVE_DOXYGEN
85 doc: doc/stamp-doxygen
86 clean-doc: clean-doxygen
87 all-local:: doc
88 clean-local:: clean-doc
89
90 doc/stamp-doxygen: $(top_srcdir)/xkbcommon/*.h
91         $(AM_V_GEN)$(DOXYGEN) doc/Doxyfile
92         touch $@
93
94 clean-doxygen:
95         rm -rf doc/html doc/stamp-doxygen
96
97 install-data-local:: doc
98         $(MKDIR_P) $(DESTDIR)$(htmldir)
99         $(INSTALL_DATA) doc/html/* $(DESTDIR)$(htmldir)
100
101 uninstall-local::
102         rm -rf $(DESTDIR)$(htmldir)
103
104 endif HAVE_DOXYGEN
105 endif ENABLE_DOCS
106
107 # Tests
108
109 # Some tests need to use unexported symbols, so we link them against
110 # a private copy of libxkbcommon with all symbols exposed.
111 noinst_LTLIBRARIES = libtest.la
112 libtest_la_LDFLAGS = $(libxkbcommon_la_LDFLAGS)
113 libtest_la_SOURCES = \
114         $(libxkbcommon_la_SOURCES) \
115         test/common.c \
116         test/test.h
117
118 AM_TESTS_ENVIRONMENT = \
119         XKB_LOG_LEVEL=debug; export XKB_LOG_LEVEL; \
120         XKB_LOG_VERBOSITY=10; export XKB_LOG_VERBOSITY; \
121         $(XORG_MALLOC_DEBUG_ENV)
122
123 TESTS = \
124         test/keysym \
125         test/filecomp \
126         test/context \
127         test/rules-file \
128         test/stringcomp \
129         test/buffercomp \
130         test/log
131 TESTS_LDADD = libtest.la
132
133 test_keysym_LDADD = $(TESTS_LDADD)
134 test_filecomp_LDADD = $(TESTS_LDADD)
135 test_rulescomp_LDADD = $(TESTS_LDADD) -lrt
136 test_context_LDADD = $(TESTS_LDADD)
137 test_rules_file_CFLAGS = $(AM_CFLAGS) -Wno-declaration-after-statement
138 test_rules_file_LDADD = $(TESTS_LDADD) -lrt
139 test_stringcomp_LDADD = $(TESTS_LDADD)
140 test_buffercomp_LDADD = $(TESTS_LDADD)
141 test_log_LDADD = $(TESTS_LDADD)
142 test_rmlvo_to_kccgst_LDADD = $(TESTS_LDADD)
143 test_print_compiled_keymap_LDADD = $(TESTS_LDADD)
144 test_bench_key_proc_LDADD = $(TESTS_LDADD) -lrt
145
146 check_PROGRAMS = \
147         $(TESTS) \
148         test/rmlvo-to-kccgst \
149         test/print-compiled-keymap \
150         test/bench-key-proc
151
152 if BUILD_LINUX_TESTS
153 TESTS += \
154         test/state \
155         test/keyseq \
156         test/rulescomp
157
158 test_keyseq_LDADD = $(TESTS_LDADD)
159 test_state_LDADD = $(TESTS_LDADD)
160 test_interactive_LDADD = $(TESTS_LDADD)
161
162 check_PROGRAMS += \
163         test/interactive
164
165 endif BUILD_LINUX_TESTS
166
167 EXTRA_DIST = \
168         test/data
169
170 # This sed script strips out lines that start with '#define _' which
171 # removes #define _OSF_Keysyms and such.  The XK_Ydiaeresis case is to
172 # handle a duplicate definition in HPkeysyms.h which kicks in if it's
173 # not already defined.
174
175 X11_INCLUDEDIR = /usr/include/X11
176 KEYSYMDEFS = \
177          $(X11_INCLUDEDIR)/keysymdef.h \
178          $(X11_INCLUDEDIR)/XF86keysym.h \
179          $(X11_INCLUDEDIR)/Sunkeysym.h \
180          $(X11_INCLUDEDIR)/DECkeysym.h \
181          $(X11_INCLUDEDIR)/HPkeysym.h
182 update-keysyms:
183         echo -en '#ifndef _XKBCOMMON_KEYSYMS_H\n#define _XKBCOMMON_KEYSYMS_H\n\n' > $(top_srcdir)/xkbcommon/xkbcommon-keysyms.h
184         echo -en '/* This file is autogenerated from Makefile.am; please do not commit directly. */\n\n' >> $(top_srcdir)/xkbcommon/xkbcommon-keysyms.h
185         echo -en '#define XKB_KEY_NoSymbol                    0x000000  /* Special KeySym */\n\n' >> $(top_srcdir)/xkbcommon/xkbcommon-keysyms.h
186         sed -e '/XK_Ydiaeresis\s*0x100000ee/d' \
187             -e '/#define _/d' \
188             -e 's/#define\s*\(\w*\)XK_/#define XKB_KEY_\1/' \
189             -e '/\(#ifdef\|#ifndef\|#endif\)/d' $(KEYSYMDEFS) >> $(top_srcdir)/xkbcommon/xkbcommon-keysyms.h
190         echo -en '\n\n#endif\n' >> $(top_srcdir)/xkbcommon/xkbcommon-keysyms.h
191         echo -en '/* This file is autogenerated from Makefile.am; please do not commit directly. */\n\n' > $(top_srcdir)/src/ks_tables.h
192         LC_CTYPE=C python $(top_srcdir)/makekeys.py $(top_srcdir)/xkbcommon/xkbcommon-keysyms.h >> $(top_srcdir)/src/ks_tables.h
193
194 # Android stuff
195
196 Android_build.mk: Makefile $(BUILT_SOURCES)
197         androgenizer \
198         -:PROJECT libxkbcommon \
199         -:REL_TOP $(top_srcdir) -:ABS_TOP $(abs_top_srcdir) \
200         \
201         -:STATIC libxkbcommon \
202         -:TAGS eng debug \
203         -:SOURCES $(filter-out %.l %.y,$(libxkbcommon_la_SOURCES)) $(BUILT_SOURCES) \
204         -:CFLAGS $(DEFS) $(DEFAULT_INCLUDES) $(AM_CPPFLAGS) $(AM_CFLAGS) \
205         -:LDFLAGS $(libxkbcommon_la_LDFLAGS) \
206         \
207         -:PASSTHROUGH 'libxkbcommon-clean: clean-libxkbcommon' \
208         > $@