added uninstall option to the makefile

This commit is contained in:
Stefan Etringer 2025-06-24 10:14:31 +00:00
parent 1f857d8bfa
commit e8602b486f
1 changed files with 8 additions and 4 deletions

View File

@ -4,10 +4,11 @@ GO_CMD = go
GO_BUILD = $(GO_CMD) build
GO_INSTALL = $(GO_CMD) install
GO_CLEAN = $(GO_CMD) clean
GOBIN := /usr/local/bin
BUILD_DIR = build
BINARY = $(BUILD_DIR)/$(APP_NAME)
.PHONY: all build help clean install
.PHONY: all build help clean install uninstall
all: build
@ -17,9 +18,13 @@ build: ## Build the application
install: build ## Install the application
@echo "Installing $(APP_NAME)..."
$(GO_INSTALL)
GOBIN=$(GOBIN) $(GO_INSTALL)
clean: ## Remove build artifacts
uninstall: clean ## Remove build artifacts
@echo "Removing installed binary..."
rm -f $(GOBIN)/$(APP_NAME)
clean: ## Remove installed application
@echo "Cleaning up build artifacts..."
$(GO_CLEAN)
rm -f $(BINARY)
@ -28,4 +33,3 @@ help: ## Print the make targets
@echo "Makefile for $(APP_NAME)"
@echo "Targets:"
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'