-
Notifications
You must be signed in to change notification settings - Fork 17
Expand file tree
/
Copy pathMakefile
More file actions
41 lines (32 loc) · 1.51 KB
/
Makefile
File metadata and controls
41 lines (32 loc) · 1.51 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
VERSION ?= $(shell git describe --tags --always --dirty 2>/dev/null || echo dev)
BUILD_TIME ?= $(shell date -u +%Y-%m-%dT%H:%M:%SZ)
LDFLAGS := -s -w -X main.version=$(VERSION) -X main.buildTime=$(BUILD_TIME) -X main.commit=$(shell git rev-parse --short HEAD 2>/dev/null || echo unknown)
.PHONY: build clean test docker install
# Build for current platform
build:
go build -ldflags "$(LDFLAGS)" -tags "with_quic with_utls with_wireguard with_clash_api" -o xboard-node ./cmd/xboard-node
# Build for Linux amd64
build-linux:
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags "$(LDFLAGS)" -tags "with_quic with_utls with_wireguard with_acme with_clash_api" -o xboard-node-linux-amd64 ./cmd/xboard-node
# Build for Linux arm64
build-linux-arm64:
CGO_ENABLED=0 GOOS=linux GOARCH=arm64 go build -ldflags "$(LDFLAGS)" -tags "with_quic with_utls with_wireguard with_acme with_clash_api" -o xboard-node-linux-arm64 ./cmd/xboard-node
# Build all platforms
build-all: build-linux build-linux-arm64
# Run tests
test:
go test -v -race -count=1 ./internal/...
# Clean build artifacts
clean:
rm -f xboard-node xboard-node-linux-*
# Build Docker image
docker:
docker build -t xboard-node:$(VERSION) -t xboard-node:latest .
# Install to system (single node, legacy compat)
install: build
sudo cp xboard-node /usr/local/bin/
sudo mkdir -p /etc/xboard-node
@if [ ! -f /etc/xboard-node/config.yml ]; then \
sudo cp config.yml.example /etc/xboard-node/config.yml; \
echo "Config copied to /etc/xboard-node/config.yml - please edit it"; \
fi