This repository has been archived by the owner on Aug 12, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 15
/
Makefile
executable file
·74 lines (62 loc) · 3.65 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
WHAT := starter
PWD ?= $(shell pwd)
VERSION ?= $(shell git describe --tags)
REVISION ?= $(shell git rev-parse HEAD)
BRANCH ?= $(shell git rev-parse --abbrev-ref HEAD)
BUILDUSER ?= $(shell id -un)
BUILDTIME ?= $(shell date '+%Y%m%d-%H:%M:%S')
.PHONY: build build-darwin-amd64 build-linux-amd64 build-windows-amd64 clean release static vue-build
build: static
for target in $(WHAT); do \
go build -ldflags "-X github.com/ricoberger/go-vue-starter/pkg/version.Version=${VERSION} \
-X github.com/ricoberger/go-vue-starter/pkg/version.Revision=${REVISION} \
-X github.com/ricoberger/go-vue-starter/pkg/version.Branch=${BRANCH} \
-X github.com/ricoberger/go-vue-starter/pkg/version.BuildUser=${BUILDUSER} \
-X github.com/ricoberger/go-vue-starter/pkg/version.BuildDate=${BUILDTIME}" \
-o ./bin/$$target ./cmd/$$target; \
done
build-darwin-amd64:
for target in $(WHAT); do \
CGO_ENABLED=0 GOARCH=amd64 GOOS=darwin go build -a -installsuffix cgo -ldflags "-X github.com/ricoberger/go-vue-starter/pkg/version.Version=${VERSION} \
-X github.com/ricoberger/go-vue-starter/pkg/version.Revision=${REVISION} \
-X github.com/ricoberger/go-vue-starter/pkg/version.Branch=${BRANCH} \
-X github.com/ricoberger/go-vue-starter/pkg/version.BuildUser=${BUILDUSER} \
-X github.com/ricoberger/go-vue-starter/pkg/version.BuildDate=${BUILDTIME}" \
-o ./bin/go-vue-starter-${VERSION}-darwin-amd64/$$target ./cmd/$$target; \
done
build-linux-amd64:
for target in $(WHAT); do \
CGO_ENABLED=0 GOARCH=amd64 GOOS=linux go build -a -installsuffix cgo -ldflags "-X github.com/ricoberger/go-vue-starter/pkg/version.Version=${VERSION} \
-X github.com/ricoberger/go-vue-starter/pkg/version.Revision=${REVISION} \
-X github.com/ricoberger/go-vue-starter/pkg/version.Branch=${BRANCH} \
-X github.com/ricoberger/go-vue-starter/pkg/version.BuildUser=${BUILDUSER} \
-X github.com/ricoberger/go-vue-starter/pkg/version.BuildDate=${BUILDTIME}" \
-o ./bin/go-vue-starter-${VERSION}-linux-amd64/$$target ./cmd/$$target; \
done
build-windows-amd64:
for target in $(WHAT); do \
CGO_ENABLED=0 GOARCH=amd64 GOOS=windows go build -a -installsuffix cgo -ldflags "-X github.com/ricoberger/go-vue-starter/pkg/version.Version=${VERSION} \
-X github.com/ricoberger/go-vue-starter/pkg/version.Revision=${REVISION} \
-X github.com/ricoberger/go-vue-starter/pkg/version.Branch=${BRANCH} \
-X github.com/ricoberger/go-vue-starter/pkg/version.BuildUser=${BUILDUSER} \
-X github.com/ricoberger/go-vue-starter/pkg/version.BuildDate=${BUILDTIME}" \
-o ./bin/go-vue-starter-${VERSION}-windows-amd64/$$target.exe ./cmd/$$target; \
done
clean:
rm -rf ./bin;
prepare-release: clean vue-build static
$(info "Run: 'git commit' and 'git tag', then 'make release'")
release: build-darwin-amd64 build-linux-amd64 build-windows-amd64
cp ${PWD}/LICENSE ${PWD}/bin/go-vue-starter-${VERSION}-darwin-amd64
cp ${PWD}/LICENSE ${PWD}/bin/go-vue-starter-${VERSION}-linux-amd64
cp ${PWD}/LICENSE ${PWD}/bin/go-vue-starter-${VERSION}-windows-amd64
cp ${PWD}/config.yml ${PWD}/bin/go-vue-starter-${VERSION}-darwin-amd64
cp ${PWD}/config.yml ${PWD}/bin/go-vue-starter-${VERSION}-linux-amd64
cp ${PWD}/config.yml ${PWD}/bin/go-vue-starter-${VERSION}-windows-amd64
cd ${PWD}/bin; tar cfvz go-vue-starter-${VERSION}-darwin-amd64.tar.gz ./go-vue-starter-${VERSION}-darwin-amd64
cd ${PWD}/bin; tar cfvz go-vue-starter-${VERSION}-linux-amd64.tar.gz ./go-vue-starter-${VERSION}-linux-amd64
cd ${PWD}/bin; tar cfvz go-vue-starter-${VERSION}-windows-amd64.tar.gz ./go-vue-starter-${VERSION}-windows-amd64
static:
esc -o pkg/static/static.go -pkg static web/vue.js/dist web/mail
vue-build:
cd ${PWD}/web/vue.js; yarn build