makefile-incl.keymap 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. # Custom systemd Makefile include that builds/installs keymap tool only for LFS
  2. # vim: tabstop=3
  3. KEYMAPS = $(shell ls keymaps/* | sort)
  4. KEYMAPS_FR = $(shell ls keymaps-force-release/* | sort)
  5. KEYMAP_DEPS = common src/udev/keymap/keys-from-name.h src/udev/keymap/keys-to-name.h
  6. src/udev/keymap/keys.txt:
  7. @echo GEN $@
  8. $(VB)awk '/^#define.*KEY_[^ ]+[ \t]+[0-9]/ \
  9. { \
  10. if ($$2 != "KEY_MAX") { print $$2 } \
  11. }' \
  12. /usr/include/linux/input.h | sed 's/^KEY_COFFEE$$/KEY_SCREENLOCK/' > $@
  13. src/udev/keymap/keys-from-name.gperf: src/udev/keymap/keys.txt
  14. @echo GEN $@
  15. $(VB)awk 'BEGIN \
  16. { \
  17. print "struct key \
  18. { \
  19. const char* name; \
  20. unsigned short id; \
  21. };"; \
  22. \
  23. print "%null-strings"; print "%%"; \
  24. } \
  25. { \
  26. print $$1 ", " $$1 \
  27. }' $< > $@
  28. src/udev/keymap/keys-from-name.h: src/udev/keymap/keys-from-name.gperf
  29. @echo GEN $@
  30. $(VB)gperf -L ANSI-C -t --ignore-case -N lookup_key -H hash_key_name -p -C $< > $@
  31. src/udev/keymap/keys-to-name.h: src/udev/keymap/keys.txt
  32. @echo GEN $@
  33. $(VB)awk 'BEGIN \
  34. { \
  35. print "const char* const key_names[KEY_CNT] = { " \
  36. } \
  37. { \
  38. print "[" $$1 "] = \"" $$1 "\"," \
  39. } \
  40. END{print "};" \
  41. }' $< > $@
  42. keymap:
  43. echo "keymap is now built into udevadm/udevd"