Merge branch 'v4-0-test' of ssh://git.samba.org/data/git/samba into v4-0-gmake3
[ira/wip.git] / source / build / make / python.mk
1 pythonbuilddir = $(builddir)/bin/python
2
3 # Install Python
4 # Arguments: Module path
5 define python_module_template
6
7 installpython:: $$(pythonbuilddir)/$(1) ;
8         cp $$< $$(DESTDIR)$$(PYTHONDIR)/$(1)
9
10 uninstallpython:: 
11         rm -f $$(DESTDIR)$$(PYTHONDIR)/$(1) ;
12
13 pythonmods:: $$(pythonbuilddir)/$(1) ;
14
15 endef
16
17 define python_py_module_template
18
19 $$(pythonbuilddir)/$(1): $(2) ;
20         mkdir -p $$(@D)
21         cp $$< $$@
22
23 $(call python_module_template,$(1))
24
25 endef
26
27 # Python C module
28 # Arguments: Module path, object files
29 define python_c_module_template
30
31 $$(pythonbuilddir)/$(1): $(2) ; 
32         @echo Linking $$@
33         @mkdir -p $$(@D)
34         @$$(MDLD) $$(LDFLAGS) $$(MDLD_FLAGS) $$(INTERN_LDFLAGS) -o $$@ $$(INSTALL_LINK_FLAGS) $(3)
35
36 $(call python_module_template,$(1))
37 endef
38
39 # Swig extensions
40 swig:: pythonmods
41
42 .SUFFIXES: _wrap.c .i
43
44 .i_wrap.c:
45         [ "$(SWIG)" == "no" ] || $(SWIG) -O -Wall -I$(srcdir)/scripting/swig -python -keyword $<
46
47 realdistclean::
48         @echo "Removing SWIG output files"
49         # FIXME: Remove _wrap.c files
50
51 pythonmods::
52
53 clean::
54         @echo "Removing python modules"
55         @rm -rf $(pythonbuilddir)
56
57 pydoctor:: pythonmods
58         LD_LIBRARY_PATH=bin/shared PYTHONPATH=$(pythonbuilddir) pydoctor --project-name=Samba --project-url=http://www.samba.org --make-html --docformat=restructuredtext --add-package $(pythonbuilddir)/samba