-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
37 lines (29 loc) · 877 Bytes
/
Makefile
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
# Application name
APP_NAME = blumfield
# Directories and Files
BUILD_DIR = ./build
# Default target
.DEFAULT_GOAL := build
# Commands
.PHONY: build test db prod run clean sqlc
# Build the Go project
build:
go build -v -o $(BUILD_DIR)/$(APP_NAME) ./main.go
# Run tests
test:
go test -v -race -timeout 30s ./...
# Production build for different platforms
prod:
@if [ "$(filter windows,$(MAKECMDGOALS))" != "" ]; then \
GOOS=windows GOARCH=amd64 go build -o $(BUILD_DIR)/$(APP_NAME)-win-x86.exe -v ./main.go; \
elif [ "$(filter macos,$(MAKECMDGOALS))" != "" ]; then \
GOOS=darwin GOARCH=amd64 go build -o $(BUILD_DIR)/$(APP_NAME)-darwin-amd64 -v ./main.go; \
else \
GOOS=linux GOARCH=amd64 go build -o $(BUILD_DIR)/$(APP_NAME)-linux-amd64 -v ./main.go; \
fi
# Run the app
run:
go run ./main.go
# Clean build artifacts
clean:
rm -f $(BUILD_DIR)/$(APP_NAME)*