From 41a20a184b2ac3a96af92daee747939e995c85d6 Mon Sep 17 00:00:00 2001 From: TJ Hoplock Date: Mon, 21 Oct 2024 00:21:48 -0400 Subject: [PATCH] build: update Makefile help doc autogenerator --- Makefile | 86 ++++++++++++++++++++++++++++---------------------------- 1 file changed, 43 insertions(+), 43 deletions(-) diff --git a/Makefile b/Makefile index 10335c8..7ba328f 100644 --- a/Makefile +++ b/Makefile @@ -5,82 +5,82 @@ COMMIT := $(shell git rev-parse HEAD) RELEASE_CONTAINER_NAME := mango GOLANGCILINT_CACHE := ${CURDIR}/.golangci-lint/build/cache -## help: print this help message +# autogenerate help messages for comment lines with 2 `#` .PHONY: help -help: Makefile - # autogenerate help messages for comment lines with 2 `#` - @sed -n 's/^##//p' $< +help: ## print this help message + @awk 'BEGIN {FS = ":.*##"; printf "\nUsage:\n make \033[36m\033[0m\n\nTargets:\n"} /^[a-z0-9A-Z_-]+:.*?##/ { printf " \033[36m%-10s\033[0m\t%s\n", $$1, $$2 }' $(MAKEFILE_LIST) -## tidy: tidy modules -tidy: +.PHONY: tidy +tidy: ## tidy modules ${GOMOD} tidy -## fmt: apply go code style formatter -fmt: +.PHONY: fmt +fmt: ## apply go code style formatter ${GOFMT} -x ./... -## lint: run linters -lint: +.PHONY: lint +lint: ## run linters mkdir -p ${GOLANGCILINT_CACHE} || true podman run --rm -v ${CURDIR}:/app -v ${GOLANGCILINT_CACHE}:/root/.cache -w /app docker.io/golangci/golangci-lint:latest golangci-lint run -v -## build-mango build the `mango` configuration management server -build-mango: fmt tidy lint +.PHONY: build-mango +build-mango: fmt tidy lint ## build the `mango` configuration management server goreleaser build --clean --single-target --snapshot --output . --id "mango" -## build-mh build `mh`, the helper tool for mango -build-mh: fmt tidy lint +.PHONY: build-mh +build-mh: fmt tidy lint ## build `mh`, the helper tool for mango goreleaser build --clean --single-target --snapshot --output . --id "mh" -## build: alias for `build-mango build-mh` -build: build-mango build-mh +.PHONY: build +build: build-mango build-mh ## alias for `build-mango build-mh` -## binary: alias for `build` -binary: build +.PHONY: binary +binary: build ## alias for `build` -## container: build container image with binary -container: binary +.PHONY: container +container: binary ## build container image with binary podman image build -t ${RELEASE_CONTAINER_NAME}:latest . -## image: alias for `container` -image: container +.PHONY: image +image: container ## alias for `container` -## podman: alias for `container` -podman: container +.PHONY: podman +podman: container ## alias for `container` -## docker: alias for `container` -docker: container +.PHONY: docker +docker: container ## alias for `container` -## test-container: build test containers with binary for testing purposes -test-container: binary +.PHONY: test-container +test-container: binary ## build test containers with binary for testing purposes podman image build -t "mango-test-ubuntu" -f Dockerfile-testbox-ubuntu . podman image build -t "mango-test-arch" -f Dockerfile-testbox-arch . -## test-image: alias for `container` -test-image: container +.PHONY: test-image +test-image: container ## alias for `container` -## test-podman: alias for `container` -test-podman: container +.PHONY: test-podman +test-podman: container ## alias for `container` -## test-docker: alias for `container` -test-docker: container +.PHONY: test-docker +test-docker: container ## alias for `container` -## services: use podman compose to spin up local grafana, prometheus, etc -services: +.PHONY: services +services: ## use podman compose to spin up local grafana, prometheus, etc podman-compose -f docker-compose-services.yaml up -d -## run-test-containers use podman compose to spin up test containers running systemd for use with the test inventory -run-test-containers: test-container services +.PHONY: run-test-containers +run-test-containers: test-container services ## use podman compose to spin up test containers running systemd for use with the test inventory podman-compose -f docker-compose-test-mango.yaml --podman-run-args="--systemd=true" up -d -## reload-test-inventory: use podman to reload the mango systemd service running in the ubuntu test container -reload-test-inventory: run-test-inventory +.PHONY: reload-test-inventory +reload-test-inventory: run-test-inventory ## use podman to reload the mango systemd service running in the ubuntu test container podman-compose -f docker-compose-test-mango.yaml exec -T mango-archlinux /bin/bash -c 'systemctl reload mango.service' podman-compose -f docker-compose-test-mango.yaml exec -T mango-ubuntu-2204 /bin/bash -c 'systemctl reload mango.service' -## stop: stop test environment and any other cleanup -stop: +.PHONY: stop +stop: ## stop test environment and any other cleanup podman-compose -f docker-compose-services.yaml down podman-compose -f docker-compose-test-mango.yaml down -## clean: alias for `stop` +.PHONY: clean +clean: stop ## alias for `stop`