Skip to content
This repository has been archived by the owner on May 12, 2021. It is now read-only.

Commit

Permalink
make: Add "GOPATH not set"
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
teawater committed Dec 13, 2018
1 parent a323a87 commit 2535844
Showing 1 changed file with 23 additions and 12 deletions.
35 changes: 23 additions & 12 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -12,26 +12,32 @@ 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)
endif
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))
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)
# Load architecture-dependent settings
include $(ARCH_FILE)
endif

PROJECT_TYPE = kata
PROJECT_NAME = Kata Containers
Expand Down Expand Up @@ -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"
Expand All @@ -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"
Expand Down

0 comments on commit 2535844

Please sign in to comment.