-
Notifications
You must be signed in to change notification settings - Fork 30
/
Makefile
50 lines (36 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
VERSION ?= $(shell git describe --always --dirty)
export VERSION
help:
@echo 'make build - build the clipper executable'
@echo 'make tag - tag the current HEAD with VERSION'
@echo 'make archive - create an archive of the current HEAD for VERSION'
@echo 'make upload - upload the built archive of VERSION to Amazon S3'
@echo 'make all - build, tag, archive and upload VERSION'
version:
@if [ "$$VERSION" = "" ]; then echo "VERSION not set"; exit 1; fi
clipper_linux:
GOOS=linux GOARCH=amd64 go build -ldflags="-X main.version=${VERSION}" -o clipper_linux clipper.go
clipper_darwin:
GOOS=darwin GOARCH=amd64 go build -ldflags="-X main.version=${VERSION}" -o clipper_darwin clipper.go
clipper_all: clipper_linux clipper_darwin
clipper: clipper.go
go build -ldflags="-X main.version=${VERSION}" $^
build: clipper
tag: version
git tag -s ${VERSION} -m "${VERSION} release"
archive: clipper-${VERSION}.zip
clipper-${VERSION}.zip: clipper
git archive -o $@ HEAD
zip $@ clipper
upload: clipper-${VERSION}.zip
# Requires credentials to have been set up with: `aws configure`
# Verify credential set-up with: `aws sts get-caller-identity`
# See also: ~/.aws/credentials
aws s3 cp "clipper-${VERSION}.zip" s3://wincent/clipper/releases/clipper-${VERSION}.zip --acl public-read
brew:
brew bump --open-pr clipper
all: tag build archive upload
.PHONY: clean
clean:
rm -f clipper clipper-*.zip
rm -f clipper_*