-
Notifications
You must be signed in to change notification settings - Fork 5
/
Makefile
85 lines (67 loc) · 2.51 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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
export NAME=ecal
export TAG=`git describe --abbrev=0 --tags`
# CGO_ENABLED is enabled here to support Go plugins
# if Go plugins are not used this can be disabled.
export CGO_ENABLED=1
export GOOS=linux
all: build
clean:
rm -f ecal
mod:
go mod init || true
go mod tidy
test:
go test -p 1 ./...
cover:
go test -p 1 --coverprofile=coverage.out ./...
go tool cover --html=coverage.out -o coverage.html
sh -c "open coverage.html || xdg-open coverage.html" 2>/dev/null
fmt:
gofmt -l -w -s .
vet:
go vet ./...
generate:
go generate devt.de/krotik/ecal/stdlib/generate
build: clean mod generate fmt vet
go build -ldflags "-s -w" -o $(NAME) cli/*.go
build-mac: clean mod generate fmt vet
CGO_ENABLED=0 GOOS=darwin GOARCH=amd64 go build -o $(NAME).mac cli/*.go
build-win: clean mod generate fmt vet
CGO_ENABLED=0 GOOS=windows GOARCH=amd64 go build -o $(NAME).exe cli/*.go
build-arm7: clean mod generate fmt vet
CGO_ENABLED=0 GOOS=linux GOARCH=arm GOARM=7 go build -o $(NAME).arm7 cli/*.go
build-arm8: clean mod generate fmt vet
CGO_ENABLED=0 GOOS=linux GOARCH=arm64 go build -o $(NAME).arm8 cli/*.go
dist: build build-win build-mac build-arm7 build-arm8
rm -fR dist
mkdir -p dist/$(NAME)_linux_amd64
mv $(NAME) dist/$(NAME)_linux_amd64
cp -fR examples dist/$(NAME)_linux_amd64
cp LICENSE dist/$(NAME)_linux_amd64
cp NOTICE dist/$(NAME)_linux_amd64
tar --directory=dist -cz $(NAME)_linux_amd64 > dist/$(NAME)_$(TAG)_linux_amd64.tar.gz
mkdir -p dist/$(NAME)_darwin_amd64
mv $(NAME).mac dist/$(NAME)_darwin_amd64/$(NAME)
cp -fR examples dist/$(NAME)_darwin_amd64
cp LICENSE dist/$(NAME)_darwin_amd64
cp NOTICE dist/$(NAME)_darwin_amd64
tar --directory=dist -cz $(NAME)_darwin_amd64 > dist/$(NAME)_$(TAG)_darwin_amd64.tar.gz
mkdir -p dist/$(NAME)_windows_amd64
mv $(NAME).exe dist/$(NAME)_windows_amd64
cp -fR examples dist/$(NAME)_windows_amd64
cp LICENSE dist/$(NAME)_windows_amd64
cp NOTICE dist/$(NAME)_windows_amd64
tar --directory=dist -cz $(NAME)_windows_amd64 > dist/$(NAME)_$(TAG)_windows_amd64.tar.gz
mkdir -p dist/$(NAME)_arm7
mv $(NAME).arm7 dist/$(NAME)_arm7
cp -fR examples dist/$(NAME)_arm7
cp LICENSE dist/$(NAME)_arm7
cp NOTICE dist/$(NAME)_arm7
tar --directory=dist -cz $(NAME)_arm7 > dist/$(NAME)_$(TAG)_arm7.tar.gz
mkdir -p dist/$(NAME)_arm8
mv $(NAME).arm8 dist/$(NAME)_arm8
cp -fR examples dist/$(NAME)_arm8
cp LICENSE dist/$(NAME)_arm8
cp NOTICE dist/$(NAME)_arm8
tar --directory=dist -cz $(NAME)_arm8 > dist/$(NAME)_$(TAG)_arm8.tar.gz
sh -c 'cd dist; sha256sum *.tar.gz' > dist/checksums.txt