-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
46 lines (36 loc) · 1.09 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
VERSION="0.0" # dummy for now
GIT_COMMIT=$(shell git rev-list -1 HEAD)
default: all
DEPS=$(wildcard cmd/moby/*.go src/moby/*.go src/initrd/*.go src/pad4/*.go) vendor.conf Makefile
PREFIX?=/usr/local
GOMETALINTER:=$(shell command -v gometalinter 2> /dev/null)
dist/moby dist/moby-$(GOOS): $(DEPS)
CGO_ENABLED=0 go build \
--ldflags "-X main.GitCommit=$(GIT_COMMIT) -X main.Version=$(VERSION)" \
-o $@ ./cmd/moby
.PHONY: nogopath
nogopath:
rm -rf src/github.com
mkdir -p src/github.com/moby
ln -s $(CURDIR) $(CURDIR)/src/github.com/moby/tool
cd src/github.com/moby/tool && GOPATH=$(CURDIR) $(MAKE) dist/moby
rm -rf src/github.com
.PHONY: lint
lint:
ifndef GOMETALINTER
$(error "Please install gometalinter! go get -u github.com/alecthomas/gometalinter")
endif
gometalinter --config gometalinter.json ./...
test: dist/moby
@go test $(shell go list ./... | grep -vE '/vendor/')
# test build
dist/moby build -format tar test/test.yml
rm test.tar
.PHONY: all
all: lint test dist/moby
.PHONY: install
install: dist/moby
cp -a $^ $(PREFIX)/bin/
.PHONY: clean
clean:
rm -rf dist src/github.com