-
Notifications
You must be signed in to change notification settings - Fork 6
/
Makefile
70 lines (53 loc) · 1.7 KB
/
Makefile
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
OS = darwin linux windows
ARCH = amd64 arm64
default:
make asset
@echo "Build current platform executable..."
go build -o DailyGakki .
static:
make asset
CGO_ENABLED=0 go build -a -ldflags '-s -w -extldflags "-static"' -o DailyGakki .
asset:
@echo "Installing dependencies and building static files......"
@go get -u github.com/go-bindata/go-bindata/...
@go install github.com/go-bindata/go-bindata/...
@~/go/bin/go-bindata -o assets.go images/...
dev:
@~/go/bin/go-bindata -o assets.go images/default.gif
clean:
@rm -rf builds
@rm -f assets.go
@rm -f Gakki
@rm -f DailyGakki
all:
make clean
make asset
@echo "Build all platform executables..."
@for o in $(OS) ; do \
for a in $(ARCH) ; do \
echo "Building $$o-$$a..."; \
if [ "$$o" = "windows" ]; then \
CGO_ENABLED=0 GOOS=$$o GOARCH=$$a go build -ldflags="-s -w" -o builds/DailyGakki-$$o-$$a.exe .; \
else \
CGO_ENABLED=0 GOOS=$$o GOARCH=$$a go build -ldflags="-s -w" -o builds/DailyGakki-$$o-$$a .; \
fi; \
done \
done
@make universal
@make checksum
checksum: builds/*
@echo "Generating checksums..."
if [ "$(shell uname)" = "Darwin" ]; then \
shasum -a 256 $^ >> builds/checksum-sha256sum.txt ;\
else \
sha256sum $^ >> builds/checksum-sha256sum.txt; \
fi
universal:
@echo "Building macOS universal binary..."
docker run --rm -v $(shell pwd)/builds:/app/ bennythink/lipo-linux -create -output \
DailyGakki-darwin-universal \
DailyGakki-darwin-amd64 DailyGakki-darwin-arm64
file builds/DailyGakki-darwin-universal
release:
git tag $(shell git rev-parse --short HEAD)
git push --tags