Permalink
Browse files

try to autodetect the location of <linux/input.h>

  • Loading branch information...
1 parent 740c4c5 commit d5a041b18f010d4b1f4a33cfed00fcbe604e3a91 @wertarbyte committed Nov 18, 2010
Showing with 4 additions and 2 deletions.
  1. +4 −2 Makefile
View
@@ -6,7 +6,9 @@ MANDIR:=$(DESTDIR)/$(PREFIX)/share/man/man1/
THD_COMPS := thd keystate trigger eventnames devices cmdsocket obey ignore
THCMD_COMPS := th-cmd cmdsocket
-MAKEDEPEND = gcc -M -MG $(CPPFLAGS) -o $*.d $<
+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}')
@andrewshadura

andrewshadura Sep 25, 2015

Contributor

This doesn't work on my system, because cc -M -E output begins with -: /usr/include/stdc-predef.h /usr/include/linux/input.h \.

@andrewshadura

andrewshadura Sep 25, 2015

Contributor

I think grep -o '[^ ]*linux/input.h' might be better than awk 'NR==1 {print $2}'

all: thd th-cmd man
@@ -23,7 +25,7 @@ th-cmd: $(THCMD_COMPS:%=%.o)
--release="" \
$< > $@
-evtable_%.h: /usr/include/linux/input.h
+evtable_%.h: $(LINUX_INPUT_H)
awk '/^#define $*_/ && $$2 !~ /_(MAX|CNT|VERSION)$$/ {print "EV_MAP("$$2"),"}' $< > $@
clean:

1 comment on commit d5a041b

very thanks.

Please sign in to comment.