libxkbcommon/Makefile.am

349 lines
8.7 KiB
Makefile
Raw Normal View History

ACLOCAL_AMFLAGS = -I m4 ${ACLOCAL_FLAGS}
2009-04-01 07:22:06 -06:00
pkgconfigdir = $(libdir)/pkgconfig
pkgconfig_DATA = xkbcommon.pc
EXTRA_DIST = \
makekeys.py \
makeheader.py \
src/xkbcomp/keywords.gperf \
test/data \
README.md \
doc/quick-guide.md \
doc/compat.md \
doc/keymap-format-text-v1.md \
doc/rules-format.txt \
doc/doxygen-extra.css \
xkbcommon.map \
xkbcommon-x11.map \
PACKAGING \
LICENSE \
test/symbols-leak-test.bash
# The constants are added here instead of using AC_DEFINE_UNQUOTED
# because it does not expand variables recursively.
AM_CPPFLAGS = \
-DDFLT_XKB_CONFIG_ROOT='"$(XKBCONFIGROOT)"' \
-DXLOCALEDIR='"$(XLOCALEDIR)"' \
-I$(top_srcdir)/src \
-include $(top_builddir)/src/config.h
AM_CFLAGS = $(BASE_CFLAGS)
AM_LDFLAGS = -no-undefined
if HAVE_NO_UNDEFINED
AM_LDFLAGS += -Wl,--no-undefined
endif
AM_YFLAGS = -d -p _xkbcommon_
xkbcommonincludedir = $(includedir)/xkbcommon
xkbcommoninclude_HEADERS = \
xkbcommon/xkbcommon.h \
xkbcommon/xkbcommon-compat.h \
xkbcommon/xkbcommon-compose.h \
xkbcommon/xkbcommon-keysyms.h \
xkbcommon/xkbcommon-names.h
lib_LTLIBRARIES = libxkbcommon.la
libxkbcommon_la_SOURCES = \
src/compose/parser.c \
src/compose/parser.h \
src/compose/paths.c \
src/compose/paths.h \
src/compose/state.c \
src/compose/table.c \
src/compose/table.h \
src/xkbcomp/action.c \
src/xkbcomp/action.h \
src/xkbcomp/ast.h \
src/xkbcomp/ast-build.c \
src/xkbcomp/ast-build.h \
src/xkbcomp/compat.c \
src/xkbcomp/expr.c \
src/xkbcomp/expr.h \
src/xkbcomp/include.c \
src/xkbcomp/include.h \
src/xkbcomp/keycodes.c \
src/xkbcomp/keymap.c \
src/xkbcomp/keymap-dump.c \
src/xkbcomp/keywords.c \
src/xkbcomp/parser.y \
src/xkbcomp/parser-priv.h \
src/xkbcomp/rules.c \
src/xkbcomp/rules.h \
src/xkbcomp/scanner.c \
src/xkbcomp/symbols.c \
src/xkbcomp/types.c \
src/xkbcomp/vmod.c \
src/xkbcomp/vmod.h \
src/xkbcomp/xkbcomp.c \
src/xkbcomp/xkbcomp-priv.h \
src/atom.c \
src/atom.h \
src/context.c \
src/context.h \
src/context-priv.c \
src/darray.h \
src/keysym.c \
src/keysym.h \
src/keysym-utf.c \
src/ks_tables.h \
src/keymap.c \
src/keymap.h \
src/keymap-priv.c \
src/scanner-utils.h \
src/state.c \
src/text.c \
src/text.h \
src/utf8.c \
src/utf8.h \
src/utils.c \
src/utils.h
if HAVE_VERSION_SCRIPT
libxkbcommon_la_LDFLAGS = -Wl,--version-script=${srcdir}/xkbcommon.map
endif HAVE_VERSION_SCRIPT
if ENABLE_X11
pkgconfig_DATA += xkbcommon-x11.pc
xkbcommon_x11includedir = $(xkbcommonincludedir)
xkbcommon_x11include_HEADERS = \
xkbcommon/xkbcommon-x11.h
lib_LTLIBRARIES += libxkbcommon-x11.la
libxkbcommon_x11_la_CFLAGS = $(AM_CFLAGS) $(XCB_XKB_CFLAGS)
libxkbcommon_x11_la_CPPFLAGS = $(AM_CPPFLAGS)
libxkbcommon_x11_la_LIBADD = libxkbcommon.la $(XCB_XKB_LIBS)
if HAVE_VERSION_SCRIPT
libxkbcommon_x11_la_LDFLAGS = -Wl,--version-script=${srcdir}/xkbcommon-x11.map
endif HAVE_VERSION_SCRIPT
libxkbcommon_x11_la_SOURCES = \
src/x11/keymap.c \
src/x11/state.c \
src/x11/util.c \
src/x11/x11-priv.h \
src/context.h \
src/context-priv.c \
src/keymap.h \
src/keymap-priv.c \
src/atom.h \
src/atom.c
endif ENABLE_X11
BUILT_SOURCES = \
src/xkbcomp/parser.c \
src/xkbcomp/parser.h
CLEANFILES = $(BUILT_SOURCES)
src/xkbcomp/parser.c: $(top_builddir)/src/$(am__dirstamp) $(top_builddir)/src/xkbcomp/$(am__dirstamp)
src/xkbcomp/parser.h: $(top_builddir)/src/$(am__dirstamp) $(top_builddir)/src/xkbcomp/$(am__dirstamp)
##
# Documentation
##
if ENABLE_DOCS
if HAVE_DOXYGEN
doc: doc/stamp-doxygen
clean-doc: clean-doxygen
all-local:: doc
clean-local:: clean-doc
doc/stamp-doxygen: $(top_srcdir)/xkbcommon/*.h
$(AM_V_GEN)(cd $(top_srcdir) && $(DOXYGEN) $(abs_top_builddir)/doc/Doxyfile)
touch $@
clean-doxygen:
rm -rf doc/html doc/stamp-doxygen
install-data-local:: doc
$(MKDIR_P) $(DESTDIR)$(htmldir)
$(INSTALL_DATA) doc/html/* $(DESTDIR)$(htmldir)
uninstall-local::
rm -rf $(DESTDIR)$(htmldir)
endif HAVE_DOXYGEN
endif ENABLE_DOCS
##
# Tests
##
# Some tests need to use unexported symbols, so we link them against
# a private copy of libxkbcommon with all symbols exposed.
check_LTLIBRARIES = libtest.la
libtest_la_SOURCES = \
$(libxkbcommon_la_SOURCES) \
test/common.c \
test/test.h \
test/evdev-scancodes.h
AM_TESTS_ENVIRONMENT = \
XKB_LOG_LEVEL=debug; export XKB_LOG_LEVEL; \
XKB_LOG_VERBOSITY=10; export XKB_LOG_VERBOSITY; \
$(XORG_MALLOC_DEBUG_ENV) \
top_srcdir=$(top_srcdir)
build_run_tests = \
test/keysym \
test/keymap \
test/filecomp \
test/context \
test/rules-file \
test/stringcomp \
keymap: add xkb_keymap_new_from_buffer() The current API doesn't allow the caller to create keymaps from mmap()'ed files. The problem is, xkb_keymap_new_from_string() requires a terminating 0 byte. However, there is no way to guarantee that when using mmap() so a user currently has to copy the whole file just to get the terminating zero byte (assuming they cannot use xkb_keymap_new_from_file()). This adds a new entry xkb_keymap_new_from_buffer() which takes a memory location and the buffer size in bytes. Internally, we depend on yy_scan_{string,byte}() helpers. According to flex documentation these already copy the input string because they are wrappers around yy_scan_buffer(). yy_scan_buffer() on the other hand has some insane requirements. The buffer must be writeable and the last two bytes must be ASCII-NUL. But the buffer may contain other 0 bytes just fine. Because we don't want these constraints in our public API, xkb_keymap_new_from_buffer() needs to create a copy of the input memory. But it then calls yy_scan_buffer() directly. Hence, we have the same number of buffer-copies as with *_from_string() but without the terminating 0 requirement. The explicit yy_scan_buffer() call is preferred over yy_scan_byte() so the buffer-copy operation is not hidden somewhere in flex. Maybe some day we no longer depend on flex and can have a zero-copy API. A user could mmap() a file and it would get parsed right from this buffer. But until then, we shouldn't expose this limitation in the API but instead provide an API that some day can work with zero-copy. Signed-off-by: David Herrmann <dh.herrmann@gmail.com> [ran: rebased on top of my branch] Conflicts: Makefile.am src/xkbcomp/xkbcomp.c
2013-03-11 05:53:39 -06:00
test/buffercomp \
test/log \
test/atom \
test/utf8 \
test/state \
test/keyseq \
test/rulescomp \
test/compose
build_only_tests = \
test/rmlvo-to-kccgst \
test/print-compiled-keymap
run_only_tests = \
test/symbols-leak-test.bash
TESTS_LDADD = libtest.la
test_keysym_LDADD = $(TESTS_LDADD)
test_keymap_LDADD = $(TESTS_LDADD)
test_filecomp_LDADD = $(TESTS_LDADD)
test_context_LDADD = $(TESTS_LDADD)
test_rules_file_CFLAGS = $(AM_CFLAGS) -Wno-declaration-after-statement
test_rules_file_LDADD = $(TESTS_LDADD)
test_stringcomp_LDADD = $(TESTS_LDADD)
keymap: add xkb_keymap_new_from_buffer() The current API doesn't allow the caller to create keymaps from mmap()'ed files. The problem is, xkb_keymap_new_from_string() requires a terminating 0 byte. However, there is no way to guarantee that when using mmap() so a user currently has to copy the whole file just to get the terminating zero byte (assuming they cannot use xkb_keymap_new_from_file()). This adds a new entry xkb_keymap_new_from_buffer() which takes a memory location and the buffer size in bytes. Internally, we depend on yy_scan_{string,byte}() helpers. According to flex documentation these already copy the input string because they are wrappers around yy_scan_buffer(). yy_scan_buffer() on the other hand has some insane requirements. The buffer must be writeable and the last two bytes must be ASCII-NUL. But the buffer may contain other 0 bytes just fine. Because we don't want these constraints in our public API, xkb_keymap_new_from_buffer() needs to create a copy of the input memory. But it then calls yy_scan_buffer() directly. Hence, we have the same number of buffer-copies as with *_from_string() but without the terminating 0 requirement. The explicit yy_scan_buffer() call is preferred over yy_scan_byte() so the buffer-copy operation is not hidden somewhere in flex. Maybe some day we no longer depend on flex and can have a zero-copy API. A user could mmap() a file and it would get parsed right from this buffer. But until then, we shouldn't expose this limitation in the API but instead provide an API that some day can work with zero-copy. Signed-off-by: David Herrmann <dh.herrmann@gmail.com> [ran: rebased on top of my branch] Conflicts: Makefile.am src/xkbcomp/xkbcomp.c
2013-03-11 05:53:39 -06:00
test_buffercomp_LDADD = $(TESTS_LDADD)
test_log_LDADD = $(TESTS_LDADD)
test_atom_LDADD = $(TESTS_LDADD)
test_utf8_LDADD = $(TESTS_LDADD)
test_state_LDADD = $(TESTS_LDADD)
test_keyseq_LDADD = $(TESTS_LDADD)
test_rulescomp_LDADD = $(TESTS_LDADD)
test_rmlvo_to_kccgst_LDADD = $(TESTS_LDADD)
test_print_compiled_keymap_LDADD = $(TESTS_LDADD)
test_compose_LDADD = $(TESTS_LDADD) $(RT_LIBS)
if BUILD_LINUX_TESTS
build_only_tests += \
test/interactive-evdev
test_interactive_evdev_LDADD = $(TESTS_LDADD)
endif BUILD_LINUX_TESTS
if ENABLE_X11
build_run_tests += \
test/x11
# test/x11comp is meant to be run, but it is (temporarily?) disabled.
# See: https://github.com/xkbcommon/libxkbcommon/issues/30
build_only_tests += \
test/x11comp \
test/interactive-x11
TESTS_X11_LDADD = $(XCB_XKB_LIBS) $(TESTS_LDADD) libxkbcommon-x11.la
TESTS_X11_CFLAGS = $(XCB_XKB_CFLAGS)
test_x11_LDADD = $(TESTS_X11_LDADD)
test_x11_CFLAGS = $(TESTS_X11_CFLAGS)
test_x11comp_LDADD = $(TESTS_X11_LDADD)
test_x11comp_CFLAGS = $(TESTS_X11_CFLAGS)
test_interactive_x11_LDADD = $(TESTS_X11_LDADD)
test_interactive_x11_CFLAGS = $(TESTS_X11_CFLAGS)
endif ENABLE_X11
if ENABLE_WAYLAND
build_only_tests += \
test/interactive-wayland
TESTS_WAYLAND_LDADD = $(WAYLAND_LIBS) $(TESTS_LDADD)
TESTS_WAYLAND_CFLAGS = $(WAYLAND_CFLAGS)
.SECONDEXPANSION:
define protostability
$(if $(findstring unstable,$1),unstable,stable)
endef
define protoname
$(shell echo $1 | sed 's/\([a-z\-]\+\)-[a-z]\+-v[0-9]\+/\1/')
endef
%-protocol.c: $(WAYLAND_PROTOCOLS_DATADIR)/$$(call protostability,$$*)/$$(call protoname,$$*)/$$*.xml
$(AM_V_GEN)$(MKDIR_P) $(dir $@) && $(wayland_scanner) code < $< > $@
%-client-protocol.h: $(WAYLAND_PROTOCOLS_DATADIR)/$$(call protostability,$$*)/$$(call protoname,$$*)/$$*.xml
$(AM_V_GEN)$(MKDIR_P) $(dir $@) && $(wayland_scanner) client-header < $< > $@
INTERACTIVE_WL_XDG_SHELL_SRCS = \
xdg-shell-unstable-v6-protocol.c \
xdg-shell-unstable-v6-client-protocol.h
test_interactive_wayland_SOURCES = \
test/interactive-wayland.c \
$(INTERACTIVE_WL_XDG_SHELL_SRCS)
test_interactive_wayland_LDADD = $(TESTS_WAYLAND_LDADD)
test_interactive_wayland_CFLAGS = $(TESTS_WAYLAND_CFLAGS)
BUILT_SOURCES += \
$(INTERACTIVE_WL_XDG_SHELL_SRCS)
endif
check_PROGRAMS = $(build_run_tests) $(build_only_tests)
TESTS = $(build_run_tests) $(run_only_tests)
##
# Benchmarks
##
check_LTLIBRARIES += libbench.la
libbench_la_SOURCES = \
bench/bench.c \
bench/bench.h
BENCH_LDADD = libbench.la
BENCH_LDADD += $(TESTS_LDADD) $(RT_LIBS)
check_PROGRAMS += \
bench/key-proc \
bench/rules \
bench/rulescomp \
bench/compose
bench_key_proc_LDADD = $(BENCH_LDADD)
bench_rules_LDADD = $(BENCH_LDADD)
bench_rulescomp_LDADD = $(BENCH_LDADD)
bench_compose_LDADD = $(BENCH_LDADD)
##
# Custom targets
##
# Run this to regenerate xkbcommon-keysyms.h from the X11 headers
# defining the keysyms and update the name <-> keysym mapping.
update-keysyms:
LC_CTYPE=C python $(top_srcdir)/makeheader.py > $(top_srcdir)/xkbcommon/xkbcommon-keysyms.h
LC_CTYPE=C python $(top_srcdir)/makekeys.py $(top_srcdir)/xkbcommon/xkbcommon-keysyms.h > $(top_srcdir)/src/ks_tables.h
# Run this if you add/remove a new keyword to the xkbcomp scanner,
# or just want to regenerate the gperf file.
update-keywords:
$(AM_V_GEN)gperf < $(top_srcdir)/src/xkbcomp/keywords.gperf > $(top_srcdir)/src/xkbcomp/keywords.c
##
# Android stuff
##
Android_build.mk: Makefile $(BUILT_SOURCES)
androgenizer \
-:PROJECT libxkbcommon \
-:REL_TOP $(top_srcdir) -:ABS_TOP $(abs_top_srcdir) \
\
-:STATIC libxkbcommon \
-:TAGS eng debug \
-:SOURCES $(filter-out %.l %.y,$(libxkbcommon_la_SOURCES)) $(BUILT_SOURCES) \
-:CFLAGS $(DEFS) $(DEFAULT_INCLUDES) $(AM_CPPFLAGS) $(AM_CFLAGS) \
-:LDFLAGS $(AM_LDFLAGS) \
\
-:PASSTHROUGH 'libxkbcommon-clean: clean-libxkbcommon' \
> $@