1XEN_ROOT = $(CURDIR)/../..
2include $(XEN_ROOT)/tools/Rules.mk
3
4.PHONY: all
5all: build
6
7PY_CFLAGS = $(CFLAGS) $(PY_NOOPT_CFLAGS)
8PY_LDFLAGS = $(LDFLAGS) $(APPEND_LDFLAGS)
9INSTALL_LOG = build/installed_files.txt
10
11.PHONY: build
12build:
13	CC="$(CC)" CFLAGS="$(PY_CFLAGS)" $(PYTHON) setup.py build
14
15.PHONY: install
16install:
17	$(INSTALL_DIR) $(DESTDIR)$(LIBEXEC_BIN)
18
19	CC="$(CC)" CFLAGS="$(PY_CFLAGS)" LDFLAGS="$(PY_LDFLAGS)" $(PYTHON) \
20		setup.py install --record $(INSTALL_LOG) $(PYTHON_PREFIX_ARG) \
21		--root="$(DESTDIR)" --force
22
23	$(INSTALL_PROG) scripts/convert-legacy-stream $(DESTDIR)$(LIBEXEC_BIN)
24	$(INSTALL_PROG) scripts/verify-stream-v2 $(DESTDIR)$(LIBEXEC_BIN)
25
26.PHONY: uninstall
27uninstall:
28	rm -f $(DESTDIR)$(LIBEXEC_BIN)/verify-stream-v2
29	rm -f $(DESTDIR)$(LIBEXEC_BIN)/convert-legacy-stream
30	if [ -e $(INSTALL_LOG) ]; then \
31		cat $(INSTALL_LOG) | xargs -i rm -f $(DESTDIR)/{}; \
32	fi
33
34.PHONY: test
35test:
36	export LD_LIBRARY_PATH=$$(readlink -f ../libxc):$$(readlink -f ../xenstore); $(PYTHON) test.py -b -u
37
38.PHONY: clean
39clean:
40	find . \( -name "*.py[ocd]" -o -name "*~" -o -name "_*.[hc]" \) -delete
41	rm -rf build/
42	rm -f $(DEPS_RM)
43
44.PHONY: distclean
45distclean: clean
46
47-include $(DEPS_INCLUDE)
48