forked from go-nv/goenv
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
84 lines (60 loc) · 2.1 KB
/
Copy pathMakefile
File metadata and controls
84 lines (60 loc) · 2.1 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
78
79
80
81
82
83
84
# Go-based goenv Makefile
# Build variables
BINARY_NAME = goenv
VERSION ?= $(shell cat APP_VERSION 2>/dev/null || echo "dev")
COMMIT_SHA ?= $(shell git rev-parse --short HEAD 2>/dev/null || echo "unknown")
BUILD_TIME ?= $(shell date -u +"%Y-%m-%dT%H:%M:%SZ")
LDFLAGS = -ldflags "-X main.version=$(VERSION) -X main.commit=$(COMMIT_SHA) -X main.buildTime=$(BUILD_TIME)"
# Default installation prefix
export PREFIX ?= /usr/local
# Build targets
.PHONY: build clean test install uninstall dev-deps all cross-build generate-embedded test-windows release snapshot
.DEFAULT=build
# Default target
all: build
# Generate embedded versions from API (run before releases)
generate-embedded:
go run scripts/build-tool/main.go -task=generate-embedded
build:
go run scripts/build-tool/main.go -task=build
build-swap:: build swap
# alias for build-swap
bs: build-swap
test:
unset GOENV_DEBUG && go run scripts/build-tool/main.go -task=test
# Test Windows compatibility (can run on any OS)
test-windows:
go run scripts/build-tool/main.go -task=test-windows
clean:
go run scripts/build-tool/main.go -task=clean
install: build
go run scripts/build-tool/main.go -task=install
uninstall:
go run scripts/build-tool/main.go -task=uninstall
dev-deps:
go run scripts/build-tool/main.go -task=dev-deps
# Cross-platform builds for releases
cross-build: generate-embedded
go run scripts/build-tool/main.go -task=cross-build
# Migration helpers - these preserve some compatibility while transitioning
.PHONY: migrate-test
# Run Go tests alongside existing bats tests during migration
migrate-test:
go run scripts/build-tool/main.go -task=migrate-test
bats-test:
go run scripts/build-tool/main.go -task=bats-test
# Show version information
version:
go run scripts/build-tool/main.go -task=version
# Cross-platform build tool (delegates to Go-based tool)
build-tool:
go run scripts/build-tool/main.go -task=$(TASK)
# GoReleaser targets
release:
go run scripts/build-tool/main.go -task=release
snapshot:
go run scripts/build-tool/main.go -task=snapshot
restore:
go run ./scripts/swap/main.go bash
swap:
go run ./scripts/swap/main.go go