Skip to content

Commit

Permalink
update generation of input definitions
Browse files Browse the repository at this point in the history
  • Loading branch information
wertarbyte committed Oct 1, 2015
1 parent aac9f35 commit 7e5abc6
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 9 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,6 @@ th-cmd
th-cmd.1
*.o
/*.d
evtable_*.h
evtable_*.inc
linux_input_defs_gen.inc
version.h
10 changes: 6 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@ THCMD_COMPS := th-cmd cmdsocket

MAKEDEPEND = $(CC) -M -MG $(CPPFLAGS) -o $*.d $<

LINUX_INPUT_H := $(shell echo '\#include <linux/input.h>' | $(CC) $(CPPFLAGS) -M -E - | awk 'NR==1 {print $$2}')

all: thd th-cmd man

man: thd.1 th-cmd.1
Expand All @@ -27,7 +25,10 @@ th-cmd: $(THCMD_COMPS:%=%.o)
--release="$(VERSION)" \
$< > $@

evtable_%.h: $(LINUX_INPUT_H)
linux_input_defs_gen.inc:
echo "#include <linux/input.h>" | $(CC) $(CPPFLAGS) -dM -E - > $@

evtable_%.inc: linux_input_defs_gen.inc
awk '/^#define $*_/ && $$2 !~ /_(MAX|CNT|VERSION)$$/ {print "EV_MAP("$$2"),"}' $< > $@

version.h: version.inc
Expand All @@ -36,7 +37,8 @@ version.h: version.inc
clean:
rm -f *.d
rm -f *.o
rm -f evtable_*.h
rm -f linux_input_defs_gen.inc
rm -f evtable_*.inc
rm -f version.h
rm -f thd th-cmd
rm -f thd.1 th-cmd.1
Expand Down
8 changes: 4 additions & 4 deletions eventtable.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@
#define EV_MAP( N ) [ N ] = #N

static const char *EV_NAME[EV_MAX] = {
#include "evtable_EV.h"
#include "evtable_EV.inc"
};

static const char *KEY_NAME[KEY_MAX] = {
#include "evtable_KEY.h"
#include "evtable_BTN.h"
#include "evtable_KEY.inc"
#include "evtable_BTN.inc"
};

static const char *SW_NAME[SW_MAX] = {
#include "evtable_SW.h"
#include "evtable_SW.inc"
};

0 comments on commit 7e5abc6

Please sign in to comment.