cmc-sales/go-app/Makefile

46 lines
1.1 KiB
Makefile
Raw Normal View History

2025-06-24 03:32:28 -07:00
.PHONY: help
help: ## Show this help message
@echo 'Usage: make [target]'
@echo ''
@echo 'Targets:'
@awk 'BEGIN {FS = ":.*?## "} /^[a-zA-Z_-]+:.*?## / {printf "\033[36m%-20s\033[0m %s\n", $$1, $$2}' $(MAKEFILE_LIST)
.PHONY: install
install: ## Install dependencies
@echo "Setting up private module configuration..."
go env -w GOPRIVATE=code.springupsoftware.com
go mod download
go install github.com/sqlc-dev/sqlc/cmd/sqlc@latest
.PHONY: sqlc
sqlc: ## Generate Go code from SQL queries
sqlc generate
.PHONY: build
build: sqlc ## Build the application
go build -o bin/server cmd/server/main.go
.PHONY: run
run: ## Run the application
go run cmd/server/main.go
.PHONY: dev
dev: sqlc ## Run the application with hot reload (requires air)
air
.PHONY: test
test: ## Run tests
go test -v ./...
.PHONY: clean
clean: ## Clean build artifacts
rm -rf bin/
rm -rf internal/cmc/db/*.go
.PHONY: docker-build
docker-build: ## Build Docker image
docker build -t cmc-go:latest -f Dockerfile.go .
.PHONY: docker-run
docker-run: ## Run application in Docker
docker run --rm -p 8080:8080 --network=host cmc-go:latest