make: Add "GOPATH not set"

Most of the projects, they can be built with "make".  After that,
"sudo make install" can install the application.
It is not work for kata-runtime because kata-runtime's make must work
with golang in the environment that default sudo cannot supply it.
But "make install" doesn't need golang.

So add "GOPATH not set" to handle the issue.

Fixes: #1008

Signed-off-by: Hui Zhu <teawater@hyper.sh>
This commit is contained in:
Hui Zhu 2018-12-12 10:47:07 +08:00
parent a323a87b59
commit 25358444ad

View File

@ -12,27 +12,33 @@ for file in /etc/os-release /usr/lib/os-release; do \
fi \
done)
GOARCH=$(shell go env GOARCH)
HOST_ARCH=$(shell arch)
SKIP_GO_VERSION_CHECK=
ifeq ($(GOPATH),)
SKIP_GO_VERSION_CHECK=y
else
SKIP_GO_VERSION_CHECK=
endif
ifeq ($(SKIP_GO_VERSION_CHECK),)
include golang.mk
endif
ifeq ($(ARCH),)
ARCH = $(GOARCH)
ifneq ($(GOPATH),)
GOARCH=$(shell go env GOARCH)
ifeq ($(ARCH),)
ARCH = $(GOARCH)
endif
ARCH_DIR = arch
ARCH_FILE_SUFFIX = -options.mk
ARCH_FILE = $(ARCH_DIR)/$(ARCH)$(ARCH_FILE_SUFFIX)
ARCH_FILES = $(wildcard arch/*$(ARCH_FILE_SUFFIX))
ALL_ARCHES = $(patsubst $(ARCH_DIR)/%$(ARCH_FILE_SUFFIX),%,$(ARCH_FILES))
# Load architecture-dependent settings
include $(ARCH_FILE)
endif
ARCH_DIR = arch
ARCH_FILE_SUFFIX = -options.mk
ARCH_FILE = $(ARCH_DIR)/$(ARCH)$(ARCH_FILE_SUFFIX)
ARCH_FILES = $(wildcard arch/*$(ARCH_FILE_SUFFIX))
ALL_ARCHES = $(patsubst $(ARCH_DIR)/%$(ARCH_FILE_SUFFIX),%,$(ARCH_FILES))
# Load architecture-dependent settings
include $(ARCH_FILE)
PROJECT_TYPE = kata
PROJECT_NAME = Kata Containers
PROJECT_TAG = kata-containers
@ -490,6 +496,7 @@ show-footer:
@printf "\tBugs: $(PROJECT_BUG_URL)\n\n"
show-summary: show-header
ifneq ($(GOPATH),)
@printf "• architecture:\n"
@printf "\tHost: $(HOST_ARCH)\n"
@printf "\tgolang: $(GOARCH)\n"
@ -498,6 +505,10 @@ show-summary: show-header
@printf "• golang:\n"
@printf "\t"
@go version
else
@printf "• GOPATH not set:\n"
@printf "\tCan only install prebuilt binaries\n"
endif
@printf "\n"
@printf "• Summary:\n"
@printf "\n"