diff options
Diffstat (limited to 'source4/build/smb_build/makefile.pm')
-rw-r--r-- | source4/build/smb_build/makefile.pm | 37 |
1 files changed, 31 insertions, 6 deletions
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(); |