Avoid installing pylibfdt when dependencies are missing

At present we have a build check that python-dev and swig are available.
If they are not, we print a message and skip building pylibfdt.

However this check is not currently present with 'make install'. The
install is attempted, and fails. See crbug.com/789189

Split the check out into a separate script and use it twice, once for the
build and once for the install. This corrects the error.

Reported-by: Mike Frysinger <vapier@chromium.org>
Signed-off-by: Simon Glass <sjg@chromium.org>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
main
Simon Glass 2018-01-05 11:54:12 -07:00 committed by David Gibson
parent cd6ea1b2be
commit 962a45ca03
1 changed files with 16 additions and 8 deletions

View File

@ -130,19 +130,23 @@ SCRIPTS = dtdiff


all: $(BIN) libfdt all: $(BIN) libfdt


# We need both Python and swig to build pylibfdt. # We need both Python and swig to build/install pylibfdt.
.PHONY: maybe_pylibfdt # This builds the given make ${target} if those deps are found.
maybe_pylibfdt: FORCE check_python_deps = \
if $(PKG_CONFIG) --cflags python2 >/dev/null 2>&1; then \ if $(PKG_CONFIG) --cflags python2 >/dev/null 2>&1; then \
if which swig >/dev/null 2>&1; then \ if which swig >/dev/null 2>&1; then \
can_build=yes; \ can_build=yes; \
fi; \ fi; \
fi; \ fi; \
if [ "$$can_build" = "yes" ]; then \ if [ "$${can_build}" = "yes" ]; then \
$(MAKE) pylibfdt; \ $(MAKE) $${target}; \
else \ else \
echo "## Skipping pylibfdt (install python dev and swig to build)"; \ echo "\#\# Skipping pylibfdt (install python dev and swig to build)"; \
fi fi ;

.PHONY: maybe_pylibfdt
maybe_pylibfdt: FORCE
target=pylibfdt; $(check_python_deps)


ifeq ($(NO_PYTHON),) ifeq ($(NO_PYTHON),)
all: maybe_pylibfdt all: maybe_pylibfdt
@ -213,8 +217,12 @@ install-includes:


install: install-bin install-lib install-includes install: install-bin install-lib install-includes


.PHONY: maybe_install_pylibfdt
maybe_install_pylibfdt: FORCE
target=install_pylibfdt; $(check_python_deps)

ifeq ($(NO_PYTHON),) ifeq ($(NO_PYTHON),)
install: install_pylibfdt install: maybe_install_pylibfdt
endif endif


$(VERSION_FILE): Makefile FORCE $(VERSION_FILE): Makefile FORCE