Skip to content

Commit

Permalink
Merge pull request #38 from ykulazhenkov/pr-fix-makefile
Browse files Browse the repository at this point in the history
Add .PHONY directive for Makefile targets that missing it
  • Loading branch information
ykulazhenkov authored Apr 30, 2024
2 parents a34b4a2 + ba0965c commit 279a309
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,7 @@ GRPC_DIR ?= $(PROJECT_DIR)/api/grpc
PROTO_DIR ?= $(GRPC_DIR)/proto
GENERATED_CODE_DIR ?= $(GRPC_DIR)

.PHONY: grpc-generate
grpc-generate: protoc protoc-gen-go protoc-gen-go-grpc ## Generate GO client and server GRPC code
@echo "generate GRPC API"; \
echo " go module: $(API_PKG_GO_MOD)"; \
Expand Down Expand Up @@ -236,22 +237,26 @@ grpc-generate: protoc protoc-gen-go protoc-gen-go-grpc ## Generate GO client and
done; \
$(PROTOC) $$PROTOC_OPTIONS $$TARGET_FILES

.PHONY: grpc-check
grpc-check: grpc-format grpc-lint protoc protoc-gen-go protoc-gen-go-grpc $(GRPC_TMP_DIR) ## Check that generated GO client code match proto files
@rm -rf $(GRPC_TMP_DIR)/nvidia/
@$(MAKE) GENERATED_CODE_DIR=$(GRPC_TMP_DIR) grpc-generate
@diff -Naur $(GRPC_TMP_DIR)/nvidia/ $(GENERATED_CODE_DIR)/nvidia/ || \
(printf "\n\nOutdated files detected!\nPlease, run 'make generate' to regenerate GO code\n\n" && exit 1)
@echo "generated files are up to date"

.PHONY: grpc-lint
grpc-lint: buf ## Lint GRPC files
@echo "lint protobuf files";
cd $(PROTO_DIR) && \
$(BUF) lint --config ../buf.yaml

.PHONY: grpc-format
grpc-format: buf ## Format GRPC files
@echo "format protobuf files";
cd $(PROTO_DIR) && \
$(BUF) format -w --exit-code

.PHONY: controller-gen
controller-gen: $(CONTROLLER_GEN) ## Download controller-gen locally if necessary
$(CONTROLLER_GEN): | $(LOCALBIN)
Expand Down

0 comments on commit 279a309

Please sign in to comment.