Files
buque/Makefile
2025-11-02 01:39:56 +01:00

77 líneas
2.0 KiB
Makefile

.PHONY: build run clean install test fmt vet
# Binary name
BINARY_NAME=buque
BUILD_DIR=bin
# Build the project
build:
@echo "Building $(BINARY_NAME)..."
@mkdir -p $(BUILD_DIR)
@go build -o $(BUILD_DIR)/$(BINARY_NAME) ./cmd/buque
# Run the application
run: build
@./$(BUILD_DIR)/$(BINARY_NAME)
# Clean build artifacts
clean:
@echo "Cleaning..."
@rm -rf $(BUILD_DIR)
@go clean
# Install the binary to $GOPATH/bin
install:
@echo "Installing $(BINARY_NAME)..."
@go install ./cmd/buque
# Run tests
test:
@echo "Running tests..."
@go test -v ./...
# Format code
fmt:
@echo "Formatting code..."
@go fmt ./...
# Run go vet
vet:
@echo "Running go vet..."
@go vet ./...
# Download dependencies
deps:
@echo "Downloading dependencies..."
@go mod download
@go mod tidy
# Build for multiple platforms
build-all:
@echo "Building for multiple platforms..."
@mkdir -p $(BUILD_DIR)
GOOS=linux GOARCH=amd64 go build -o $(BUILD_DIR)/$(BINARY_NAME)-linux-amd64 ./cmd/buque
GOOS=linux GOARCH=arm64 go build -o $(BUILD_DIR)/$(BINARY_NAME)-linux-arm64 ./cmd/buque
GOOS=darwin GOARCH=amd64 go build -o $(BUILD_DIR)/$(BINARY_NAME)-darwin-amd64 ./cmd/buque
GOOS=darwin GOARCH=arm64 go build -o $(BUILD_DIR)/$(BINARY_NAME)-darwin-arm64 ./cmd/buque
GOOS=windows GOARCH=amd64 go build -o $(BUILD_DIR)/$(BINARY_NAME)-windows-amd64.exe ./cmd/buque
# Development mode with auto-reload (requires air: go install github.com/cosmtrek/air@latest)
dev:
@air
# Show help
help:
@echo "Available targets:"
@echo " build - Build the binary"
@echo " run - Build and run the application"
@echo " clean - Remove build artifacts"
@echo " install - Install binary to GOPATH/bin"
@echo " test - Run tests"
@echo " fmt - Format code"
@echo " vet - Run go vet"
@echo " deps - Download and tidy dependencies"
@echo " build-all - Build for multiple platforms"
@echo " dev - Run in development mode with auto-reload"
@echo " help - Show this help message"