-
Notifications
You must be signed in to change notification settings - Fork 13
/
Makefile
56 lines (45 loc) · 1.41 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
OS = darwin linux windows
ARCH = amd64 arm64
export DRIVER=$(shell which chromedriver)
default:
@echo "Build current platform executable..."
go build .
static:
@echo "Build static files..."
CGO_ENABLED=0 go build -a -ldflags '-s -w -extldflags "-static"' .
all:
make clean
@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/archiver-$$o-$$a.exe .; \
else \
CGO_ENABLED=0 GOOS=$$o GOARCH=$$a go build -ldflags="-s -w" -o builds/archiver-$$o-$$a .; \
fi; \
done \
done
@make universal
@make checksum
clean:
@rm -rf builds
@rm -f archiver
test:
go test -v -coverprofile=coverage.txt -covermode=atomic
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 \
archiver-darwin-universal \
archiver-darwin-amd64 archiver-darwin-arm64
file builds/archiver-darwin-universal
release:
git tag $(shell git rev-parse --short HEAD)
git push --tags