| 1 |
# Makefile for debpkg |
| 2 |
|
| 3 |
.PHONY: build install clean test run-example help |
| 4 |
|
| 5 |
BINARY_NAME=debpkg |
| 6 |
INSTALL_PATH=/usr/local/bin |
| 7 |
|
| 8 |
# Default target |
| 9 |
all: build |
| 10 |
|
| 11 |
# Build the application |
| 12 |
build: |
| 13 |
@echo "Building $(BINARY_NAME)..." |
| 14 |
go build -o $(BINARY_NAME) . |
| 15 |
@echo "Build complete: ./$(BINARY_NAME)" |
| 16 |
|
| 17 |
# Install the application to system |
| 18 |
install: build |
| 19 |
@echo "Installing $(BINARY_NAME) to $(INSTALL_PATH)..." |
| 20 |
sudo cp $(BINARY_NAME) $(INSTALL_PATH)/ |
| 21 |
@echo "Installation complete. You can now run '$(BINARY_NAME)' from anywhere." |
| 22 |
|
| 23 |
# Clean build artifacts |
| 24 |
clean: |
| 25 |
@echo "Cleaning..." |
| 26 |
rm -f $(BINARY_NAME) |
| 27 |
go clean |
| 28 |
|
| 29 |
# Run tests |
| 30 |
test: |
| 31 |
@echo "Running tests..." |
| 32 |
go test ./... |
| 33 |
|
| 34 |
# Download dependencies |
| 35 |
deps: |
| 36 |
@echo "Downloading dependencies..." |
| 37 |
go mod download |
| 38 |
go mod tidy |
| 39 |
|
| 40 |
# Show help |
| 41 |
help: |
| 42 |
@echo "Available targets:" |
| 43 |
@echo " build - Build the application" |
| 44 |
@echo " install - Install the application to $(INSTALL_PATH)" |
| 45 |
@echo " clean - Clean build artifacts" |
| 46 |
@echo " test - Run tests" |
| 47 |
@echo " deps - Download and tidy dependencies" |
| 48 |
@echo " help - Show this help message" |