-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
46 lines (36 loc) · 1.22 KB
/
Copy pathMakefile
File metadata and controls
46 lines (36 loc) · 1.22 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
.PHONY: help build build-win build-prod dev clean tidy lint test
BUILD_DIR := dist
VERSION := $(shell cat VERSION 2>/dev/null || echo "dev")
LDFLAGS := -s -w -buildid= -X 'zephyr/shared/version.Version=$(VERSION)'
help:
@echo "Usage:"
@echo " make build Build for Linux"
@echo " make build-win Build for Windows"
@echo " make build-prod Build with UPX compression"
@echo " make dev Run in dev mode"
@echo " make tidy Run go mod tidy"
@echo " make test Run all tests"
@echo " make lint Run golangci-lint + vue-tsc"
@echo " make clean Remove build artifacts"
build:
@mkdir -p $(BUILD_DIR)
CGO_ENABLED=0 go build -ldflags="$(LDFLAGS)" -trimpath -o $(BUILD_DIR)/zephyr .
@echo "Built: $(BUILD_DIR)/zephyr ($(VERSION))"
build-win:
@mkdir -p $(BUILD_DIR)
GOOS=windows GOARCH=amd64 CGO_ENABLED=0 go build -ldflags="$(LDFLAGS)" -trimpath -o $(BUILD_DIR)/zephyr.exe .
@echo "Built: $(BUILD_DIR)/zephyr.exe ($(VERSION))"
build-prod: build
upx --best $(BUILD_DIR)/zephyr
@echo "Compressed: $(BUILD_DIR)/zephyr"
dev:
go run . start
test:
go test ./... -count=1 -timeout 120s
tidy:
go mod tidy
lint:
golangci-lint run
cd frontend && npm run check
clean:
rm -rf $(BUILD_DIR)