build: make generating make targets more systematic

This addresses a suggestion from a review comment in another PR.

The goal of this change is to make generating make targets more systematic.

Firstly, generating targets are made available under a more systematic naming
 following the pattern of "gen.foo".
more concretely, the following targets are introduced as aliases of the corresponding existing
 targets:

* gen.codegen
* gen.rbac
* gen.crds
* gen.docs
* gen.crd-docs

additionally, a  new "generate" make target is added that invokes all generating targets.

Co-authored-by: Blaine Gardner <b.blaine.gardner@gmail.com>
Signed-off-by: Michael Adam <obnox@samba.org>
This commit is contained in:
Michael AdamandBlaine Gardner committed 2024-10-30 12:11:01 +01:00
1 parent 4c812f573b
commit 04741fb899
1 file changed
+10 -3
+10 -3
View File
@@ -161,6 +161,7 @@ fmt: ## Check formatting of go sources.
@$(MAKE) go.init
@$(MAKE) go.fmt
gen.codegen: codegen
codegen: ${CODE_GENERATOR} ## Run code generators.
@build/codegen/codegen.sh
@@ -178,19 +179,21 @@ distclean: clean ## Remove all files that are created by building or configuring
prune: ## Prune cached artifacts.
@$(MAKE) -C images prune
docs: helm-docs
gen.crds: crds
crds: $(CONTROLLER_GEN) $(YQ)
@echo Updating CRD manifests
@build/crds/build-crds.sh $(CONTROLLER_GEN) $(YQ)
@GOBIN=$(GOBIN) build/crds/generate-crd-docs.sh
gen.rbac: gen-rbac
gen-rbac: $(HELM) $(YQ) ## Generate RBAC from Helm charts
@# output only stdout to the file; stderr for debugging should keep going to stderr
HELM=$(HELM) ./build/rbac/gen-common.sh
HELM=$(HELM) ./build/rbac/gen-nfs-rbac.sh
HELM=$(HELM) ./build/rbac/gen-psp.sh
gen.docs: docs
docs: helm-docs
helm-docs: $(HELM_DOCS) ## Use helm-docs to generate documentation from helm charts
$(HELM_DOCS) -c deploy/charts/rook-ceph \
-o ../../../Documentation/Helm-Charts/operator-chart.md \
@@ -218,11 +221,15 @@ docs-preview: ## Preview the documentation through mkdocs
docs-build: ## Build the documentation to the `site/` directory
mkdocs build --strict
gen.crd-docs: generate-docs-crds
generate-docs-crds: ## Build the documentation for CRD
@GOBIN=$(GOBIN) build/crds/generate-crd-docs.sh
generate: gen.codegen gen.crds gen.rbac gen.docs gen.crd-docs ## Update all generated files (code, manifests, charts, and docs).
.PHONY: all build.common
.PHONY: build build.all install test check vet fmt codegen mod.check clean distclean prune
.PHONY: build build.all install test check vet fmt codegen gen.codegen gen.rbac gen.crds gen.crd-docs gen.docs generate mod.check clean distclean prune
# ====================================================================================
# Help