summaryrefslogtreecommitdiff
path: root/src/keymap
diff options
context:
space:
mode:
authorAnthony G. Basile <blueness@gentoo.org>2012-11-20 14:44:47 -0500
committerAnthony G. Basile <blueness@gentoo.org>2012-11-20 14:44:47 -0500
commitbcc69ef934c9d14732e16551032242fa599b44e7 (patch)
treeacc183e5e4ba09ab8893a432514b9fc5a1d78736 /src/keymap
parent802d021d2e403862f4692ee67956e7e0160c1879 (diff)
Reintroduce keymaps build and test
This commit reintroduces code to 1) build src/keymap 2) test keymap/Makefile.am that it has all the key maps listed 3) test that all the key names in keymap/* are in <linux/input.h> 4) do a syntax check on rules/*.rules which now includes 95-keymap.rules and 95-keyboard-force-release.rules For #4, the regex expressions in rule-syntax-check.py had to be updated. They do not allow trailing comments via # comment, and I did not include that. A rule in 95-keymap.rules had to have its comment moved from the end to another line. Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
Diffstat (limited to 'src/keymap')
-rw-r--r--src/keymap/Makefile.am18
-rwxr-xr-xsrc/keymap/check-keymaps.sh15
2 files changed, 22 insertions, 11 deletions
diff --git a/src/keymap/Makefile.am b/src/keymap/Makefile.am
index 80f87f7344..942009edba 100644
--- a/src/keymap/Makefile.am
+++ b/src/keymap/Makefile.am
@@ -4,6 +4,11 @@ rootprefix=@rootprefix@
udevlibexecdir=$(rootprefix)/lib/udev
udevhomedir = $(udevlibexecdir)
+AM_CPPFLAGS = \
+ -I $(top_srcdir)/src/libudev \
+ -I $(top_srcdir)/src/udev \
+ -DUDEVLIBEXECDIR=\"$(udevlibexecdir)\"
+
udevlibexec_PROGRAMS = \
keymap
@@ -11,7 +16,10 @@ keymap_SOURCES = \
keymap.c
keymap_CPPFLAGS = \
- $(AM_CPPFLAGS) -I keymap
+ $(AM_CPPFLAGS)
+
+keymap_LDADD = \
+ $(top_builddir)/src/udev/libudev-core.la
nodist_keymap_SOURCES = \
keys-from-name.h \
@@ -35,6 +43,10 @@ CLEANFILES = \
keys-from-name.gperf \
keyboard-force-release.sh
+EXTRA_DIST = \
+ check-keymaps.sh \
+ keyboard-force-release.sh.in
+
keys.txt: Makefile
$(AM_V_at)$(MKDIR_P) $(dir $@)
$(AM_V_GEN)$(CPP) $(CFLAGS) $(AM_CPPFLAGS) $(CPPFLAGS) -dM -include linux/input.h - < /dev/null | $(AWK) '/^#define[ \t]+KEY_[^ ]+[ \t]+[0-9]/ { if ($$2 != "KEY_MAX") { print $$2 } }' | sed 's/^KEY_COFFEE$$/KEY_SCREENLOCK/' > $@
@@ -47,7 +59,3 @@ keys-from-name.h: keys-from-name.gperf Makefile
keys-to-name.h: keys.txt Makefile
$(AM_V_GEN)$(AWK) 'BEGIN{ print "const char* const key_names[KEY_CNT] = { "} { print "[" $$1 "] = \"" $$1 "\"," } END{print "};"}' < $< > $@
-
-EXTRA_DIST = \
- check-keymaps.sh \
- keyboard-force-release.sh.in
diff --git a/src/keymap/check-keymaps.sh b/src/keymap/check-keymaps.sh
index c4572745e0..e3abe672d1 100755
--- a/src/keymap/check-keymaps.sh
+++ b/src/keymap/check-keymaps.sh
@@ -3,18 +3,21 @@
# check that all key names in keymaps/* are known in <linux/input.h>
# and that all key maps listed in the rules are valid and present in
# Makefile.am
-SRCDIR=${1:-.}
-KEYLIST=${2:-src/udev/keymap/keys.txt}
-KEYMAPS_DIR=$SRCDIR/keymaps
-RULES=$SRCDIR/src/udev/keymap/95-keymap.rules
+
+SRCDIR=${1:-../..}
+KEYLIST=${2:-${SRCDIR}/src/keymap/keys.txt}
[ -e "$KEYLIST" ] || {
echo "need $KEYLIST please build first" >&2
exit 1
}
+KEYMAPS_DIR=${SRCDIR}/keymaps
+KEYMAPS_LIST=$(ls ${KEYMAPS_DIR}/* | grep -v Makefile)
+RULES=${SRCDIR}/rules/95-keymap.rules
+
missing=$(join -v 2 <(awk '{print tolower(substr($1,5))}' $KEYLIST | sort -u) \
- <(grep -hv '^#' ${KEYMAPS_DIR}/*| awk '{print $2}' | sort -u))
+ <(grep -hv '^#' ${KEYMAPS_LIST}| awk '{print $2}' | sort -u))
[ -z "$missing" ] || {
echo "ERROR: unknown key names in keymaps/*:" >&2
echo "$missing" >&2
@@ -31,7 +34,7 @@ for m in $maps; do
echo "ERROR: unknown map name in $RULES: $m" >&2
exit 1
}
- grep -q "keymaps/$m\>" $SRCDIR/Makefile.am || {
+ grep -q "$m\>" ${SRCDIR}/keymaps/Makefile.am || {
echo "ERROR: map file $m is not added to Makefile.am" >&2
exit 1
}