Makefile for generated .py file.

This commit is contained in:
Merlijn Wajer 2013-05-23 23:11:27 +02:00
parent 464dfc76b7
commit 9f5caa9a13
2 changed files with 11 additions and 1 deletions

10
Makefile Normal file
View File

@ -0,0 +1,10 @@
.PHONY: default clean
default: uinput_gen.py
clean:
rm uinput_gen.py -f
uinput_gen.py:
gcc -E -dM /usr/include/linux/input.h | egrep ' (EV|SYN|KEY|BTN|REL|ABS|MSC|LED|SND|REP|SW)_[A-Za-z0-9_]+' | ( echo "#include <linux/input.h>" ; echo "input_constants_dict = {" ; sed -r 's/[^ ]+ +([^ ]+).*/"\1" : \1,/' ; echo "}" ) | gcc -E -o /dev/stdout - | grep 'input_constants_dict = {' -A 100000 > uinput_gen.py

View File

@ -2,7 +2,7 @@ import ctypes
import struct
from gen import input_constants_dict as icd
from uinput_gen import input_constants_dict as icd
for k, v in icd.iteritems():
locals()[k] = v