X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=python%2FMakefile;h=dc4d59374e980b24821b79896862d22a173cde47;hb=c24dd57aa9dba282b9f4517f5a2967fc345c1ece;hp=35b5f43c48e055f62caa14bc3276eb539d77a9e1;hpb=b16248208e63ff7affd2b2f4ba2135b04c276e34;p=util-vserver.git diff --git a/python/Makefile b/python/Makefile index 35b5f43..dc4d593 100644 --- a/python/Makefile +++ b/python/Makefile @@ -1,15 +1,46 @@ -INCLUDES := -I.. -I../lib -LIBS = -L../lib -lvserver +# +# GNUMakefile for util-vserver Python bindings +# +# It's too hard to integrate distutils into the autoconf/libtool +# framework, so run this Makefile separately from and after the normal +# util-vserver build. +# +# Steve Muir +# Mark Huang +# Copyright (C) 2005 The Trustees of Princeton University +# +# $Id$ +# -PY_MODS := vserver.py cpulimit.py bwlimit.py -PY_EXT_MODS := vduimpl.so vserverimpl.so +ALL := vserverimpl.so vduimpl.so util_vserver_vars.py -all: py-build +pythonlibdir := @libdir@/python@PYTHON_VERSION@/site-packages -install: py-install - ln -s /usr/lib/util-vserver/util-vserver-vars \ - $(INSTALL_ROOT)/usr/lib/python2.3/site-packages/util_vserver_vars.py +all: $(ALL) --include pybuild.mk +%.o: %.c + # builds object and incompletely linked library + python setup.py build_ext + # copy to current directory + cp -a build/temp.*/*.o . -.PHONY: all install +vserverimpl.so vduimpl.so: %.so: %.o + # relink the object against libvserver with libtool + ../libtool --tag=CC --mode=link $(CC) -shared -o $@ $< ../lib/libvserver.la + +util_vserver_vars.py: ../scripts/util-vserver-vars + install -m 644 $< $@ + +install: $(ALL) + # install relinked libraries and byte-compiled scripts + python setup.py install --root="$(DESTDIR)" + # reinstall libraries with libtool so that the final path + # to libvserver is resolved + for so in $(filter %.so, $(ALL)) ; do \ + ../libtool --tag=CC --mode=install install "$$so" `find "$(DESTDIR)" -name "$$so"` ; \ + done + +clean: + rm -rf $(ALL) *.o build + +.PHONY: all install clean