Merge pull request #328 from mrunalp/gopath_target

Move GOPATH check to a phony target
This commit is contained in:
Antonio Murdaca 2017-01-19 21:52:03 +01:00 committed by GitHub
commit 89369c1eae

View file

@ -30,10 +30,14 @@ help:
@echo " * 'lint' - Execute the source code linter" @echo " * 'lint' - Execute the source code linter"
@echo " * 'gofmt' - Verify the source code gofmt" @echo " * 'gofmt' - Verify the source code gofmt"
lint: .PHONY: check-gopath
check-gopath:
ifndef GOPATH ifndef GOPATH
$(error GOPATH is not set) $(error GOPATH is not set)
endif endif
lint: check-gopath
@echo "checking lint" @echo "checking lint"
@./.tool/lint @./.tool/lint
@ -52,27 +56,18 @@ bin2img:
copyimg: copyimg:
make -C test/$@ make -C test/$@
checkseccomp: checkseccomp: check-gopath
make -C test/$@ make -C test/$@
ocid: ocid: check-gopath
ifndef GOPATH
$(error GOPATH is not set)
endif
$(GO) install \ $(GO) install \
-tags "$(BUILDTAGS)" \ -tags "$(BUILDTAGS)" \
$(PROJECT)/cmd/ocid $(PROJECT)/cmd/ocid
ocic: ocic: check-gopath
ifndef GOPATH
$(error GOPATH is not set)
endif
$(GO) install $(PROJECT)/cmd/ocic $(GO) install $(PROJECT)/cmd/ocic
kpod: kpod: check-gopath
ifndef GOPATH
$(error GOPATH is not set)
endif
$(GO) install $(PROJECT)/cmd/kpod $(GO) install $(PROJECT)/cmd/kpod
ocid.conf: ocid ocid.conf: ocid
@ -106,30 +101,18 @@ binaries: ocid ocic kpod conmon pause bin2img copyimg checkseccomp
MANPAGES_MD := $(wildcard docs/*.md) MANPAGES_MD := $(wildcard docs/*.md)
MANPAGES := $(MANPAGES_MD:%.md=%) MANPAGES := $(MANPAGES_MD:%.md=%)
docs/%.1: docs/%.1.md docs/%.1: docs/%.1.md check-gopath
ifndef GOPATH
$(error GOPATH is not set)
endif
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 check-gopath
ifndef GOPATH
$(error GOPATH is not set)
endif
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 check-gopath
ifndef GOPATH
$(error GOPATH is not set)
endif
go-md2man -in $< -out $@.tmp && touch $@.tmp && mv $@.tmp $@ go-md2man -in $< -out $@.tmp && touch $@.tmp && mv $@.tmp $@
docs: $(MANPAGES) docs: $(MANPAGES)
install: install: check-gopath
ifndef GOPATH
$(error GOPATH is not set)
endif
install -D -m 755 $(GOBINDIR)/bin/ocid $(BINDIR)/ocid install -D -m 755 $(GOBINDIR)/bin/ocid $(BINDIR)/ocid
install -D -m 755 $(GOBINDIR)/bin/ocic $(BINDIR)/ocic install -D -m 755 $(GOBINDIR)/bin/ocic $(BINDIR)/ocic
install -D -m 755 $(GOBINDIR)/bin/kpod $(BINDIR)/kpod install -D -m 755 $(GOBINDIR)/bin/kpod $(BINDIR)/kpod
@ -170,10 +153,7 @@ uninstall:
.PHONY: .gitvalidation .PHONY: .gitvalidation
# When this is running in travis, it will only check the travis commit range # When this is running in travis, it will only check the travis commit range
.gitvalidation: .gitvalidation: check-gopath
ifndef GOPATH
$(error GOPATH is not set)
endif
ifeq ($(TRAVIS),true) ifeq ($(TRAVIS),true)
git-validation -q -run DCO,short-subject git-validation -q -run DCO,short-subject
else else