aboutsummaryrefslogtreecommitdiffstats
path: root/udev-lfs/makefile-incl.keymap
blob: f5703f7904eb53ebb2b0bbb5ca372d925bfe0b61 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
# Custom systemd Makefile include that builds/installs keymap tool only for LFS

# vim: tabstop=3

KEYMAPS =                                          \
   keymaps/acer                                    \
   keymaps/acer-aspire_5720                        \
   keymaps/acer-aspire_8930                        \
   keymaps/acer-aspire_5920g                       \
   keymaps/acer-aspire_6920                        \
   keymaps/acer-travelmate_c300                    \
   keymaps/asus                                    \
   keymaps/compaq-e_evo                            \
   keymaps/dell                                    \
   keymaps/dell-latitude-xt2                       \
   keymaps/everex-xt5000                           \
   keymaps/fujitsu-amilo_li_2732                   \
   keymaps/fujitsu-amilo_pa_2548                   \
   keymaps/fujitsu-amilo_pro_edition_v3505         \
   keymaps/fujitsu-amilo_pro_v3205                 \
   keymaps/fujitsu-amilo_si_1520                   \
   keymaps/fujitsu-esprimo_mobile_v5               \
   keymaps/fujitsu-esprimo_mobile_v6               \
   keymaps/genius-slimstar-320                     \
   keymaps/hewlett-packard                         \
   keymaps/hewlett-packard-2510p_2530p             \
   keymaps/hewlett-packard-compaq_elitebook        \
   keymaps/hewlett-packard-pavilion                \
   keymaps/hewlett-packard-presario-2100           \
   keymaps/hewlett-packard-tablet                  \
   keymaps/hewlett-packard-tx2                     \
   keymaps/ibm-thinkpad-usb-keyboard-trackpoint    \
   keymaps/inventec-symphony_6.0_7.0               \
   keymaps/lenovo-3000                             \
   keymaps/lenovo-ideapad                          \
   keymaps/lenovo-thinkpad-usb-keyboard-trackpoint \
   keymaps/lenovo-thinkpad_x6_tablet               \
   keymaps/lenovo-thinkpad_x200_tablet             \
   keymaps/lg-x110                                 \
   keymaps/logitech-wave                           \
   keymaps/logitech-wave-cordless                  \
   keymaps/logitech-wave-pro-cordless              \
   keymaps/maxdata-pro_7000                        \
   keymaps/medion-fid2060                          \
   keymaps/medionnb-a555                           \
   keymaps/micro-star                              \
   keymaps/module-asus-w3j                         \
   keymaps/module-ibm                              \
   keymaps/module-lenovo                           \
   keymaps/module-sony                             \
   keymaps/module-sony-old                         \
   keymaps/module-sony-vgn                         \
   keymaps/olpc-xo                                 \
   keymaps/onkyo                                   \
   keymaps/oqo-model2                              \
   keymaps/samsung-other                           \
   keymaps/samsung-90x3a                           \
   keymaps/samsung-sq1us                           \
   keymaps/samsung-sx20s                           \
   keymaps/toshiba-satellite_a100                  \
   keymaps/toshiba-satellite_a110                  \
   keymaps/toshiba-satellite_m30x                  \
   keymaps/zepto-znote

KEYMAPS_FR =                           \
   keymaps-force-release/dell-touchpad \
   keymaps-force-release/dell-xps      \
   keymaps-force-release/hp-other      \
   keymaps-force-release/samsung-other \
   keymaps-force-release/samsung-90x3a \
   keymaps-force-release/common-volume-keys

KEYMAP_DEPS = common src/udev/keymap/keys-from-name.h src/udev/keymap/keys-to-name.h

src/udev/keymap/keys.txt:
	@echo GEN $@
	$(VB)awk '/^#define.*KEY_[^ ]+[ \t]+[0-9]/ \
   {                                         \
     if ($$2 != "KEY_MAX") { print $$2 }     \
   }'                                        \
   /usr/include/linux/input.h | sed 's/^KEY_COFFEE$$/KEY_SCREENLOCK/' > $@

src/udev/keymap/keys-from-name.gperf: src/udev/keymap/keys.txt
	@echo GEN $@
	$(VB)awk 'BEGIN                       \
   {                                    \
     print "struct key                  \
     {                                  \
       const char* name;                \
       unsigned short id;               \
     };";                               \
                                        \
     print "%null-strings"; print "%%"; \
   }                                    \
   {                                    \
     print $$1 ", " $$1                 \
   }' $< > $@

src/udev/keymap/keys-from-name.h: src/udev/keymap/keys-from-name.gperf
	@echo GEN $@
	$(VB)gperf -L ANSI-C -t --ignore-case -N lookup_key -H hash_key_name -p -C $< > $@

src/udev/keymap/keys-to-name.h: src/udev/keymap/keys.txt 
	@echo GEN $@
	$(VB)awk 'BEGIN                                     \
   {                                                   \
     print "const char* const key_names[KEY_CNT] = { " \
   }                                                   \
   {                                                   \
     print "[" $$1 "] = \"" $$1 "\","                  \
   }                                                   \
   END{print "};"                                      \
   }' $< > $@

build/keymap: src/udev/keymap/keymap.c build/$(COMMON_LIB) $(KEYMAP_DEPS)
	@echo LINK $@
	$(VB)gcc $< -o $@ -I src/udev/keymap $(WARN) $(OPTIONS2) $(INCLUDE) $(DEF) \
      build/$(COMMON_LIB) $(LDFLAGS)
	$(VB)strip --strip-unneeded $@

keymap: build/keymap

install-keymap: keymap
	@mkdir -pv $(DESTDIR)/lib/udev/keymaps/force-release \
              $(DESTDIR)/lib/udev/rules.d               \
              $(DESTDIR)/usr/share/doc/udev

	@cp -v build/keymap  $(DESTDIR)/lib/udev

	@cp -v $(KEYMAPS)    $(DESTDIR)/lib/udev/keymaps
	@cp -v $(KEYMAPS_FR) $(DESTDIR)/lib/udev/keymaps/force-release

	@cp -v src/udev/keymap/*.rules       $(DESTDIR)/lib/udev/rules.d
	@cp -v src/udev/keymap/findkeyboards $(DESTDIR)/lib/udev

	@cp -v src/udev/keymap/*.txt $(DESTDIR)/usr/share/doc/udev

	@sed -e 's|@udevlibexecdir@|/lib/udev|g'              \
            src/udev/keymap/keyboard-force-release.sh.in \
            > $(DESTDIR)/lib/udev/keyboard-force-release.sh

	@chmod 0755 $(DESTDIR)/lib/udev/keyboard-force-release.sh

clean-keymap:
	rm -f src/udev/keymap/keys.txt
	rm -f src/udev/keymap/keys-from-name.gperf
	rm -f src/udev/keymap/keys-from-name.h
	rm -f src/udev/keymap/keys-to-name.h
	rm -f build/keymap

.PHONY: clean-keymap