Repository navigation
Expand file tree
/
Copy pathMakefile
More file actions
77 lines (61 loc) · 3.04 KB
/
Copy pathMakefile
File metadata and controls
77 lines (61 loc) · 3.04 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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
MODULE := github.com/jguan/aima/internal/buildinfo
COMMIT := $(shell git rev-parse --short HEAD 2>/dev/null || echo "unknown")
BUILDTIME := $(shell date -u '+%Y-%m-%dT%H:%M:%SZ')
DEV_SERIES := $(shell tr -d '\n' < internal/buildinfo/series.txt 2>/dev/null || echo "v0.2")
EXACT_TAG := $(shell git tag --points-at HEAD --list 'v[0-9]*.[0-9]*.[0-9]*' --sort=-version:refname | head -n 1)
# Only plain vX.Y.Z tags count as product releases. All non-tagged builds belong
# to the current development line declared in internal/buildinfo/series.txt.
VERSION := $(shell if [ -n "$(EXACT_TAG)" ]; then \
printf '%s' "$(EXACT_TAG)"; \
else \
printf '%s-dev' "$(DEV_SERIES)"; \
fi)
LDFLAGS := -s -w \
-X '$(MODULE).Version=$(VERSION)' \
-X '$(MODULE).BuildTime=$(BUILDTIME)' \
-X '$(MODULE).GitCommit=$(COMMIT)'
BUILDDIR := build
.PHONY: build all clean first-run-smoke amd395-build-test amd395-linux-build-test version-audit bundle-tag release-assets publish-release-assets icon-assets windows-syso
## build: Build for the current platform
build:
go build -ldflags "$(LDFLAGS)" -o $(BUILDDIR)/aima ./cmd/aima
## all: Cross-compile for all 4 target platforms
all:
GOOS=windows GOARCH=amd64 go build -ldflags "$(LDFLAGS)" -o $(BUILDDIR)/aima.exe ./cmd/aima
GOOS=darwin GOARCH=arm64 go build -ldflags "$(LDFLAGS)" -o $(BUILDDIR)/aima-darwin-arm64 ./cmd/aima
GOOS=linux GOARCH=arm64 go build -ldflags "$(LDFLAGS)" -o $(BUILDDIR)/aima-linux-arm64 ./cmd/aima
GOOS=linux GOARCH=amd64 go build -ldflags "$(LDFLAGS)" -o $(BUILDDIR)/aima-linux-amd64 ./cmd/aima
## release-assets: Build cross-platform binaries plus checksums for a GitHub release
release-assets:
bash ./scripts/package-release.sh
## icon-assets: Regenerate favicon, desktop icons, and macOS icns from the square app icon SVG
icon-assets:
bash ./scripts/build-platform-icons.sh
## windows-syso: Regenerate the Windows icon resource object used by Explorer for aima.exe
windows-syso:
bash ./scripts/build-windows-syso.sh
## publish-release-assets: Upload the packaged release assets with gh CLI
publish-release-assets:
./scripts/publish-release-assets.sh
## clean: Remove build artifacts
clean:
rm -rf $(BUILDDIR)/aima $(BUILDDIR)/aima.exe $(BUILDDIR)/aima-darwin-arm64 $(BUILDDIR)/aima-linux-arm64 $(BUILDDIR)/aima-linux-amd64
## first-run-smoke: Verify the clean first-run path without live deployment
first-run-smoke:
bash ./scripts/first-run-smoke.sh
## amd395-build-test: Verify AMD395 package and workflow contracts
amd395-build-test:
bash ./scripts/test-package-amd395-windows.sh
go test ./internal/ci
bash ./scripts/test-amd395-windows-workflow.sh
## amd395-linux-build-test: Verify AMD395 Linux package and workflow contracts
amd395-linux-build-test:
bash ./scripts/test-package-amd395-linux.sh
go test ./internal/ci
bash ./scripts/test-amd395-linux-workflow.sh
## version-audit: Show product tags vs legacy product-like tags
version-audit:
./scripts/audit-versioning.sh
## bundle-tag: Create the local replacement bundle tag for legacy stack assets
bundle-tag:
./scripts/create-bundle-tag.sh