This repository has been archived by the owner on Feb 8, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathMakefile
69 lines (55 loc) · 1.47 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
BINARY=pi
SOURCE=cmd/pi/pi.go
OWNER=hyperhq
REPO=pi
# These are the values we want to pass for VERSION,COMMIT and BUILD
# git tag v1.0
# git commit -am "One more change after the tags"
VERSION=`git tag --points-at HEAD | head -n 1`
COMMIT=`git rev-parse --short HEAD`
BUILD=`date +%FT%T%z`
# Setup the -ldflags option for go build here, interpolate the variable values
LDFLAGS="-w -s -X github.com/hyperhq/pi.Version=${VERSION} -X github.com/hyperhq/pi.Build=${BUILD} -X github.com/hyperhq/pi.Commit=${COMMIT}"
# Builds the project
build:
./tools/build.sh "${LDFLAGS}"
OSTYPE :=
OSARCH :=
ifeq ($(OS),Windows_NT)
OSTYPE = windows
ifeq ($(PROCESSOR_ARCHITECTURE),AMD64)
OSARCH = amd64
endif
ifeq ($(PROCESSOR_ARCHITECTURE),x86)
OSARCH = 386
endif
else
UNAME_S := $(shell uname -s)
ifeq ($(UNAME_S),Linux)
OSTYPE = linux
endif
ifeq ($(UNAME_S),Darwin)
OSTYPE = darwin
endif
UNAME_M := $(shell uname -m)
ifeq ($(UNAME_M),x86_64)
OSARCH = amd64
endif
ifneq ($(filter %86,$(UNAME_M)),)
OSARCH = 386
endif
ifneq ($(filter arm%,$(UNAME_M)),)
OSARCH = arm
endif
endif
package:
./tools/package.sh ${OSTYPE} ${OSARCH}
release:
./tools/release.sh owner=${OWNER} repo=${REPO} tag=${VERSION} os=${OSTYPE} arch=${OSARCH}
release-latest:
./tools/release.sh owner=${OWNER} repo=${REPO} tag=latest os=${OSTYPE} arch=${OSARCH}
# Cleans our project: deletes binaries
clean:
if [ -f ${BINARY} ] ; then rm ${BINARY} ; fi
rm -rf ${BINARY}*.{tar.gz,zip} ;
.PHONY: clean install