aboutsummaryrefslogtreecommitdiffstats
path: root/backend/Makefile
blob: 0506ee3105aebd564aa9e962b2b89356d197c13e (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
# Makefile for the finance backend application

# Variables
BINARY_NAME=finance-backend
GO=go
GOTEST=$(GO) test
GOVET=$(GO) vet
GOBUILD=$(GO) build

.PHONY: all build clean test vet run lint

# Default target
all: test build

# Build the application
build:
	$(GOBUILD) -o $(BINARY_NAME) ./cmd/api/main.go

# Clean build files
clean:
	rm -f $(BINARY_NAME)

# Run the application
run: build
	./$(BINARY_NAME)

# Run all tests with verbose output
test:
	$(GOTEST) -v ./...

# Test only the handlers
test-handlers:
	$(GOTEST) -v ./handlers/...

# Run code vetting
vet:
	$(GOVET) ./...

# Run linting (requires golint)
lint:
	@command -v golint >/dev/null 2>&1 || { echo >&2 "golint not installed. Installing..."; $(GO) install golang.org/x/lint/golint@latest; }
	golint ./...

# Run tests with coverage report
test-coverage:
	$(GOTEST) -coverprofile=coverage.out ./...
	$(GO) tool cover -html=coverage.out