# Default target .DEFAULT_GOAL := help # Build configuration BINARY_NAME := wild-api VERSION ?= 0.1.1 BUILD_DIR := build # Go build configuration GO_VERSION := $(shell go version | cut -d' ' -f3) GIT_COMMIT := $(shell git rev-parse --short HEAD 2>/dev/null || echo "unknown") BUILD_TIME := $(shell date -u '+%Y-%m-%d_%H:%M:%S') LDFLAGS := -X main.Version=$(VERSION) -X main.GitCommit=$(GIT_COMMIT) -X main.BuildTime=$(BUILD_TIME) .PHONY: help build clean test run install check fmt vet lint deps-check version # Usage: $(call package_deb,architecture,binary_name) help: @echo "๐Ÿ—๏ธ Wild Cloud API Build System" @echo "" @echo "๐Ÿ“ฆ Build targets (compile binaries):" @echo " build - Build for current architecture" @echo "" @echo "๐Ÿ” Quality assurance:" @echo " check - Run all checks (fmt + vet + test)" @echo " fmt - Format Go code" @echo " vet - Run go vet" @echo " test - Run tests" @echo "" @echo "๐Ÿ› ๏ธ Development:" @echo " run - Run application locally" @echo " clean - Remove all build artifacts" @echo " deps-check - Verify and tidy dependencies" @echo " version - Show build information" @echo " install - Install to system" @echo "" @echo "๐Ÿ“ Directory structure:" @echo " build/ - Intermediate build artifacts" build: @echo "Building $(BINARY_NAME) for current architecture..." @mkdir -p $(BUILD_DIR) go build -ldflags="$(LDFLAGS)" -o $(BUILD_DIR)/$(BINARY_NAME) . @echo "โœ… Build complete: $(BUILD_DIR)/$(BINARY_NAME)" clean: @echo "๐Ÿงน Cleaning build artifacts..." @rm -rf $(BUILD_DIR) $(DIST_DIR) $(DEB_DIR)-* $(DEB_DIR) @go clean @echo "โœ… Clean complete" test: @echo "๐Ÿงช Running tests..." @go test -v ./... run: @echo "๐Ÿš€ Running $(BINARY_NAME)..." @go run -ldflags="$(LDFLAGS)" . # Code quality targets fmt: @echo "๐ŸŽจ Formatting code..." @go fmt ./... @echo "โœ… Format complete" vet: @echo "๐Ÿ” Running go vet..." @go vet ./... @echo "โœ… Vet complete" check: fmt vet test @echo "โœ… All checks passed" # Dependency management deps-check: @echo "๐Ÿ“ฆ Checking dependencies..." @go mod verify @go mod tidy @echo "โœ… Dependencies verified" # Version information version: @echo "Version: $(VERSION)" @echo "Git Commit: $(GIT_COMMIT)" @echo "Build Time: $(BUILD_TIME)" @echo "Go Version: $(GO_VERSION)" dev: go run . & echo "Server started on http://localhost:5055"