-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
35 lines (29 loc) · 738 Bytes
/
Copy pathMakefile
File metadata and controls
35 lines (29 loc) · 738 Bytes
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
all:
go mod tidy
go build -ldflags="-s -w" -trimpath -o ./dist/envy .
clean:
rm -rf ./dist
dev:
go build -o ./dist/envy .
BINARY := envy
VERSION := $(shell git describe --tags --always --dirty)
OUTPUT := dist
GOOSARCHES = \
linux/amd64 \
linux/arm64 \
darwin/amd64 \
darwin/arm64 \
windows/amd64 \
windows/arm64
prod:
@echo "==> Building version $(VERSION)"
@mkdir -p $(OUTPUT)
@for platform in $(GOOSARCHES); do \
OS=$${platform%/*}; \
ARCH=$${platform#*/}; \
EXT=""; \
if [ $$OS = "windows" ]; then EXT=".exe"; fi; \
OUTFILE=$(OUTPUT)/$(BINARY)-$(VERSION)-$$OS-$$ARCH$$EXT; \
echo " -> $$OS/$$ARCH"; \
GOOS=$$OS GOARCH=$$ARCH go build -ldflags="-s -w" -trimpath -o $$OUTFILE . || exit 1; \
done