Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add .PHONY directive for Makefile targets that missing it #38

Merged
merged 1 commit into from
Apr 30, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading