forked from subutai-io/agent
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
25 lines (24 loc) · 989 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
APP=subutai
CC=go
VERSION=$(shell git describe --tags)
GIT_BRANCH=$(shell git rev-parse --abbrev-ref HEAD | grep -iv head)
ifneq (${GIT_BRANCH}, )
VERSION:=$(VERSION)-$(GIT_BRANCH)
endif
ifeq (${GOPATH}, )
GOPATH=${HOME}/go
endif
LDFLAGS=-ldflags "-r /snap/subutai-dev/current/lib -w -s -X main.version=${VERSION} -X github.com/subutai-io/agent/config.version=${VERSION}"
all:
@if [ ! -d "$(GOPATH)/src/github.com/subutai-io/agent" ]; then mkdir -p $(GOPATH)/src/github.com/subutai-io/; ln -s $(shell pwd) $(GOPATH)/src/github.com/subutai-io/agent; fi
$(CC) get -d
$(CC) build ${LDFLAGS} -o $(APP)
snapcraft:
$(eval export GOPATH=$(shell pwd)/../go)
$(eval export GOBIN=$(shell pwd)/../go/bin)
@if [ ! -d "$(GOPATH)/src/github.com/subutai-io/agent" ]; then mkdir -p $(GOPATH)/src/github.com/subutai-io/; ln -s $(shell pwd) $(GOPATH)/src/github.com/subutai-io/agent; fi
$(CC) get -d
$(CC) build ${LDFLAGS} -o $(APP)
install:
@mkdir -p $(DESTDIR)/bin
@cp $(APP) $(DESTDIR)/bin