Files
tm_back/Makefile
T
n.nakhostin 5f38c8e787 Update Makefile for multi-platform builds and remove obsolete test scripts
- Added new build targets in the Makefile for macOS (Intel and Apple Silicon) and a target to build for all platforms.
- Removed outdated test scripts for server and Swagger documentation testing that are no longer needed.
- Cleaned up the project structure by deleting unnecessary files to streamline the build process.
2025-08-10 17:02:10 +03:30

111 lines
2.6 KiB
Makefile

# Tender Management Backend Makefile
.PHONY: help build run test clean docker-build docker-run
# Default target
help:
@echo "Available targets:"
@echo " build - Build the web server"
@echo " build-mac - Build for macOS (Intel)"
@echo " build-mac-arm64 - Build for macOS (Apple Silicon)"
@echo " build-all - Build for all platforms"
@echo " run - Run the web server"
@echo " test - Run tests"
@echo " clean - Clean build artifacts"
@echo " docker-build - Build Docker image"
@echo " docker-run - Run Docker container"
# Build the web server
build:
@echo "Building web server..."
@mkdir -p bin
@go build -o bin/web ./cmd/web
@echo "Build completed successfully!"
# Build for macOS (Intel)
build-mac:
@echo "Building web server for macOS (Intel)..."
@mkdir -p bin
@GOOS=darwin GOARCH=amd64 go build -o bin/web-mac ./cmd/web
@echo "macOS Intel build completed successfully!"
# Build for macOS (Apple Silicon)
build-mac-arm64:
@echo "Building web server for macOS (Apple Silicon)..."
@mkdir -p bin
@GOOS=darwin GOARCH=arm64 go build -o bin/web-mac-arm64 ./cmd/web
@echo "macOS ARM64 build completed successfully!"
# Build for all platforms
build-all: build build-mac build-mac-arm64
@echo "All platform builds completed successfully!"
# Run the web server
run: build
@echo "Starting web server..."
@./bin/web
# Run tests
test:
@echo "Running tests..."
@go test ./...
# Clean build artifacts
clean:
@echo "Cleaning build artifacts..."
@rm -rf bin/
@go clean
# Build Docker image
docker-build:
@echo "Building Docker image..."
@docker build -t tender-management-api .
# Run Docker container
docker-run:
@echo "Running Docker container..."
@docker run -p 8081:8081 tender-management-api
# Development with hot reload (requires air)
dev:
@echo "Starting development server with hot reload..."
@air
# Install development dependencies
install-dev:
@echo "Installing development dependencies..."
@go install github.com/cosmtrek/air@latest
# Format code
fmt:
@echo "Formatting code..."
@go fmt ./...
# Vet code
vet:
@echo "Vetting code..."
@go vet ./...
# Lint code (requires golangci-lint)
lint:
@echo "Linting code..."
@golangci-lint run
# Generate API documentation
docs:
@echo "Generating API documentation..."
@swag init -g cmd/web/main.go -o cmd/web/docs
@echo "Swagger documentation generated successfully!"
# Run server with documentation
run-docs: docs run
# Database migrations (placeholder)
migrate:
@echo "Running database migrations..."
@echo "TODO: Implement database migrations"
# Seed database (placeholder)
seed:
@echo "Seeding database..."
@echo "TODO: Implement database seeding"