Files
xen/tools/python/Makefile
T
Andrew Cooper fd8fecb97b tools/python: Improve unit test handling
* Add X86_{CPUID,MSR}_POLICY_FORMAT checks which were missed previously.
 * Drop test_suite().  It hasn't been necessary since the Py2.3 era.
 * Drop the __main__ logic.  This can't be used without manually adjusting the
   include path, and `make test` knows how to do the right thing.
 * For `make test`, use `-v` to see which tests have been discovered and run.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Acked-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
2023-03-17 10:44:16 +00:00

51 lines
1.4 KiB
Makefile

XEN_ROOT = $(CURDIR)/../..
include $(XEN_ROOT)/tools/Rules.mk
.PHONY: all
all: build
PY_CFLAGS = $(CFLAGS) $(PY_NOOPT_CFLAGS)
PY_LDFLAGS = $(SHLIB_LDFLAGS) $(APPEND_LDFLAGS)
INSTALL_LOG = build/installed_files.txt
setup.py = CC="$(CC)" CFLAGS="$(PY_CFLAGS)" LDSHARED="$(CC)" LDFLAGS="$(PY_LDFLAGS)" \
SHLIB_libxenctrl="$(SHLIB_libxenctrl)" \
SHLIB_libxenguest="$(SHLIB_libxenguest)" \
SHLIB_libxenstore="$(SHLIB_libxenstore)" \
$(PYTHON) setup.py
.PHONY: build
build:
$(setup.py) build
.PHONY: install
install:
$(INSTALL_DIR) $(DESTDIR)$(LIBEXEC_BIN)
$(setup.py) install --record $(INSTALL_LOG) $(PYTHON_PREFIX_ARG) \
--root="$(DESTDIR)" --force
$(INSTALL_PYTHON_PROG) scripts/convert-legacy-stream $(DESTDIR)$(LIBEXEC_BIN)
$(INSTALL_PYTHON_PROG) scripts/verify-stream-v2 $(DESTDIR)$(LIBEXEC_BIN)
.PHONY: uninstall
uninstall:
rm -f $(DESTDIR)$(LIBEXEC_BIN)/verify-stream-v2
rm -f $(DESTDIR)$(LIBEXEC_BIN)/convert-legacy-stream
if [ -e $(INSTALL_LOG) ]; then \
cat $(INSTALL_LOG) | xargs -i rm -f $(DESTDIR)/{}; \
fi
.PHONY: test
test:
LD_LIBRARY_PATH=$$(readlink -f ../libs/ctrl):$$(readlink -f ../xenstore) $(PYTHON) -m unittest discover -v
.PHONY: clean
clean:
find . \( -name "*.py[ocd]" -o -name "*~" -o -name "_*.[hc]" \) -delete
rm -rf build/
rm -f $(DEPS_RM)
.PHONY: distclean
distclean: clean
-include $(DEPS_INCLUDE)