1
2XEN_ROOT = $(CURDIR)/../..
3include $(XEN_ROOT)/tools/Rules.mk
4
5PY_CFLAGS = $(CFLAGS) $(PY_NOOPT_CFLAGS)
6PY_LDFLAGS = $(LDFLAGS) $(APPEND_LDFLAGS)
7INSTALL_LOG = build/installed_files.txt
8
9.PHONY: all
10all: build
11.PHONY: build
12build:
13	CC="$(CC)" CFLAGS="$(PY_CFLAGS)" LDFLAGS="$(PY_LDFLAGS)" $(PYTHON) setup.py build
14
15.PHONY: install
16install: all
17	$(INSTALL_DIR) $(DESTDIR)/$(bindir)
18	CC="$(CC)" CFLAGS="$(PY_CFLAGS)" LDFLAGS="$(PY_LDFLAGS)" $(PYTHON) \
19		setup.py install --record $(INSTALL_LOG) $(PYTHON_PREFIX_ARG) \
20		 --root="$(DESTDIR)" --install-scripts=$(LIBEXEC_BIN) --force
21	set -e; if [ $(bindir) != $(LIBEXEC_BIN) -a \
22	             "`readlink -f $(DESTDIR)/$(bindir)`" != \
23	             "`readlink -f $(LIBEXEC_BIN)`" ]; then \
24	    ln -sf $(LIBEXEC_BIN)/pygrub $(DESTDIR)/$(bindir); \
25	fi
26
27.PHONY: uninstall
28uninstall:
29	rm -f $(DESTDIR)/$(bindir)/pygrub
30	if [ -e $(INSTALL_LOG) ]; then \
31		cat $(INSTALL_LOG) | xargs -i rm -f $(DESTDIR)/{}; \
32	fi
33
34.PHONY: clean
35clean:
36	rm -rf build tmp *.pyc *.pyo *.o *.a *~ a.out $(INSTALL_LOG) $(DEPS_RM)
37
38.PHONY: distclean
39distclean: clean
40
41-include $(DEPS_INCLUDE)
42