From a3184dc2aecf79eb60658eea032e41a5cb091fa6 Mon Sep 17 00:00:00 2001 From: Shinichiro Hamaji Date: Tue, 5 Apr 2016 17:34:51 +0900 Subject: [PATCH] Fix dependencies of protoc with nanopb-c plugin Bug: 27954979 Change-Id: Ic06b5288b092d8ea5225516069845bfc2ffa9cd1 --- core/binary.mk | 6 ++++-- core/config.mk | 4 ++++ 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/core/binary.mk b/core/binary.mk index 280e0ba32..3daecb273 100644 --- a/core/binary.mk +++ b/core/binary.mk @@ -647,21 +647,23 @@ proto_generated_headers := ifneq ($(proto_sources),) proto_generated_sources_dir := $(generated_sources_dir)/proto proto_generated_obj_dir := $(intermediates)/proto +proto_sources_fullpath := $(addprefix $(LOCAL_PATH)/, $(proto_sources)) ifneq (,$(filter nanopb-c nanopb-c-enable_malloc, $(LOCAL_PROTOC_OPTIMIZE_TYPE))) my_proto_source_suffix := .c my_proto_c_includes := external/nanopb-c my_protoc_flags := --nanopb_out=$(proto_generated_sources_dir) \ --plugin=external/nanopb-c/generator/protoc-gen-nanopb +my_protoc_deps := $(NANOPB_SRCS) $(proto_sources_fullpath:%.proto=%.options) else my_proto_source_suffix := .cc my_proto_c_includes := external/protobuf/src my_cflags += -DGOOGLE_PROTOBUF_NO_RTTI my_protoc_flags := --cpp_out=$(proto_generated_sources_dir) +my_protoc_deps := endif my_proto_c_includes += $(proto_generated_sources_dir) -proto_sources_fullpath := $(addprefix $(LOCAL_PATH)/, $(proto_sources)) proto_generated_sources := $(addprefix $(proto_generated_sources_dir)/, \ $(patsubst %.proto,%.pb$(my_proto_source_suffix),$(proto_sources_fullpath))) proto_generated_headers := $(patsubst %.pb$(my_proto_source_suffix),%.pb.h, $(proto_generated_sources)) @@ -673,7 +675,7 @@ $(call track-src-file-obj,$(proto_sources),$(proto_generated_objects)) ifndef $(my_prefix)_$(LOCAL_MODULE_CLASS)_$(LOCAL_MODULE)_proto_defined $(proto_generated_sources): PRIVATE_PROTO_INCLUDES := $(TOP) $(proto_generated_sources): PRIVATE_PROTOC_FLAGS := $(LOCAL_PROTOC_FLAGS) $(my_protoc_flags) -$(proto_generated_sources): $(proto_generated_sources_dir)/%.pb$(my_proto_source_suffix): %.proto $(PROTOC) +$(proto_generated_sources): $(proto_generated_sources_dir)/%.pb$(my_proto_source_suffix): %.proto $(my_protoc_deps) $(PROTOC) $(transform-proto-to-cc) # This is just a dummy rule to make sure gmake doesn't skip updating the dependents. diff --git a/core/config.mk b/core/config.mk index 39c58da45..4e82476f1 100644 --- a/core/config.mk +++ b/core/config.mk @@ -512,6 +512,10 @@ else BREAKPAD_GENERATE_SYMBOLS := false endif PROTOC := $(HOST_OUT_EXECUTABLES)/aprotoc$(HOST_EXECUTABLE_SUFFIX) +NANOPB_SRCS := external/nanopb-c/generator/protoc-gen-nanopb \ + $(wildcard external/nanopb-c/generator/*.py \ + external/nanopb-c/generator/google/*.py \ + external/nanopb-c/generator/proto/*.py) DBUS_GENERATOR := $(HOST_OUT_EXECUTABLES)/dbus-binding-generator MKBOOTFS := $(HOST_OUT_EXECUTABLES)/mkbootfs$(HOST_EXECUTABLE_SUFFIX) MINIGZIP := $(HOST_OUT_EXECUTABLES)/minigzip$(HOST_EXECUTABLE_SUFFIX)