Makefile Reference¶
Scansca includes a comprehensive Makefile to simplify development, building, testing, and documentation workflows. This document explains all available make targets and how to use them.
Quick Reference¶
| Category | Command | Description |
|---|---|---|
| Building | make build |
Build the Scansca binary |
make clean |
Remove build artifacts | |
make all |
Clean and build | |
make run |
Build and run Scansca | |
| Dependencies | make deps |
Download Go dependencies |
make tidy |
Clean up Go module files | |
| Docker | make docker |
Build Docker image |
make docker-compose |
Start services with Docker Compose | |
make docker-compose-down |
Stop Docker Compose services | |
| Code Quality | make lint |
Run linters |
make fmt |
Format code | |
make vet |
Run Go vet | |
make test |
Run tests | |
| Documentation | make docs |
Start documentation server |
make docs-stop |
Stop documentation server |
Building and Running¶
Building the Application¶
To build the Scansca binary:
1 | |
This creates a binary in the bin/ directory.
Cleaning Build Artifacts¶
To remove build artifacts:
1 | |
Building and Running in One Step¶
To build and immediately run Scansca:
1 | |
Dependency Management¶
Downloading Dependencies¶
To download all Go module dependencies:
1 | |
Tidying Dependencies¶
To clean up unused dependencies in Go module files:
1 | |
Docker Operations¶
Building a Docker Image¶
To build a Docker image for Scansca:
1 | |
Running with Docker Compose¶
To start Scansca and its dependencies (like PostgreSQL) using Docker Compose:
1 | |
Stopping Docker Compose Services¶
To stop all services started with Docker Compose:
1 | |
Code Quality¶
Running Linters¶
To run code linters:
1 | |
Formatting Code¶
To automatically format Go code:
1 | |
Vetting Code¶
To run Go's static analysis tool:
1 | |
Running Tests¶
To run all tests:
1 | |
Documentation¶
Starting the Documentation Server¶
To build and start the documentation server:
1 | |
By default, this serves documentation at http://localhost:8090. You can change the port by setting the DOCS_PORT environment variable:
1 | |
Stopping the Documentation Server¶
To stop the running documentation server:
1 | |
Environment Variables¶
The Makefile supports several environment variables:
| Variable | Default | Description |
|---|---|---|
VERSION |
Git describe output or "dev" | Sets the version string in the binary |
DOCS_PORT |
8090 | The port for the documentation server |
Extending the Makefile¶
To add new targets to the Makefile, follow these guidelines:
- Add the target name to the
.PHONYlist - Place the target in the appropriate section
- Add comments to explain what the target does
- Follow the established pattern for echo commands
Example of adding a new target:
1 2 3 4 | |