Fix generation of event labels for getevent.

The recent uapi header update moved all the interesting constants
out into another file. Track that, and add the missing makefile
dependency.

Bug: http://b/27073568

(cherry picked from commit bd02a47b22)

Change-Id: I9323a995511b12905949cba22c59cc28623068f3
This commit is contained in:
Elliott Hughes 2016-02-08 14:09:10 -08:00
parent 5badce35f0
commit b71e897003
2 changed files with 10 additions and 3 deletions

View File

@ -80,10 +80,16 @@ $(TOOLS_H):
$(LOCAL_PATH)/getevent.c: $(intermediates)/input.h-labels.h
UAPI_INPUT_EVENT_CODES_H := bionic/libc/kernel/uapi/linux/input-event-codes.h
INPUT_H_LABELS_H := $(intermediates)/input.h-labels.h
$(INPUT_H_LABELS_H): PRIVATE_LOCAL_PATH := $(LOCAL_PATH)
$(INPUT_H_LABELS_H): PRIVATE_CUSTOM_TOOL = $(PRIVATE_LOCAL_PATH)/generate-input.h-labels.py > $@
$(INPUT_H_LABELS_H): $(LOCAL_PATH)/Android.mk $(LOCAL_PATH)/generate-input.h-labels.py
# The PRIVATE_CUSTOM_TOOL line uses = to evaluate the output path late.
# We copy the input path so it can't be accidentally modified later.
$(INPUT_H_LABELS_H): PRIVATE_UAPI_INPUT_EVENT_CODES_H := $(UAPI_INPUT_EVENT_CODES_H)
$(INPUT_H_LABELS_H): PRIVATE_CUSTOM_TOOL = $(PRIVATE_LOCAL_PATH)/generate-input.h-labels.py $(PRIVATE_UAPI_INPUT_EVENT_CODES_H) > $@
# The dependency line though gets evaluated now, so the PRIVATE_ copy doesn't exist yet,
# and the original can't yet have been modified, so this is both sufficient and necessary.
$(INPUT_H_LABELS_H): $(LOCAL_PATH)/Android.mk $(LOCAL_PATH)/generate-input.h-labels.py $(UAPI_INPUT_EVENT_CODES_H)
$(INPUT_H_LABELS_H):
$(transform-generated-source)

View File

@ -18,6 +18,7 @@
import os
import re
import sys
input_prop_list = []
ev_list = []
@ -36,7 +37,7 @@ ff_list = []
r = re.compile(r'#define\s+(\S+)\s+((?:0x)?\d+)')
with open('bionic/libc/kernel/uapi/linux/input.h', 'r') as f:
with open(sys.argv[1], 'r') as f:
for line in f:
m = r.match(line)
if m: