Edit

kc3-lang/libxkbcommon/Makefile.am

Branch :

  • Show log

    Commit

  • Author : Ran Benita
    Date : 2012-08-12 11:40:02
    Hash : a392d268
    Message : Replace flex scanner with a hand-written one The scanner is very similar in structure to the one in xkbcomp/rules.c. It avoids copying and has nicer error reporting. It uses gperf to generate a hashtable for the keywords, which gives a nice speed boost (compared to the naive strcasecmp method at least). But since there's hardly a reason to regenerate it every time and require people to install gperf, the output (keywords.c) is added here as well. Here are some stats from test/rulescomp: Before: compiled 1000 keymaps in 4.052939625s ==22063== total heap usage: 101,101 allocs, 101,101 frees, 11,840,834 bytes allocated After: compiled 1000 keymaps in 3.519665434s ==26505== total heap usage: 99,945 allocs, 99,945 frees, 7,033,608 bytes allocated Signed-off-by: Ran Benita <ran234@gmail.com>

  • Makefile.am
  • ACLOCAL_AMFLAGS = -I m4 ${ACLOCAL_FLAGS}
    
    pkgconfigdir = $(libdir)/pkgconfig
    pkgconfig_DATA = xkbcommon.pc
    
    AM_CPPFLAGS = \
    	-DDFLT_XKB_CONFIG_ROOT='"$(XKBCONFIGROOT)"' \
    	-I$(top_srcdir)/src \
    	-I$(top_srcdir)/src/xkbcomp \
    	-I$(top_builddir)/src/xkbcomp \
    	-include $(top_builddir)/src/config.h
    
    AM_CFLAGS = $(BASE_CFLAGS)
    
    AM_LFLAGS = -o lex.yy.c
    AM_YFLAGS = -d
    
    xkbcommonincludedir = $(includedir)/xkbcommon
    xkbcommoninclude_HEADERS = \
    	xkbcommon/xkbcommon.h \
    	xkbcommon/xkbcommon-compat.h \
    	xkbcommon/xkbcommon-keysyms.h \
    	xkbcommon/xkbcommon-names.h
    
    lib_LTLIBRARIES = libxkbcommon.la
    libxkbcommon_la_LDFLAGS = -no-undefined
    libxkbcommon_la_SOURCES = \
    	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/scanner-utils.h \
    	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/compat.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/state.c \
    	src/text.c \
    	src/text.h \
    	src/utils.c \
    	src/utils.h
    
    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)$(DOXYGEN) 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.
    noinst_LTLIBRARIES = libtest.la
    libtest_la_LDFLAGS = $(libxkbcommon_la_LDFLAGS)
    libtest_la_SOURCES = \
    	$(libxkbcommon_la_SOURCES) \
    	test/common.c \
    	test/test.h
    
    AM_TESTS_ENVIRONMENT = \
    	XKB_LOG_LEVEL=debug; export XKB_LOG_LEVEL; \
    	XKB_LOG_VERBOSITY=10; export XKB_LOG_VERBOSITY; \
    	$(XORG_MALLOC_DEBUG_ENV)
    
    TESTS = \
    	test/keysym \
    	test/filecomp \
    	test/context \
    	test/rules-file \
    	test/stringcomp \
    	test/buffercomp \
    	test/log
    TESTS_LDADD = libtest.la
    
    test_keysym_LDADD = $(TESTS_LDADD)
    test_filecomp_LDADD = $(TESTS_LDADD)
    test_rulescomp_LDADD = $(TESTS_LDADD) -lrt
    test_context_LDADD = $(TESTS_LDADD)
    test_rules_file_CFLAGS = $(AM_CFLAGS) -Wno-declaration-after-statement
    test_rules_file_LDADD = $(TESTS_LDADD) -lrt
    test_stringcomp_LDADD = $(TESTS_LDADD)
    test_buffercomp_LDADD = $(TESTS_LDADD)
    test_log_LDADD = $(TESTS_LDADD)
    test_rmlvo_to_kccgst_LDADD = $(TESTS_LDADD)
    test_print_compiled_keymap_LDADD = $(TESTS_LDADD)
    test_bench_key_proc_LDADD = $(TESTS_LDADD) -lrt
    
    check_PROGRAMS = \
    	$(TESTS) \
    	test/rmlvo-to-kccgst \
    	test/print-compiled-keymap \
    	test/bench-key-proc
    
    if BUILD_LINUX_TESTS
    TESTS += \
    	test/state \
    	test/keyseq \
    	test/rulescomp
    
    test_keyseq_LDADD = $(TESTS_LDADD)
    test_state_LDADD = $(TESTS_LDADD)
    test_interactive_LDADD = $(TESTS_LDADD)
    
    check_PROGRAMS += \
    	test/interactive
    
    endif BUILD_LINUX_TESTS
    
    EXTRA_DIST = \
    	test/data
    
    # This sed script strips out lines that start with '#define _' which
    # removes #define _OSF_Keysyms and such.  The XK_Ydiaeresis case is to
    # handle a duplicate definition in HPkeysyms.h which kicks in if it's
    # not already defined.
    X11_INCLUDEDIR = /usr/include/X11
    KEYSYMDEFS = \
    	 $(X11_INCLUDEDIR)/keysymdef.h \
    	 $(X11_INCLUDEDIR)/XF86keysym.h \
    	 $(X11_INCLUDEDIR)/Sunkeysym.h \
    	 $(X11_INCLUDEDIR)/DECkeysym.h \
    	 $(X11_INCLUDEDIR)/HPkeysym.h
    update-keysyms:
    	echo -en '#ifndef _XKBCOMMON_KEYSYMS_H\n#define _XKBCOMMON_KEYSYMS_H\n\n' > $(top_srcdir)/xkbcommon/xkbcommon-keysyms.h
    	echo -en '/* This file is autogenerated from Makefile.am; please do not commit directly. */\n\n' >> $(top_srcdir)/xkbcommon/xkbcommon-keysyms.h
    	echo -en '#define XKB_KEY_NoSymbol                    0x000000  /* Special KeySym */\n\n' >> $(top_srcdir)/xkbcommon/xkbcommon-keysyms.h
    	sed -e '/XK_Ydiaeresis\s*0x100000ee/d' \
    	    -e '/#define _/d' \
    	    -e 's/#define\s*\(\w*\)XK_/#define XKB_KEY_\1/' \
    	    -e '/\(#ifdef\|#ifndef\|#endif\)/d' $(KEYSYMDEFS) >> $(top_srcdir)/xkbcommon/xkbcommon-keysyms.h
    	echo -en '\n\n#endif\n' >> $(top_srcdir)/xkbcommon/xkbcommon-keysyms.h
    	echo -en '/* This file is autogenerated from Makefile.am; please do not commit directly. */\n\n' > $(top_srcdir)/src/ks_tables.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 $(libxkbcommon_la_LDFLAGS) \
    	\
    	-:PASSTHROUGH 'libxkbcommon-clean: clean-libxkbcommon' \
    	> $@