Merge pull request 'add autogeneration of help target for Makefile' (#1) from autogenerate-makefile-help into master

Reviewed-on: #1
This commit is contained in:
Stefan Etringer 2025-01-15 08:32:48 +01:00
commit 81af5973de
1 changed files with 8 additions and 10 deletions

View File

@ -7,27 +7,25 @@ GO_CLEAN = $(GO_CMD) clean
BUILD_DIR = build
BINARY = $(BUILD_DIR)/$(APP_NAME)
.PHONY: build
.PHONY: all build help clean install
all: build
build:
build: ## Build the application
@echo "Building $(APP_NAME)..."
$(GO_BUILD) -o $(BINARY)
install: build
install: build ## Install the application
@echo "Installing $(APP_NAME)..."
$(GO_INSTALL)
clean:
clean: ## Remove build artifacts
@echo "Cleaning up build artifacts..."
$(GO_CLEAN)
rm -f $(BINARY)
help:
help: ## Print the make targets
@echo "Makefile for $(APP_NAME)"
@echo "Usage:"
@echo " make build - Build the application"
@echo " make install - Install the application"
@echo " make clean - Remove build artifacts"
@echo " make - Default target (build)"
@echo "Targets:"
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'