github.com/cilium/cilium@v1.16.2/api/v1/Makefile.protoc (about)

     1  # Copyright Authors of Cilium
     2  # SPDX-License-Identifier: Apache-2.0
     3  
     4  # This Makefile is expected to run inside the cilium-builder image to generate
     5  # the proto files. Run `make proto` on ./Makefile to invoke run this inside a
     6  # a container.
     7  
     8  PROTOC ?= protoc
     9  
    10  HUBBLE_PROTO_SOURCES := \
    11  	./flow/flow.proto \
    12  	./peer/peer.proto \
    13  	./observer/observer.proto \
    14  	./relay/relay.proto \
    15  	./recorder/recorder.proto
    16  
    17  HUBBLE_GO_TARGETS := $(HUBBLE_PROTO_SOURCES:.proto=.pb.go) $(HUBBLE_PROTO_SOURCES:.proto=.pb.json.go)
    18  
    19  HUBBLE_PROTO_PATH := .
    20  
    21  HUBBLE_PROTOC_PLUGINS := --plugin=$(GOPATH)/bin/protoc-gen-doc
    22  HUBBLE_PROTOC_PLUGINS += --plugin=$(GOPATH)/bin/protoc-gen-go-grpc
    23  HUBBLE_PROTOC_PLUGINS += --plugin=$(GOPATH)/bin/protoc-gen-go-json
    24  HUBBLE_PROTOC_PLUGINS += --plugin=$(GOPATH)/bin/protoc-gen-go
    25  
    26  .PHONY: all
    27  all:
    28  	@echo NOTE: The warning about package github.com/golang/protobuf/protoc-gen-go/generator can be ignored
    29  	$(QUIET)set -e; \
    30  	for proto in $(HUBBLE_PROTO_SOURCES) ; do \
    31  		echo Generating $${proto} && \
    32  		$(PROTOC) $(HUBBLE_PROTOC_PLUGINS) -I $(HUBBLE_PROTO_PATH) \
    33  			--doc_out=./ \
    34  			--doc_opt=markdown,README.md,source_relative \
    35  			--go_out=paths=source_relative:. \
    36  			--go-grpc_out=require_unimplemented_servers=false,paths=source_relative:. \
    37  			--go-json_out=orig_name=true,paths=source_relative:. \
    38  			$${proto}; \
    39  	done