ia64/xen-unstable

view tools/misc/Makefile @ 17830:b8fa4a11f715

Have `make install' write the Python version number in the #!

The Xen tools contain a number of Python extensions written in C. The
C API to Python, used by these extensions, is not stable from one
version of Python to the next.

Our build system uses whatever version of Python is the default on the
build system at that time to build these extensions. However, the
actual scripts such as `xm' use #!/usr/bin/env python which uses
whichever version of Python is the default on the deployment system at
the time of invocation.

If for any reason these two versions of Python are not the same (eg,
because the system is built on one computer and executed on another,
or because the system's gains a more recent Python installation
alongside the original which changes the previous default), warnings
and failures occur.

In this patch I arrange for Python scripts to be installed via a
special wrapper around `install', which determines the build-time
Python version and path and then writes that into the #! line at the
point of `make install' (or `make dist'). (It can also be overridden
by setting PYTHON_PATH.)

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
author Keir Fraser <keir.fraser@citrix.com>
date Wed Jun 11 09:36:23 2008 +0100 (2008-06-11)
parents ddf454872de4
children f292689f48ba
line source
1 XEN_ROOT=../..
2 include $(XEN_ROOT)/tools/Rules.mk
4 CFLAGS += -Werror
6 INCLUDES += -I $(XEN_XC)
7 INCLUDES += -I $(XEN_LIBXC)
8 INCLUDES += -I $(XEN_INCLUDE)
9 CFLAGS += $(INCLUDES)
11 HDRS = $(wildcard *.h)
13 TARGETS-y := xenperf
14 TARGETS-$(CONFIG_X86) += xen-detect
15 TARGETS := $(TARGETS-y)
17 SUBDIRS-$(CONFIG_LOMOUNT) += lomount
18 SUBDIRS-$(CONFIG_MINITERM) += miniterm
19 SUBDIRS := $(SUBDIRS-y)
21 INSTALL_BIN = $(TARGETS) xencons
22 INSTALL_SBIN = netfix xm xen-bugtool xen-python-path xend xenperf xsview
24 .PHONY: all
25 all: build
27 .PHONY: build
28 build: $(TARGETS)
29 set -e; for d in $(SUBDIRS); do $(MAKE) -C $$d; done
31 .PHONY: install
32 install: build
33 $(INSTALL_DIR) $(DESTDIR)$(BINDIR)
34 $(INSTALL_DIR) $(DESTDIR)$(SBINDIR)
35 $(INSTALL_PYTHON_PROG) $(INSTALL_BIN) $(DESTDIR)$(BINDIR)
36 $(INSTALL_PYTHON_PROG) $(INSTALL_SBIN) $(DESTDIR)$(SBINDIR)
37 set -e; for d in $(SUBDIRS); do $(MAKE) -C $$d install-recurse; done
39 .PHONY: clean
40 clean:
41 $(RM) *.o $(TARGETS) *~
42 set -e; for d in $(SUBDIRS); do $(MAKE) -C $$d clean; done
44 %.o: %.c $(HDRS) Makefile
45 $(CC) -c $(CFLAGS) -o $@ $<
47 xenperf: %: %.o Makefile
48 $(CC) $(CFLAGS) -o $@ $< $(LDFLAGS) $(LDFLAGS_libxenctrl)