xref: /spdk/proto/Makefile (revision a6dbe3721eb3b5990707fc3e378c95e505dd8ab5)
1#  SPDX-License-Identifier: BSD-3-Clause
2#  Copyright (C) 2022 Intel Corporation.
3#  All rights reserved.
4#
5
6SPDK_ROOT_DIR := $(abspath $(CURDIR)/..)
7include $(SPDK_ROOT_DIR)/mk/spdk.common.mk
8
9# Location where the python generated code is placed
10pydir=$(SPDK_ROOT_DIR)/python/spdk/sma/proto
11protodefs = $(wildcard *.proto)
12protopy = $(foreach proto,$(basename $(protodefs)),$(addprefix $(pydir)/$(proto),_pb2.py _pb2_grpc.py))
13
14all: $(protopy)
15
16clean:
17	$(Q)$(RM) $(protopy)
18
19# TODO: we should probably write a proper install rule here instead of just blindly copying all
20# python scripts when building the RPMs
21install:
22uninstall:
23
24$(pydir)/%_pb2.py $(pydir)/%_pb2_grpc.py: %.proto
25	$(Q)python3 -m grpc_tools.protoc --proto_path=. --python_out=$(pydir) \
26		--grpc_python_out=$(pydir)  $^
27
28.PHONY: all clean install uninstall
29