-
Notifications
You must be signed in to change notification settings - Fork 5
/
Makefile.build.mk
49 lines (45 loc) · 1.3 KB
/
Makefile.build.mk
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
export GOPROXY=https://proxy.golang.org
export CGO_ENABLED=0
SHELL := /bin/bash -o pipefail
VERSION_PACKAGE = github.com/replicatedhq/replicated-sdk/pkg/buildversion
VERSION?=$(if $(GIT_TAG),$(GIT_TAG),alpha)
DATE=`date -u +"%Y-%m-%dT%H:%M:%SZ"`
GIT_TREE = $(shell git rev-parse --is-inside-work-tree 2>/dev/null)
ifneq "$(GIT_TREE)" ""
define GIT_UPDATE_INDEX_CMD
git update-index --assume-unchanged
endef
define GIT_SHA
`git rev-parse HEAD`
endef
else
define GIT_UPDATE_INDEX_CMD
echo "Not a git repo, skipping git update-index"
endef
define GIT_SHA
""
endef
endif
ifeq ("$(DEBUG_REPLICATED)", "1")
define LDFLAGS
-ldflags "\
-X ${VERSION_PACKAGE}.version=${VERSION} \
-X ${VERSION_PACKAGE}.gitSHA=${GIT_SHA} \
-X ${VERSION_PACKAGE}.buildTime=${DATE} \
"
endef
define GCFLAGS
-gcflags="all=-N -l"
endef
else
define LDFLAGS
-ldflags "\
-s -w \
-X ${VERSION_PACKAGE}.version=${VERSION} \
-X ${VERSION_PACKAGE}.gitSHA=${GIT_SHA} \
-X ${VERSION_PACKAGE}.buildTime=${DATE} \
"
endef
endif
BUILDFLAGS = -tags='netgo containers_image_ostree_stub exclude_graphdriver_devicemapper exclude_graphdriver_btrfs containers_image_openpgp' -installsuffix netgo
TEST_BUILDFLAGS = -tags='testing netgo containers_image_ostree_stub exclude_graphdriver_devicemapper exclude_graphdriver_btrfs containers_image_openpgp' -installsuffix netgo