Makefile: don't explicitly require go for root

on the host i'm testing on, `sudo make install` fails because `go` is
only in my homedir

Other benefits of this, is that due to removing `check-gopath` as a
target, since `check-gopath` was a PHONY, that meant targets like
`ocid`, etc., were being built every time. Even when they were fresh.
Now fresh files are reused without being built every time.

Signed-off-by: Vincent Batts <vbatts@hashbangbash.com>
This commit is contained in:
Vincent Batts 2017-04-17 18:03:29 -04:00
parent 7d7570e604
commit 6bad1bd169
Signed by: vbatts
GPG key ID: 10937E57733F1362

View file

@ -13,6 +13,15 @@ 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
BINARIES := \
ocid \
ocic \
kpod \
conmon \
pause \
bin2img \
copyimg \
checkseccomp
all: binaries ocid.conf docs all: binaries ocid.conf docs
@ -30,12 +39,14 @@ help:
.PHONY: check-gopath .PHONY: check-gopath
check-gopath: check-gopath = \
ifndef GOPATH if [ -z "GOPATH" ] ; then \
$(error GOPATH is not set) echo "GOPATH is not set"; \
endif exit 1; \
fi
lint: check-gopath lint:
@$(call check-gopath)
@echo "checking lint" @echo "checking lint"
@./.tool/lint @./.tool/lint
@ -54,18 +65,22 @@ bin2img:
copyimg: copyimg:
$(MAKE) -C test/$@ BUILDTAGS="$(BUILDTAGS)" $(MAKE) -C test/$@ BUILDTAGS="$(BUILDTAGS)"
checkseccomp: check-gopath checkseccomp:
@$(check-gopath)
$(MAKE) -C test/$@ $(MAKE) -C test/$@
ocid: check-gopath ocid:
@$(check-gopath)
$(GO) build -o $@ \ $(GO) build -o $@ \
-tags "$(BUILDTAGS)" \ -tags "$(BUILDTAGS)" \
$(PROJECT)/cmd/ocid $(PROJECT)/cmd/ocid
ocic: check-gopath ocic:
@$(check-gopath)
$(GO) build -o $@ $(PROJECT)/cmd/ocic $(GO) build -o $@ $(PROJECT)/cmd/ocic
kpod: check-gopath kpod:
@$(check-gopath)
$(GO) build -o $@ $(PROJECT)/cmd/kpod $(GO) build -o $@ $(PROJECT)/cmd/kpod
ocid.conf: ocid ocid.conf: ocid
@ -95,7 +110,7 @@ integration: ocidimage
localintegration: binaries localintegration: binaries
./test/test_runner.sh ${TESTFLAGS} ./test/test_runner.sh ${TESTFLAGS}
binaries: ocid ocic kpod conmon pause bin2img copyimg checkseccomp binaries: $(BINARIES)
MANPAGES_MD := $(wildcard docs/*.md) MANPAGES_MD := $(wildcard docs/*.md)
MANPAGES := $(MANPAGES_MD:%.md=%) MANPAGES := $(MANPAGES_MD:%.md=%)
@ -111,7 +126,7 @@ docs/%.8: docs/%.8.md check-gopath
docs: $(MANPAGES) docs: $(MANPAGES)
install: check-gopath install:
install -D -m 755 ocid $(BINDIR)/ocid install -D -m 755 ocid $(BINDIR)/ocid
install -D -m 755 ocic $(BINDIR)/ocic install -D -m 755 ocic $(BINDIR)/ocic
install -D -m 755 kpod $(BINDIR)/kpod install -D -m 755 kpod $(BINDIR)/kpod