-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
70 lines (50 loc) · 3.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
57
58
59
60
61
62
63
64
65
66
67
68
.SUFFIXES:
.PHONY: debug release clean version revive push all tag upload
SOURCES = $(shell find . -type f -name '*.go')
STATICFILES = $(shell find static -type f)
GITHUB_TOKEN = $(shell cat token)
BINARY=reaper
FULL=github.com/stephane-martin/reaper
VERSION=0.1.1
LDFLAGS=-ldflags '-X main.Version=${VERSION} -X main.GinMode=debug'
LDFLAGS_RELEASE=-ldflags '-w -s -X main.Version=${VERSION} -X main.GinMode=release'
debug: ${BINARY}_debug
release: ${BINARY}
tag:
git add .
git commit -m "Version ${VERSION}"
git tag -a ${VERSION} -m "Version ${VERSION}"
git push
git push --tags
upload: all
github-release release --user stephane-martin --repo reaper --tag "${VERSION}" --name "v${VERSION}" --description "Version ${VERSION}" --security-token "${GITHUB_TOKEN}"
github-release upload --user stephane-martin --tag "${VERSION}" --repo reaper --security-token "${GITHUB_TOKEN}" --file reaper_linux_amd64 --name reaper_linux_amd64
github-release upload --user stephane-martin --tag "${VERSION}" --repo reaper --security-token "${GITHUB_TOKEN}" --file reaper_linux_arm --name reaper_linux_arm
github-release upload --user stephane-martin --tag "${VERSION}" --repo reaper --security-token "${GITHUB_TOKEN}" --file reaper_linux_arm64 --name reaper_linux_arm64
github-release upload --user stephane-martin --tag "${VERSION}" --repo reaper --security-token "${GITHUB_TOKEN}" --file reaper_openbsd_amd64 --name reaper_openbsd_amd64
github-release upload --user stephane-martin --tag "${VERSION}" --repo reaper --security-token "${GITHUB_TOKEN}" --file reaper_freebsd_amd64 --name reaper_freebsd_amd64
${BINARY}_debug: ${SOURCES} ${STATICFILES} model_gen.go bindata.go
CGO_ENABLED=0 go build -x -tags 'netgo osusergo' -o ${BINARY}_debug ${LDFLAGS} ${FULL}
${BINARY}: ${SOURCES} ${STATICFILES} model_gen.go bindata.go
CGO_ENABLED=0 go build -a -installsuffix nocgo -tags 'netgo osusergo' -o ${BINARY} ${LDFLAGS_RELEASE} ${FULL}
${BINARY}_openbsd_amd64: ${SOURCES} ${STATICFILES} model_gen.go bindata.go
GOOS=openbsd GOARCH=amd64 CGO_ENABLED=0 go build -a -installsuffix nocgo -tags 'netgo osusergo' -o ${BINARY}_openbsd_amd64 ${LDFLAGS_RELEASE} ${FULL}
${BINARY}_freebsd_amd64: ${SOURCES} ${STATICFILES} model_gen.go bindata.go
GOOS=freebsd GOARCH=amd64 CGO_ENABLED=0 go build -a -installsuffix nocgo -tags 'netgo osusergo' -o ${BINARY}_freebsd_amd64 ${LDFLAGS_RELEASE} ${FULL}
${BINARY}_linux_amd64: ${SOURCES} ${STATICFILES} model_gen.go bindata.go
GOOS=linux GOARCH=amd64 CGO_ENABLED=0 go build -a -installsuffix nocgo -tags 'netgo osusergo' -o ${BINARY}_linux_amd64 ${LDFLAGS_RELEASE} ${FULL}
${BINARY}_linux_arm: ${SOURCES} ${STATICFILES} model_gen.go bindata.go
GOOS=linux GOARCH=arm CGO_ENABLED=0 go build -a -installsuffix nocgo -tags 'netgo osusergo' -o ${BINARY}_linux_arm ${LDFLAGS_RELEASE} ${FULL}
${BINARY}_linux_arm64: ${SOURCES} ${STATICFILES} model_gen.go bindata.go
GOOS=linux GOARCH=arm64 CGO_ENABLED=0 go build -a -installsuffix nocgo -tags 'netgo osusergo' -o ${BINARY}_linux_arm64 ${LDFLAGS_RELEASE} ${FULL}
all: ${BINARY}_openbsd_amd64 ${BINARY}_freebsd_amd64 ${BINARY}_linux_amd64 ${BINARY}_linux_arm ${BINARY}_linux_arm64 README.rst
model_gen.go: model.go
msgp -file model.go
bindata.go: static/stream.html
go-bindata -fs static/
clean:
rm -f ${BINARY} ${BINARY}_debug
revive:
revive -formatter stylish ./...
README.rst: docs/README.md
pandoc --from markdown --to rst --toc --number-sections --standalone -o README.rst docs/README.md