summaryrefslogtreecommitdiff
path: root/source4/build/make/python.mk
blob: 9b91090a679c543fe4d69d3b5957aa66c356c7e2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
pythonbuilddir = $(builddir)/bin/python

installpython::
	mkdir -p $(DESTDIR)$(pythondir)

# Install Python
# Arguments: Module path
define python_module_template

installpython:: $$(pythonbuilddir)/$(1) ;
	mkdir -p $$(DESTDIR)$$(pythondir)/$$(dir $(1))
	cp $$< $$(DESTDIR)$$(pythondir)/$(1)

uninstallpython:: 
	rm -f $$(DESTDIR)$$(pythondir)/$(1) ;

pythonmods:: $$(pythonbuilddir)/$(1) ;

endef

define python_py_module_template

$$(pythonbuilddir)/$(1): $(2) ;
	mkdir -p $$(@D)
	cp $$< $$@

$(call python_module_template,$(1))

endef

# Python C module
# Arguments: File name, dependencies, link list
define python_c_module_template

$$(pythonbuilddir)/$(1): $(2) ; 
	@echo Linking $$@
	@mkdir -p $$(@D)
	@$$(MDLD) $$(LDFLAGS) $$(MDLD_FLAGS) $$(INTERN_LDFLAGS) -o $$@ $$(INSTALL_LINK_FLAGS) $(3)

$(call python_module_template,$(1))
endef

pythonmods::

clean::
	@echo "Removing python modules"
	@rm -rf $(pythonbuilddir)

pydoctor:: pythonmods
	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

bin/python/%.py: 
	mkdir -p $(@D)
	cp $< $@