-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathMakefile
More file actions
101 lines (70 loc) · 2.49 KB
/
Makefile
File metadata and controls
101 lines (70 loc) · 2.49 KB
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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
###############################################################################
# Makefile to compile cib.
# lists all the dependencies for test, prod and we can run a go build aftermath.
###############################################################################
GOPATH := $(GOPATH):$(shell pwd)/../../../../
define HG_ERROR
FATAL: you need mercurial (hg) to download sg-scramjet dependencies.
Check README.md for details
endef
define GIT_ERROR
FATAL: you need git to download sg-scramjet dependencies.
Check README.md for details
endef
define BZR_ERROR
FATAL: you need bazaar (bzr) to download sg-scramjet dependencies.
Check README.md for details
endef
.PHONY: all check-path get hg git bzr get-code test
all: check-path get test
build: check-path get _go_test _sg-scramjet
# It does not support GOPATH with multiple paths.
check-path:
ifndef GOPATH
@echo "FATAL: you must declare GOPATH environment variable, for more"
@echo " details, please check README.md file and/or"
@echo " http://golang.org/cmd/go/#GOPATH_environment_variable"
@exit 1
endif
@exit 0
get: hg git bzr get-code godep
hg:
$(if $(shell hg), , $(error $(HG_ERROR)))
git:
$(if $(shell git), , $(error $(GIT_ERROR)))
bzr:
$(if $(shell bzr), , $(error $(BZR_ERROR)))
get-code:
go get $(GO_EXTRAFLAGS) -u -d ./...
godep:
go get $(GO_EXTRAFLAGS) github.com/tools/godep
godep restore ./...
_go_test:
go clean $(GO_EXTRAFLAGS) ./...
go test $(GO_EXTRAFLAGS) ./...
_sg-scramjet:
rm -f sg-scramjet
go build $(GO_EXTRAFLAGS) -o sg-scramjet ./cmd/sg-scramjet
_sg-scramjetr:
sudo ./sg-scramjet start
rm -f sg-scramjet
_sh_tests:
@conf/trusty/sg-scramjet/sg-scramjet_test.sh
test: _go_test _sg-scramjet _sg-scramjetr
_install_deadcode: git
go get $(GO_EXTRAFLAGS) github.com/remyoudompheng/go-misc/deadcode
deadcode: _install_deadcode
@go list ./... | sed -e 's;github.com/sg-scramjet/sg-scramjet/;;' | xargs deadcode
deadc0de: deadcode