summaryrefslogtreecommitdiff
path: root/source4
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2006-03-09 14:39:36 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:54:02 -0500
commit6500444a2d74c7d921e7300939f459a83b95ea14 (patch)
tree28867a5bdc55e7bc4877b604c2103c77e9397184 /source4
parent5ead79baffdf33465d0b650ebb17af009d2af757 (diff)
downloadsamba-6500444a2d74c7d921e7300939f459a83b95ea14.tar.gz
samba-6500444a2d74c7d921e7300939f459a83b95ea14.tar.bz2
samba-6500444a2d74c7d921e7300939f459a83b95ea14.zip
r14072: - only add the 'lib' prefix to libraries not modules
- fix installation of plugins (and make it a bit more verbose - get rid of the '#define libfoo_module_init init_module' and genereated a wrapper function in bin/libfoo_module_init_module.c - change the standard visibility for modules to hidden - a few make clean fixes metze (This used to be commit 89b5667ab0f761e679fdee0f5c3d94942e67e28e)
Diffstat (limited to 'source4')
-rw-r--r--source4/build/smb_build/header.pm20
-rw-r--r--source4/build/smb_build/input.pm8
-rw-r--r--source4/build/smb_build/makefile.pm37
-rw-r--r--source4/build/smb_build/output.pm17
-rw-r--r--source4/main.mk10
5 files changed, 58 insertions, 34 deletions
diff --git a/source4/build/smb_build/header.pm b/source4/build/smb_build/header.pm
index 1cc5361b65..a34bcb9025 100644
--- a/source4/build/smb_build/header.pm
+++ b/source4/build/smb_build/header.pm
@@ -48,26 +48,6 @@ sub _prepare_build_h($)
}
#
- # Shared modules
- #
- foreach my $key (values %{$depend}) {
- next if $key->{TYPE} ne "MODULE";
- next if $key->{ENABLE} ne "YES";
- next if $key->{OUTPUT_TYPE} ne "SHARED_LIBRARY";
-
- my $name = $key->{NAME};
- next if not defined($key->{INIT_FUNCTION});
-
- my $DEFINE = ();
-
- $DEFINE->{COMMENT} = "$name is built shared";
- $DEFINE->{KEY} = $key->{INIT_FUNCTION};
- $DEFINE->{VAL} = "init_module";
-
- push(@defines,$DEFINE);
- }
-
- #
# loop over all BUILD_H define sections
#
foreach (@defines) { $output .= _add_define_section($_); }
diff --git a/source4/build/smb_build/input.pm b/source4/build/smb_build/input.pm
index 8cad9aafa6..fd887094aa 100644
--- a/source4/build/smb_build/input.pm
+++ b/source4/build/smb_build/input.pm
@@ -66,6 +66,12 @@ sub check_module($$$)
return;
}
+ if (exists($INPUT->{$mod->{SUBSYSTEM}}{INIT_FUNCTION_TYPE})) {
+ $mod->{INIT_FUNCTION_TYPE} = $INPUT->{$mod->{SUBSYSTEM}}{INIT_FUNCTION_TYPE};
+ } else {
+ $mod->{INIT_FUNCTION_TYPE} = "NTSTATUS (*) (void)";
+ }
+
if (defined($mod->{CHOSEN_BUILD}) and $mod->{CHOSEN_BUILD} ne "DEFAULT")
{
$mod->{OUTPUT_TYPE} = $mod->{CHOSEN_BUILD};
@@ -160,7 +166,7 @@ sub check($$$$$)
}
unless (defined($part->{STANDARD_VISIBILITY})) {
- if ($part->{TYPE} eq "BINARY") {
+ if ($part->{TYPE} eq "MODULE" or $part->{TYPE} eq "BINARY") {
$part->{STANDARD_VISIBILITY} = "hidden";
} else {
$part->{STANDARD_VISIBILITY} = "default";
diff --git a/source4/build/smb_build/makefile.pm b/source4/build/smb_build/makefile.pm
index 44b54a5058..e033e0e4b2 100644
--- a/source4/build/smb_build/makefile.pm
+++ b/source4/build/smb_build/makefile.pm
@@ -24,6 +24,8 @@ sub new($$$)
$self->{static_libs} = [];
$self->{shared_libs} = [];
$self->{headers} = [];
+ $self->{shared_modules} = [];
+ $self->{plugins} = [];
$self->{install_plugins} = "";
$self->{uninstall_plugins} = "";
$self->{pc_files} = [];
@@ -259,6 +261,7 @@ sub SharedLibrary($$)
my ($self,$ctx) = @_;
my $installdir;
+ my $init_obj = "";
if ($self->{duplicate_build}) {
$installdir = "bin/install";
@@ -270,8 +273,12 @@ sub SharedLibrary($$)
push (@{$self->{shared_libs}}, "bin/$ctx->{LIBRARY_REALNAME}");
} elsif ($ctx->{TYPE} eq "MODULE") {
push (@{$self->{shared_modules}}, "bin/$ctx->{LIBRARY_REALNAME}");
+ push (@{$self->{plugins}}, "$installdir/$ctx->{LIBRARY_REALNAME}");
+ $self->{install_plugins} .= "\t\@echo Install $installdir/$ctx->{LIBRARY_REALNAME} as \$(DESTDIR)\$(MODULESDIR)/$ctx->{SUBSYSTEM}/$ctx->{NAME}.\$(SHLIBEXT)/\n";
+ $self->{install_plugins} .= "\t\@mkdir -p \$(DESTDIR)\$(MODULESDIR)/$ctx->{SUBSYSTEM}/\n";
$self->{install_plugins} .= "\t\@cp $installdir/$ctx->{LIBRARY_REALNAME} \$(DESTDIR)\$(MODULESDIR)/$ctx->{SUBSYSTEM}/$ctx->{NAME}.\$(SHLIBEXT)\n";
+ $self->{uninstall_plugins} .= "\t\@echo Uninstall \$(DESTDIR)\$(MODULESDIR)/$ctx->{SUBSYSTEM}/$ctx->{NAME}.\$(SHLIBEXT)\n";
$self->{uninstall_plugins} .= "\t\@rm \$(DESTDIR)\$(MODULESDIR)/$ctx->{SUBSYSTEM}/$ctx->{NAME}.\$(SHLIBEXT)\n";
}
@@ -282,20 +289,37 @@ sub SharedLibrary($$)
$self->_prepare_list($ctx, "LINK_FLAGS");
push(@{$self->{all_objs}}, "\$($ctx->{TYPE}_$ctx->{NAME}_OBJ_LIST)");
-
+
if ($ctx->{NOPROTO} eq "NO") {
push(@{$self->{proto_objs}}, "\$($ctx->{TYPE}_$ctx->{NAME}_OBJ_LIST\)");
}
+ if ($ctx->{TYPE} eq "MODULE" and defined($ctx->{INIT_FUNCTION})) {
+ my $init_fn = $ctx->{INIT_FUNCTION_TYPE};
+ $init_fn =~ s/\(\*\)/init_module/;
+ my $proto_fn = $ctx->{INIT_FUNCTION_TYPE};
+ $proto_fn =~ s/\(\*\)/$ctx->{INIT_FUNCTION}/;
+
+ $self->output(<< "__EOD__"
+bin/$ctx->{NAME}_init_module.c:
+ \@echo Creating \$\@
+ \@echo \"#include \\\"includes.h\\\"\" > \$\@
+ \@echo \"$proto_fn;\" >> \$\@
+ \@echo -e \"_PUBLIC_ $init_fn \\n{\\n\\treturn $ctx->{INIT_FUNCTION}();\\n}\\n\" >> \$\@
+__EOD__
+);
+ $init_obj = "bin/$ctx->{NAME}_init_module.o";
+ }
+
if ($self->{duplicate_build}) {
$self->output(<< "__EOD__"
#
-bin/$ctx->{LIBRARY_REALNAME}: \$($ctx->{TYPE}_$ctx->{NAME}_DEPEND_LIST) \$($ctx->{TYPE}_$ctx->{NAME}_OBJ_LIST)
+bin/$ctx->{LIBRARY_REALNAME}: \$($ctx->{TYPE}_$ctx->{NAME}_DEPEND_LIST) \$($ctx->{TYPE}_$ctx->{NAME}_OBJ_LIST) $init_obj
\@echo Linking \$\@
\@\$(SHLD) \$(SHLD_FLAGS) -o \$\@ \$(LOCAL_LINK_FLAGS) \\
\$($ctx->{TYPE}_$ctx->{NAME}_LINK_FLAGS) \\
- \$($ctx->{TYPE}_$ctx->{NAME}_LINK_LIST)
+ $init_obj \$($ctx->{TYPE}_$ctx->{NAME}_LINK_LIST)
__EOD__
);
@@ -318,11 +342,11 @@ __EOD__
$self->output(<< "__EOD__"
#
-$installdir/$ctx->{LIBRARY_REALNAME}: \$($ctx->{TYPE}_$ctx->{NAME}_DEPEND_LIST) \$($ctx->{TYPE}_$ctx->{NAME}_OBJ_LIST)
+$installdir/$ctx->{LIBRARY_REALNAME}: \$($ctx->{TYPE}_$ctx->{NAME}_DEPEND_LIST) \$($ctx->{TYPE}_$ctx->{NAME}_OBJ_LIST) $init_obj
\@echo Linking \$\@
\@\$(SHLD) \$(SHLD_FLAGS) -o \$\@ \\
\$($ctx->{TYPE}_$ctx->{NAME}_LINK_FLAGS) \\
- \$($ctx->{TYPE}_$ctx->{NAME}_LINK_LIST)
+ $init_obj \$($ctx->{TYPE}_$ctx->{NAME}_LINK_LIST)
__EOD__
);
@@ -559,8 +583,9 @@ sub write($$)
$self->output("PROTO_OBJS = " . array2oneperline($self->{proto_objs}) . "\n");
$self->output("PROTO_HEADERS = " . array2oneperline($self->{proto_headers}) . "\n");
$self->output("SHARED_MODULES = " . array2oneperline($self->{shared_modules}) . "\n");
+ $self->output("PLUGINS = " . array2oneperline($self->{plugins}) . "\n");
- $self->output("\ninstallplugins: \$(SHARED_MODULES)\n".$self->{install_plugins}."\n");
+ $self->output("\ninstallplugins: \$(PLUGINS)\n".$self->{install_plugins}."\n");
$self->output("\nuninstallplugins:\n".$self->{uninstall_plugins}."\n");
$self->_prepare_mk_files();
diff --git a/source4/build/smb_build/output.pm b/source4/build/smb_build/output.pm
index 02e30ceeb5..0897232f98 100644
--- a/source4/build/smb_build/output.pm
+++ b/source4/build/smb_build/output.pm
@@ -43,15 +43,23 @@ sub generate_shared_library($)
{
my $lib = shift;
my $link_name;
+ my $lib_name;
@{$lib->{DEPEND_LIST}} = ();
@{$lib->{LINK_LIST}} = ("\$($lib->{TYPE}_$lib->{NAME}\_OBJ_LIST)");
- $link_name = $lib->{NAME};
- $link_name =~ s/^LIB//;
- $link_name = lc($link_name);
+ $link_name = lc($lib->{NAME});
+ $lib_name = $link_name;
+
+ if ($lib->{TYPE} eq "LIBRARY") {
+ $link_name = $lib->{NAME};
+ $link_name =~ s/^LIB//;
+ $link_name = lc($link_name);
+ $lib_name = "lib$link_name";
+ $lib->{OUTPUT} = "-l$link_name";
+ }
- $lib->{LIBRARY_REALNAME} = $lib->{LIBRARY_NAME} = "lib$link_name.\$(SHLIBEXT)";
+ $lib->{LIBRARY_REALNAME} = $lib->{LIBRARY_NAME} = "$lib_name.\$(SHLIBEXT)";
$lib->{TARGET} = "bin/$lib->{LIBRARY_NAME}";
if (defined($lib->{MAJOR_VERSION})) {
$lib->{LIBRARY_SONAME} = $lib->{LIBRARY_NAME}.".$lib->{MAJOR_VERSION}";
@@ -59,7 +67,6 @@ sub generate_shared_library($)
$lib->{TARGET} = "bin/$lib->{LIBRARY_REALNAME}";
@{$lib->{LINK_FLAGS}} = ("\$(SONAMEFLAG)$lib->{LIBRARY_SONAME}");
}
- $lib->{OUTPUT} = "-l$link_name";
}
sub generate_static_library($)
diff --git a/source4/main.mk b/source4/main.mk
index df0951d2a9..28acf96bec 100644
--- a/source4/main.mk
+++ b/source4/main.mk
@@ -268,12 +268,17 @@ clean: heimdal_clean clean_pch
@echo Removing hostcc objects
@-find . -name '*.ho' -exec rm -f '{}' \;
@echo Removing binaries
- @-rm -f $(BIN_PROGS) $(SBIN_PROGS)
+ @-rm -f $(BIN_PROGS) $(SBIN_PROGS) $(BINARIES)
@echo Removing libraries
- @-rm -f bin/*.$(SHLIBEXT).*
+ @-rm -f $(STATIC_LIBRARIES) $(SHARED_LIBRARIES)
+ @-rm -f bin/*.$(SHLIBEXT)*
+ @echo Removing modules
+ @-rm -f $(SHARED_MODULES) $(PLUGINS)
+ @-rm -f bin/*_init_module.c
@echo Removing dummy targets
@-rm -f bin/.*_*
@echo Removing generated files
+ @-rm -f bin/*_init_module.c
@-rm -rf librpc/gen_*
@-rm -f lib/registry/regf.h lib/registry/tdr_regf*
@echo Removing proto headers
@@ -286,6 +291,7 @@ distclean: clean
-rm -f config.log config.cache
-rm -f samba4-deps.dot
-rm -f config.pm config.mk
+ -rm -f $(PC_FILES)
removebackup:
-rm -f *.bak *~ */*.bak */*~ */*/*.bak */*/*~ */*/*/*.bak */*/*/*~