summaryrefslogtreecommitdiff
path: root/source4/build
diff options
context:
space:
mode:
Diffstat (limited to 'source4/build')
-rw-r--r--source4/build/make/python.mk37
-rw-r--r--source4/build/smb_build/makefile.pm6
2 files changed, 39 insertions, 4 deletions
diff --git a/source4/build/make/python.mk b/source4/build/make/python.mk
new file mode 100644
index 0000000000..6f54cd6a44
--- /dev/null
+++ b/source4/build/make/python.mk
@@ -0,0 +1,37 @@
+pythonbuilddir = $(builddir)/bin/python
+
+# Install Python
+# Arguments: Module path, source location
+define python_module_template
+
+$$(pythonbuilddir)/$(1): $(2) ;
+ mkdir -p $$(@D)
+ cp $$< $$@
+
+installpython:: $$(pythonbuilddir)/$(1) ;
+ cp $$< $$(DESTDIR)$$(PYTHONDIR)/$(1)
+
+uninstallpython::
+ rm -f $$(DESTDIR)$$(PYTHONDIR)/$(1) ;
+
+pythonmods:: $$(pythonbuilddir)/$(1) ;
+
+endef
+
+# Swig extensions
+swig:: pythonmods
+
+.SUFFIXES: _wrap.c .i
+
+.i_wrap.c:
+ [ "$(SWIG)" == "no" ] || $(SWIG) -O -Wall -I$(srcdir)/scripting/swig -python -keyword $<
+
+realdistclean::
+ @echo "Removing SWIG output files"
+ # FIXME: Remove _wrap.c files
+
+pythonmods::
+
+clean::
+ @echo "Removing python modules"
+ @rm -rf $(pythonbuilddir)
diff --git a/source4/build/smb_build/makefile.pm b/source4/build/smb_build/makefile.pm
index 04bef1e160..df34f070c7 100644
--- a/source4/build/smb_build/makefile.pm
+++ b/source4/build/smb_build/makefile.pm
@@ -128,7 +128,7 @@ sub SharedModule($$)
$sane_subsystem =~ s/^lib//;
if ($ctx->{TYPE} eq "PYTHON") {
- $self->output("PYTHON_DSOS += $ctx->{SHAREDDIR}/$ctx->{LIBRARY_REALNAME}\n");
+ $self->output("\$(call python_module_template," . basename($ctx->{NAME}) . ",$ctx->{SHAREDDIR}/$ctx->{LIBRARY_REALNAME})\n");
} else {
$self->output("PLUGINS += $ctx->{SHAREDDIR}/$ctx->{LIBRARY_REALNAME}\n");
$self->output("installplugins:: $ctx->{SHAREDDIR}/$ctx->{LIBRARY_REALNAME}\n");
@@ -295,9 +295,7 @@ sub PythonFiles($$)
my ($self,$ctx) = @_;
foreach (@{$ctx->{PYTHON_FILES}}) {
- my $target = "bin/python/".basename($_);
- $self->output("$target: \$(addprefix $ctx->{BASEDIR}/, $_)\n\n");
- $self->output("PYTHON_PYS += $target\n");
+ $self->output("\$(call python_module_template," . basename($_) . ",\$(addprefix $ctx->{BASEDIR}/, $_))\n");
}
}