2 # GNUMakefile for util-vserver Python bindings
4 # It's too hard to integrate distutils into the autoconf/libtool
5 # framework, so run this Makefile separately from and after the normal
8 # Steve Muir <smuir@cs.princeton.edu>
9 # Mark Huang <mlhuang@cs.princeton.edu>
10 # Copyright (C) 2005 The Trustees of Princeton University
12 # $Id: Makefile,v 1.7 2005/08/26 04:00:44 mlhuang Exp $
15 ALL := vserverimpl.so vduimpl.so util_vserver_vars.py
17 # need command substitution
20 pythonlibdir := @libdir@/python@PYTHON_VERSION@/site-packages
25 # builds object and incompletely linked library
26 python setup.py build_ext
27 # copy to current directory
28 cp -a build/temp.*/*.o .
30 vserverimpl.so vduimpl.so: %.so: %.o
31 # relink the object against libvserver with libtool
32 ../libtool --tag=CC --mode=link $(CC) -shared -o $@ $< ../lib/libvserver.la
34 util_vserver_vars.py: ../scripts/util-vserver-vars
35 # python does not export variables beginning with underscore
37 while read var ; do eval echo $$var=\$${$$var} ; done < \
38 <(sed -ne "s/\([^=]*\)=.*/\1/p" $<) \
39 | sed -e "s/^_*//" -e "s/\([^=]*\)=\(.*\)/\1='\2'/") > $@
42 # install relinked libraries and byte-compiled scripts
43 python setup.py install --root="$(DESTDIR)"
44 # reinstall libraries with libtool so that the final path
45 # to libvserver is resolved
46 for so in $(filter %.so, $(ALL)) ; do \
47 ../libtool --tag=CC --mode=install install "$$so" `find "$(DESTDIR)" -name "$$so"` ; \
51 rm -rf $(ALL) *.o build
53 .PHONY: all install clean