diff options
author | Allen Webb <allenwebb@google.com> | 2018-08-21 12:05:53 -0700 |
---|---|---|
committer | chrome-bot <chrome-bot@chromium.org> | 2018-09-07 18:36:35 -0700 |
commit | e6a13850e9b5a6b2889549c03caddf2944e7fc63 (patch) | |
tree | 058c66ade45a699e1dc84a6bf64ebe5595dc52bc /Makefile.rules | |
parent | a8e3f2388c0a950ec431e6fffc916b42ea6c816d (diff) | |
download | chrome-ec-e6a13850e9b5a6b2889549c03caddf2944e7fc63.tar.gz |
Add rules for building protocol buffers.
To facilitate using libprotobuf-mutator in fuzzing targets, rules
for generating sources from proto files and compiling those to
object files were added.
BRANCH=none
BUG=chromium:876582
TEST=rm -rf build && make -j buildfuzztests &&
./build/host/cr50_fuzz/cr50_fuzz.exe (after cr50_fuzz.proto is added)
Change-Id: Id645d0b60397bfeb71d60d601c4f65eefcbdf228
Signed-off-by: Allen Webb <allenwebb@google.com>
Reviewed-on: https://chromium-review.googlesource.com/1184106
Reviewed-by: Mattias Nissler <mnissler@chromium.org>
Reviewed-by: Vadim Bendebury <vbendeb@chromium.org>
Diffstat (limited to 'Makefile.rules')
-rw-r--r-- | Makefile.rules | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/Makefile.rules b/Makefile.rules index d6150a5c47..e3d6e3164a 100644 --- a/Makefile.rules +++ b/Makefile.rules @@ -25,10 +25,9 @@ _common_dir_create := $(foreach d,$(common_dirs),$(shell [ -d $(out)/$(d) ] || \ mkdir -p $(out)/$(d))) _sharedlib_dir_create := $(foreach d,$(dirs),$(shell \ [ -d $(out)/$(SHOBJLIB)/$(d) ] || mkdir -p $(out)/$(SHOBJLIB)/$(d))) -_dir_create := $(foreach d,$(dirs),$(shell [ -d $(out)/$(BLD)/$(d) ] || \ - mkdir -p $(out)/RO/$(d); mkdir -p $(out)/RW/$(d))) -_dir_y_create := $(foreach d,$(dirs-y),$(shell [ -d $(out)/$(BLD)/$(d) ] || \ - mkdir -p $(out)/RO/$(d); mkdir -p $(out)/RW/$(d))) +_dir_create := $(foreach d,$(dirs) $(dirs-y),\ + $(shell [ -d $(out)/$(BLD)/$(d) ] || mkdir -p $(out)/RO/$(d); \ + mkdir -p $(out)/RW/$(d); mkdir -p $(out)/gen/$(d))) # V unset for normal output, V=1 for verbose output, V=0 for silent build # (warnings/errors only). Use echo thus: $(call echo,"stuff to echo") @@ -109,6 +108,7 @@ cmd_c_to_taskinfo = $(BUILDCC) \ -MMD -MF $@.d -c $< -flto -o $@ cmd_link_taskinfo = $(BUILDCC) $(BUILD_CFLAGS) --shared -fPIC $^ \ $(BUILD_LDFLAGS) -flto -o $@ +cmd_proto_to_cxx = $(PROTOC) -I. --cpp_out=$(out)/gen $^ cmd_tp_hash = $(out)/util/gen_touchpad_hash \ $(if $(TOUCHPAD_FW),-f $(TOUCHPAD_FW)) -o $@ @@ -451,6 +451,15 @@ $(out)/RO/%.o:%.cc $(out)/RW/%.o:%.cc $(call quiet,cxx_to_o,CXX ) +$(out)/RO/%.pb.o:$(out)/gen/%.pb.cc + $(call quiet,cxx_to_o,CXX ) +$(out)/RW/%.pb.o:$(out)/gen/%.pb.cc + $(call quiet,cxx_to_o,CXX ) +$(out)/gen/%.pb.cc:%.proto + $(call quiet,proto_to_cxx,PROTOC ) +$(out)/gen/%.pb.h:%.proto + $(call quiet,proto_to_cxx,PROTOC ) + $(out)/$(SHOBJLIB)/%.o: override LATE_CFLAGS_DEFINE:=-DSHAREDLIB_IMAGE $(out)/$(SHOBJLIB)/%.o:%.c $(call quiet,c_to_o,CC ) |