-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
40 lines (30 loc) · 1.12 KB
/
Copy pathMakefile
File metadata and controls
40 lines (30 loc) · 1.12 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
BINARY := free-proxy
VERSION := $(shell git describe --tags --always 2>/dev/null || echo dev)
LDFLAGS := -s -w -X main.version=$(VERSION)
GOFLAGS := -trimpath
.PHONY: all build build-go frontend gen test vet cross clean tidy
all: build
## frontend: build the React app into internal/web/dist
frontend:
cd frontend && bun install && bun run build
## gen: regenerate sqlc code (requires sqlc in PATH)
gen:
cd internal/store && sqlc generate
## build: build the single static binary (frontend + go)
build: frontend build-go
## build-go: build the Go binary only (assumes frontend already built)
build-go:
CGO_ENABLED=0 go build $(GOFLAGS) -ldflags "$(LDFLAGS)" -o dist/$(BINARY) ./cmd/free-proxy
## test / vet
test:
go test ./...
vet:
go vet ./...
## cross: static Linux binaries for amd64 and arm64
cross: frontend
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build $(GOFLAGS) -ldflags "$(LDFLAGS)" -o dist/$(BINARY)-linux-amd64 ./cmd/free-proxy
CGO_ENABLED=0 GOOS=linux GOARCH=arm64 go build $(GOFLAGS) -ldflags "$(LDFLAGS)" -o dist/$(BINARY)-linux-arm64 ./cmd/free-proxy
clean:
rm -rf dist internal/web/dist/assets
tidy:
go mod tidy