Files
xen/tools/pygrub/Makefile
T
Elliott Mitchell 17d192e023 tools/python: Pass linker to Python build process
Unexpectedly the environment variable which needs to be passed is
$LDSHARED and not $LD.  Otherwise Python may find the build `ld` instead
of the host `ld`.

Replace $(LDFLAGS) with $(SHLIB_LDFLAGS) as Python needs shared objects
it can load at runtime, not executables.

This uses $(CC) instead of $(LD) since Python distutils appends $CFLAGS
to $LDFLAGS which breaks many linkers.

Signed-off-by: Elliott Mitchell <ehem+xen@m5p.com>
Acked-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
2020-10-16 13:25:35 +00:00

43 lines
1.1 KiB
Makefile

XEN_ROOT = $(CURDIR)/../..
include $(XEN_ROOT)/tools/Rules.mk
PY_CFLAGS = $(CFLAGS) $(PY_NOOPT_CFLAGS)
PY_LDFLAGS = $(SHLIB_LDFLAGS) $(APPEND_LDFLAGS)
INSTALL_LOG = build/installed_files.txt
.PHONY: all
all: build
.PHONY: build
build:
CC="$(CC)" CFLAGS="$(PY_CFLAGS)" LDSHARED="$(CC)" LDFLAGS="$(PY_LDFLAGS)" $(PYTHON) setup.py build
.PHONY: install
install: all
$(INSTALL_DIR) $(DESTDIR)/$(bindir)
CC="$(CC)" CFLAGS="$(PY_CFLAGS)" LDSHARED="$(CC)" \
LDFLAGS="$(PY_LDFLAGS)" $(PYTHON) setup.py install \
--record $(INSTALL_LOG) $(PYTHON_PREFIX_ARG) \
--root="$(DESTDIR)" --install-scripts=$(LIBEXEC_BIN) --force
set -e; if [ $(bindir) != $(LIBEXEC_BIN) -a \
"`readlink -f $(DESTDIR)/$(bindir)`" != \
"`readlink -f $(LIBEXEC_BIN)`" ]; then \
ln -sf $(LIBEXEC_BIN)/pygrub $(DESTDIR)/$(bindir); \
fi
.PHONY: uninstall
uninstall:
rm -f $(DESTDIR)/$(bindir)/pygrub
if [ -e $(INSTALL_LOG) ]; then \
cat $(INSTALL_LOG) | xargs -i rm -f $(DESTDIR)/{}; \
fi
.PHONY: clean
clean:
rm -rf build tmp *.pyc *.pyo *.o *.a *~ a.out $(INSTALL_LOG) $(DEPS_RM)
.PHONY: distclean
distclean: clean
-include $(DEPS_INCLUDE)