ia64/xen-unstable

changeset 6335:59328ad2a7d4

Make vm-top and the xenstat perl and python bindings conditional based on configuration variables from Config.mk, rather than disabling them if the needed headers are not found.
author josht@us.ibm.com
date Sat Aug 13 00:44:00 2005 +0000 (2005-08-13)
parents 6893bc5cc225
children b38cbc8f4d98
files Config.mk tools/xenstat/libxenstat/Makefile tools/xenstat/vm-top/Makefile
line diff
     1.1 --- a/Config.mk	Fri Aug 12 18:36:54 2005 +0000
     1.2 +++ b/Config.mk	Sat Aug 13 00:44:00 2005 +0000
     1.3 @@ -35,3 +35,8 @@ CFLAGS += $(foreach i, $(EXTRA_INCLUDES)
     1.4  
     1.5  # Choose the best mirror to download linux kernel
     1.6  KERNEL_REPO = http://www.kernel.org
     1.7 +
     1.8 +# Optional components
     1.9 +XENSTAT_PERL_BINDINGS   ?= n
    1.10 +XENSTAT_PYTHON_BINDINGS ?= y
    1.11 +XENSTAT_VM_TOP          ?= y
     2.1 --- a/tools/xenstat/libxenstat/Makefile	Fri Aug 12 18:36:54 2005 +0000
     2.2 +++ b/tools/xenstat/libxenstat/Makefile	Sat Aug 13 00:44:00 2005 +0000
     2.3 @@ -42,8 +42,6 @@ CFLAGS+=-I$(XEN_ROOT)/xen/include/public
     2.4  CFLAGS+=-I$(LINUX_ROOT)/include/asm-xen/linux-public/
     2.5  LDFLAGS+=-Lsrc
     2.6  
     2.7 -# Note that the bindings are not built by default, because they require a
     2.8 -# number of external dependencies.
     2.9  all: $(LIB) $(LINKS)
    2.10  
    2.11  $(LIB): $(OBJECTS)
    2.12 @@ -81,12 +79,16 @@ BINDINGS=$(PYLIB) $(PYMOD) $(PERLLIB) $(
    2.13  BINDINGSRC=$(PYSRC) $(PERLSRC)
    2.14  
    2.15  # The all-bindings target builds all the language bindings
    2.16 -all-bindings: $(BINDINGS)
    2.17 +all-bindings: perl-bindings python-bindings
    2.18 +
    2.19 +# The install-bindings target installs all the language bindings
    2.20 +install-bindings: install-perl-bindings install-python-bindings
    2.21  
    2.22  $(BINDINGS): $(LIB) $(LINKS) src/xenstat.h
    2.23  
    2.24  SWIG_FLAGS=-module xenstat -Isrc
    2.25  
    2.26 +# Python bindings
    2.27  PYTHON_VERSION=2.3
    2.28  PYTHON_FLAGS=-I/usr/include/python$(PYTHON_VERSION) -lpython$(PYTHON_VERSION)
    2.29  $(PYSRC) $(PYMOD): bindings/swig/xenstat.i
    2.30 @@ -95,6 +97,19 @@ PYTHON_FLAGS=-I/usr/include/python$(PYTH
    2.31  $(PYLIB): $(PYSRC)
    2.32  	$(CC) $(CFLAGS) $(LDFLAGS) $(PYTHON_FLAGS) -shared -lxenstat -o $@ $<
    2.33  
    2.34 +python-bindings: $(PYLIB) $(PYMOD)
    2.35 +
    2.36 +pythonlibdir=$(prefix)/lib/python$(PYTHON_VERSION)/site-packages
    2.37 +install-python-bindings: $(PYLIB) $(PYMOD)
    2.38 +	$(INSTALL_PROG) $(PYLIB) $(DESTDIR)$(pythonlibdir)/_xenstat.so
    2.39 +	$(INSTALL_PROG) $(PYMOD) $(DESTDIR)$(pythonlibdir)/xenstat.py
    2.40 +
    2.41 +ifeq ($(XENSTAT_PYTHON_BINDINGS),y)
    2.42 +all: python-bindings
    2.43 +install: install-python-bindings
    2.44 +endif
    2.45 +
    2.46 +# Perl bindings
    2.47  PERL_FLAGS=`perl -MConfig -e 'print "$$Config{ccflags} -I$$Config{archlib}/CORE";'`
    2.48  $(PERLSRC) $(PERLMOD): bindings/swig/xenstat.i
    2.49  	swig -perl $(SWIG_FLAGS) -outdir $(@D) -o $(PERLSRC) $<
    2.50 @@ -102,19 +117,18 @@ PERL_FLAGS=`perl -MConfig -e 'print "$$C
    2.51  $(PERLLIB): $(PERLSRC)
    2.52  	$(CC) $(CFLAGS) $(LDFLAGS) $(PERL_FLAGS) -shared -lxenstat -o $@ $<
    2.53  
    2.54 -# The install-bindings target installs all the language bindings
    2.55 -install-bindings: install-perl-bindings install-python-bindings
    2.56 +perl-bindings: $(PERLLIB) $(PERLMOD)
    2.57  
    2.58 -pythonlibdir=$(prefix)/lib/python$(PYTHON_VERSION)/site-packages
    2.59 -install-python-bindings: $(PYLIB) $(PYMOD)
    2.60 -	$(INSTALL_PROG) $(PYLIB) $(pythonlibdir)/_xenstat.so
    2.61 -	$(INSTALL_PROG) $(PYMOD) $(pythonlibdir)/xenstat.py
    2.62 +perllibdir=$(prefix)/lib/perl5
    2.63 +perlmoddir=$(prefix)/share/perl5
    2.64 +install-perl-bindings: $(PERLLIB) $(PERLMOD)
    2.65 +	$(INSTALL_PROG) $(PERLLIB) $(DESTDIR)$(perllibdir)/xenstat.so
    2.66 +	$(INSTALL_PROG) $(PERLMOD) $(DESTDIR)$(perlmoddir)/xenstat.pm
    2.67  
    2.68 -perllibdir=$(prefix)/lib/site_perl
    2.69 -perlmoddir=$(prefix)/lib/site_perl
    2.70 -install-perl-bindings: $(PERLLIB) $(PERLMOD)
    2.71 -	$(INSTALL_PROG) $(PERLLIB) $(perllibdir)/xenstat.so
    2.72 -	$(INSTALL_PROG) $(PERLMOD) $(perlmoddir)/xenstat.pm
    2.73 +ifeq ($(XENSTAT_PERL_BINDINGS),y)
    2.74 +all: perl-bindings
    2.75 +install: install-perl-bindings
    2.76 +endif
    2.77  
    2.78  clean:
    2.79  	rm -f $(LIB) $(OBJECTS) $(LINKS) $(BINDINGS) $(BINDINGSRC)
     3.1 --- a/tools/xenstat/vm-top/Makefile	Fri Aug 12 18:36:54 2005 +0000
     3.2 +++ b/tools/xenstat/vm-top/Makefile	Sat Aug 13 00:44:00 2005 +0000
     3.3 @@ -10,16 +10,13 @@
     3.4  # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     3.5  # GNU General Public License for more details.
     3.6  
     3.7 -ifneq (,$(shell [ -e /usr/include/curses.h ] || echo no))
     3.8 -all vm-top:
     3.9 -	@echo "***********************************************************"
    3.10 -	@echo "WARNING: Install ncurses to build vm-top."
    3.11 -	@echo "***********************************************************"
    3.12 -else
    3.13 -
    3.14  XEN_ROOT=../../..
    3.15  include $(XEN_ROOT)/tools/Rules.mk
    3.16  
    3.17 +ifneq ($(XENSTAT_VM_TOP),y)
    3.18 +all install vm-top:
    3.19 +else
    3.20 +
    3.21  INSTALL         = install
    3.22  INSTALL_PROG    = $(INSTALL) -m0755 -D
    3.23  INSTALL_DATA    = $(INSTALL) -m0644 -D
    3.24 @@ -36,12 +33,11 @@ all: vm-top
    3.25  
    3.26  vm-top: vm-top.o
    3.27  
    3.28 -endif
    3.29 +install: vm-top vm-top.1
    3.30 +	$(INSTALL_PROG) vm-top $(DESTDIR)$(sbindir)/vm-top
    3.31 +	$(INSTALL_DATA) vm-top.1 $(DESTDIR)$(man1dir)/vm-top.1
    3.32  
    3.33 -install: vm-top vm-top.1
    3.34 -	[ -f vm-top ] && $(INSTALL_PROG) vm-top $(DESTDIR)$(sbindir)/vm-top
    3.35 -	[ -f vm-top.1 ] && \
    3.36 -	    $(INSTALL_DATA) vm-top.1 $(DESTDIR)$(man1dir)/vm-top.1
    3.37 +endif
    3.38  
    3.39  clean:
    3.40  	rm -f vm-top vm-top.o