Repository navigation
Expand file tree
/
Copy pathMakefile
More file actions
61 lines (49 loc) · 1.69 KB
/
Copy pathMakefile
File metadata and controls
61 lines (49 loc) · 1.69 KB
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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
# WarpGUI Makefile
# Windows platform guard (WarpGUI is strictly Linux-native)
ifeq ($(OS),Windows_NT)
$(error WarpGUI is a Linux-native GTK application and cannot be built or run on Windows)
endif
APP_NAME := WarpGUI
SRC_DIR := ./src
BUILDS_DIR := builds
VERSION ?= 1.0.0
BUILD_DATE := $(shell date +'%Y-%m-%d')
# Go linker flags
LDFLAGS := -s -w -X 'main.Version=$(VERSION)' -X 'main.BuildDate=$(BUILD_DATE)'
.PHONY: help clean setup lint format test run build
## help: Show available targets
help:
@echo $(APP_NAME) Build Targets:
@echo make clean - Remove $(BUILDS_DIR)/ directory and test artifacts
@echo make setup - Download and tidy Go dependencies
@echo make lint - Run static analysis without modifying files
@echo make format - Format code, organize imports, and run static analysis
@echo make test - Run unit tests with code coverage
@echo make run - Run locally directly from source in-place
@echo make build - Compile optimized Linux binary into $(BUILDS_DIR)/
## clean: Remove build artifacts
clean:
@rm -rf $(BUILDS_DIR) coverage.out profile.cov
## setup: Download and tidy Go dependencies
setup:
go mod download
go mod tidy
## lint: Run static analysis and vet checks
lint:
go vet ./...
go tool staticcheck ./...
## format: Format code, organize imports, and run static analysis
format:
gofmt -s -w .
go tool goimports -w .
$(MAKE) lint
## test: Run unit tests with code coverage
test:
go test -v -cover ./...
## run: Run locally directly from source
run:
go run $(SRC_DIR) -in-place
## build: Compile optimized production binary
build:
@mkdir -p $(BUILDS_DIR)
CGO_ENABLED=1 go build -ldflags="$(LDFLAGS)" -o $(BUILDS_DIR)/$(APP_NAME)_Linux_x64 $(SRC_DIR)