-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
53 lines (40 loc) · 1.18 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
# vim: noet:
.SILENT:
.PHONY: all clean install
APP_NAME := container_age
TMP_NAME := $(APP_NAME)".go"
VERSION := $(shell cat ./VERSION)
GOROOT := /usr/local/go/
GO_SDK := https://dl.google.com/go/go1.11.4.linux-amd64.tar.gz
#
# todo: setup dep / toml
all: build
echo "*** all done"
# build go app
build:
echo "*** building Go application"
export CGO_ENABLED=0;\
#dep ensure
cp ./main.go ./$(TMP_NAME)
sed -i s/\%VERSION\%/$(VERSION)/g $(TMP_NAME)
go build -ldflags "-s -w" $(TMP_NAME)
-rm ./$(TMP_NAME)
# install go sdk, dep and project packages
install:
#echo "*** install dep"
#@test -f /usr/local/bin/dep || sudo wget https://github.com/golang/dep/releases/download/v0.5.0/dep-linux-amd64 -O /usr/local/bin/dep
echo "*** installing go sdk"
@test -f $(GOROOT)/bin/go && { echo "*** it seems like go sdk is already installed!"; exit 1; } || \
sudo mkdir -p $(GOROOT);\
cd $(GOROOT);\
sudo wget -q --show-progress --progress=dot:giga $(GO_SDK) -O - | sudo tar xz;\
sudo mv go/* .;\
sudo rmdir go
#dep init
go get github.com/docker/docker/client
uninstall:
echo "*** uninstalling go sdk"
-sudo rm -rf $(GOROOT)
clean:
echo "*** cleaning up"
-rm main