|
| 1 | +# SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. |
| 2 | +# SPDX-License-Identifier: Apache-2.0 |
| 3 | +# |
| 4 | +# Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | +# you may not use this file except in compliance with the License. |
| 6 | +# You may obtain a copy of the License at |
| 7 | +# |
| 8 | +# http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | +# |
| 10 | +# Unless required by applicable law or agreed to in writing, software |
| 11 | +# distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | +# See the License for the specific language governing permissions and |
| 14 | +# limitations under the License. |
| 15 | + |
| 16 | +LOCALBIN ?= $(shell pwd)/bin |
| 17 | +$(LOCALBIN): |
| 18 | + mkdir -p $(LOCALBIN) |
| 19 | + |
| 20 | +HELM_DOCS_VERSION ?= 1.14.2 |
| 21 | +HELM_DOCS ?= $(LOCALBIN)/helm-docs-$(HELM_DOCS_VERSION) |
| 22 | + |
| 23 | +##@ General |
| 24 | + |
| 25 | +.PHONY: help |
| 26 | +help: ## Display this help |
| 27 | + @awk 'BEGIN {FS = ":.*##"; printf "\nUsage:\n make \033[36m<target>\033[0m\n"} /^[a-zA-Z_0-9-]+:.*?##/ { printf " \033[36m%-25s\033[0m %s\n", $$1, $$2 } /^##@/ { printf "\n\033[1m%s\033[0m\n", substr($$0, 5) }' $(MAKEFILE_LIST) |
| 28 | + |
| 29 | +##@ Helm Documentation |
| 30 | + |
| 31 | +.PHONY: helm-docs-install |
| 32 | +helm-docs-install: $(HELM_DOCS) ## Download helm-docs locally if necessary |
| 33 | +$(HELM_DOCS): $(LOCALBIN) |
| 34 | + @echo "Downloading helm-docs $(HELM_DOCS_VERSION)..." |
| 35 | + @ARCH=$$(uname -m); \ |
| 36 | + OS=$$(uname -s | tr '[:upper:]' '[:lower:]'); \ |
| 37 | + curl -sSL "https://github.com/norwoodj/helm-docs/releases/download/v$(HELM_DOCS_VERSION)/helm-docs_$(HELM_DOCS_VERSION)_$${OS}_$${ARCH}.tar.gz" | \ |
| 38 | + tar xz -C $(LOCALBIN) helm-docs && \ |
| 39 | + mv $(LOCALBIN)/helm-docs $(HELM_DOCS) |
| 40 | + |
| 41 | +.PHONY: generate-helm-docs |
| 42 | +generate-helm-docs: helm-docs-install ## Generate README.md from values.yaml and README.md.gotmpl |
| 43 | + @echo "Generating Helm chart documentation..." |
| 44 | + @$(HELM_DOCS) \ |
| 45 | + --template-files=README.md.gotmpl \ |
| 46 | + --output-file=README.md \ |
| 47 | + --sort-values-order=file \ |
| 48 | + --chart-to-generate=. \ |
| 49 | + --ignore-non-descriptions |
| 50 | + @echo "Generated README.md" |
| 51 | + |
| 52 | +.PHONY: helm-docs-clean |
| 53 | +helm-docs-clean: ## Remove generated helm documentation |
| 54 | + @rm -f README.md |
| 55 | + @echo "Cleaned generated README.md" |
0 commit comments