Merge pull request #327 from nalind/multigopath

Makefile: handle cases where $GOPATH is a list
This commit is contained in:
Mrunal Patel 2017-01-19 10:13:20 -08:00 committed by GitHub
commit 7cc84922b3

View file

@ -13,6 +13,8 @@ ETCDIR ?= ${DESTDIR}/etc
ETCDIR_OCID ?= ${ETCDIR}/ocid ETCDIR_OCID ?= ${ETCDIR}/ocid
BUILDTAGS := selinux seccomp $(shell hack/btrfs_tag.sh) $(shell hack/libdm_tag.sh) BUILDTAGS := selinux seccomp $(shell hack/btrfs_tag.sh) $(shell hack/libdm_tag.sh)
BASHINSTALLDIR=${PREFIX}/share/bash-completion/completions BASHINSTALLDIR=${PREFIX}/share/bash-completion/completions
GOBINDIR := $(word 1,$(subst :, ,$(GOPATH)))
PATH := $(GOBINDIR)/bin:$(PATH)
all: binaries ocid.conf docs all: binaries ocid.conf docs
@ -71,7 +73,7 @@ endif
$(GO) install $(PROJECT)/cmd/kpod $(GO) install $(PROJECT)/cmd/kpod
ocid.conf: ocid ocid.conf: ocid
$(GOPATH)/bin/ocid --config="" config --default > ocid.conf ocid --config="" config --default > ocid.conf
clean: clean:
rm -f docs/*.1 docs/*.5 docs/*.8 rm -f docs/*.1 docs/*.5 docs/*.8
@ -104,19 +106,19 @@ docs/%.1: docs/%.1.md
ifndef GOPATH ifndef GOPATH
$(error GOPATH is not set) $(error GOPATH is not set)
endif endif
$(GOPATH)/bin/go-md2man -in $< -out $@.tmp && touch $@.tmp && mv $@.tmp $@ go-md2man -in $< -out $@.tmp && touch $@.tmp && mv $@.tmp $@
docs/%.5: docs/%.5.md docs/%.5: docs/%.5.md
ifndef GOPATH ifndef GOPATH
$(error GOPATH is not set) $(error GOPATH is not set)
endif endif
$(GOPATH)/bin/go-md2man -in $< -out $@.tmp && touch $@.tmp && mv $@.tmp $@ go-md2man -in $< -out $@.tmp && touch $@.tmp && mv $@.tmp $@
docs/%.8: docs/%.8.md docs/%.8: docs/%.8.md
ifndef GOPATH ifndef GOPATH
$(error GOPATH is not set) $(error GOPATH is not set)
endif endif
$(GOPATH)/bin/go-md2man -in $< -out $@.tmp && touch $@.tmp && mv $@.tmp $@ go-md2man -in $< -out $@.tmp && touch $@.tmp && mv $@.tmp $@
docs: $(MANPAGES) docs: $(MANPAGES)
@ -124,9 +126,9 @@ install:
ifndef GOPATH ifndef GOPATH
$(error GOPATH is not set) $(error GOPATH is not set)
endif endif
install -D -m 755 $(GOPATH)/bin/ocid $(BINDIR)/ocid install -D -m 755 $(GOBINDIR)/bin/ocid $(BINDIR)/ocid
install -D -m 755 $(GOPATH)/bin/ocic $(BINDIR)/ocic install -D -m 755 $(GOBINDIR)/bin/ocic $(BINDIR)/ocic
install -D -m 755 $(GOPATH)/bin/kpod $(BINDIR)/kpod install -D -m 755 $(GOBINDIR)/bin/kpod $(BINDIR)/kpod
install -D -m 755 conmon/conmon $(LIBEXECDIR)/ocid/conmon install -D -m 755 conmon/conmon $(LIBEXECDIR)/ocid/conmon
install -D -m 755 pause/pause $(LIBEXECDIR)/ocid/pause install -D -m 755 pause/pause $(LIBEXECDIR)/ocid/pause
install -d -m 755 $(MANDIR)/man1 install -d -m 755 $(MANDIR)/man1
@ -169,9 +171,9 @@ ifndef GOPATH
$(error GOPATH is not set) $(error GOPATH is not set)
endif endif
ifeq ($(TRAVIS),true) ifeq ($(TRAVIS),true)
$(GOPATH)/bin/git-validation -q -run DCO,short-subject git-validation -q -run DCO,short-subject
else else
$(GOPATH)/bin/ -v -run DCO,short-subject -range $(EPOCH_TEST_COMMIT)..HEAD git-validation -v -run DCO,short-subject -range $(EPOCH_TEST_COMMIT)..HEAD
endif endif
.PHONY: install.tools .PHONY: install.tools
@ -183,7 +185,7 @@ install.tools: .install.gitvalidation .install.gometalinter .install.md2man
.install.gometalinter: .install.gometalinter:
go get -u github.com/alecthomas/gometalinter go get -u github.com/alecthomas/gometalinter
$(GOPATH)/bin/gometalinter --install gometalinter --install
.install.md2man: .install.md2man:
go get -u github.com/cpuguy83/go-md2man go get -u github.com/cpuguy83/go-md2man