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