forked from vearne/passwordbox
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
35 lines (23 loc) · 982 Bytes
/
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
VERSION = v0.0.15
CONTAINER=pwbox
IMPORT_PATH = github.com/vearne/passwordbox
BUILD_TIME = $(shell date +%Y%m%d%H%M%S)
GITTAG = `git log -1 --pretty=format:"%H"`
LDFLAGS = -ldflags "-s -w -X $(IMPORT_PATH)/consts.GitTag=${GITTAG} -X $(IMPORT_PATH)/consts.BuildTime=${BUILD_TIME} -X $(IMPORT_PATH)/consts.Version=${VERSION}"
SOURCE_PATH = /go/src/github.com/vearne/passwordbox/
.PHONY: build install release release-linux release-mac docker-img
build:
go build $(LDFLAGS) -o pwbox
install: build
cp -f pwbox /usr/local/bin/
release: release-linux release-mac
release-linux: docker-img
docker run -v `pwd`:$(SOURCE_PATH) -t -e GOOS=linux -e GOARCH=amd64 -i $(CONTAINER) go build $(LDFLAGS) -o pwbox
tar -zcvf pwbox-$(VERSION)-linux-amd64.tar.gz ./pwbox
rm pwbox
release-mac:
env GOOS=darwin GOARCH=amd64 go build $(LDFLAGS) -o pwbox
tar -zcvf pwbox-$(VERSION)-darwin-amd64.tar.gz ./pwbox
rm pwbox
docker-img:
docker build --rm -t $(CONTAINER) -f Dockerfile.dev .