summaryrefslogtreecommitdiff
path: root/source4/build
diff options
context:
space:
mode:
Diffstat (limited to 'source4/build')
-rw-r--r--source4/build/m4/check_ld.m417
-rw-r--r--source4/build/m4/check_make.m48
-rw-r--r--source4/build/m4/check_path.m42
-rw-r--r--source4/build/m4/public.m458
-rwxr-xr-xsource4/build/smb_build/cflags.pm2
-rw-r--r--source4/build/smb_build/config_mk.pm4
-rwxr-xr-xsource4/build/smb_build/dot.pl2
-rw-r--r--source4/build/smb_build/header.pm11
-rw-r--r--source4/build/smb_build/input.pm88
-rw-r--r--source4/build/smb_build/main.pl35
-rw-r--r--source4/build/smb_build/makefile.pm356
-rw-r--r--source4/build/smb_build/output.pm55
-rw-r--r--source4/build/smb_build/summary.pm8
13 files changed, 245 insertions, 401 deletions
diff --git a/source4/build/m4/check_ld.m4 b/source4/build/m4/check_ld.m4
index 3b69057a69..0d0742e5d2 100644
--- a/source4/build/m4/check_ld.m4
+++ b/source4/build/m4/check_ld.m4
@@ -13,6 +13,7 @@ LD=""
AC_SUBST(BLDSHARED)
AC_SUBST(LD)
+AC_SUBST(SYS_LDFLAGS)
AC_SUBST(LDFLAGS)
# Assume non-shared by default and override below
@@ -32,13 +33,13 @@ AC_MSG_CHECKING([whether to try to build shared libraries on $host_os])
case "$host_os" in
*linux*)
BLDSHARED="true"
- LDFLAGS="$LDFLAGS -Wl,--export-dynamic"
+ SYS_LDFLAGS="-Wl,--export-dynamic"
;;
*solaris*)
BLDSHARED="true"
if test "${GCC}" = "yes"; then
if test "${ac_cv_prog_gnu_ld}" = "yes"; then
- LDFLAGS="$LDFLAGS -Wl,-E"
+ SYS_LDFLAGS="-Wl,-E"
fi
fi
;;
@@ -47,26 +48,26 @@ case "$host_os" in
;;
*netbsd* | *freebsd* | *dragonfly* )
BLDSHARED="true"
- LDFLAGS="$LDFLAGS -Wl,--export-dynamic"
+ SYS_LDFLAGS="-Wl,--export-dynamic"
;;
*openbsd*)
BLDSHARED="true"
- LDFLAGS="$LDFLAGS -Wl,-Bdynamic"
+ SYS_LDFLAGS="-Wl,-Bdynamic"
;;
*irix*)
BLDSHARED="true"
;;
*aix*)
BLDSHARED="true"
- LDFLAGS="$LDFLAGS -Wl,-brtl,-bexpall,-bbigtoc"
+ SYS_LDFLAGS="-Wl,-brtl,-bexpall,-bbigtoc"
;;
*hpux*)
# Use special PIC flags for the native HP-UX compiler.
BLDSHARED="true" # I hope this is correct
if test "$host_cpu" = "ia64"; then
- LDFLAGS="$LDFLAGS -Wl,-E,+b/usr/local/lib/hpux32:/usr/lib/hpux32"
+ SYS_LDFLAGS="-Wl,-E,+b/usr/local/lib/hpux32:/usr/lib/hpux32"
else
- LDFLAGS="$LDFLAGS -Wl,-E,+b/usr/local/lib:/usr/lib"
+ SYS_LDFLAGS="-Wl,-E,+b/usr/local/lib:/usr/lib"
fi
;;
*osf*)
@@ -86,6 +87,8 @@ AC_MSG_CHECKING([LD])
AC_MSG_RESULT([$LD])
AC_MSG_CHECKING([LDFLAGS])
AC_MSG_RESULT([$LDFLAGS])
+AC_MSG_CHECKING([SYS_LDFLAGS])
+AC_MSG_RESULT([$SYS_LDFLAGS])
AC_SUBST(HOSTLD)
diff --git a/source4/build/m4/check_make.m4 b/source4/build/m4/check_make.m4
index 4780f43e1c..d7799649a7 100644
--- a/source4/build/m4/check_make.m4
+++ b/source4/build/m4/check_make.m4
@@ -46,3 +46,11 @@ AC_ARG_ENABLE(automatic-dependencies,
[ automatic_dependencies=no ])
AC_MSG_RESULT($automatic_dependencies)
AC_SUBST(automatic_dependencies)
+
+FIRST_PREREQ="\$*.c"
+AC_SUBST(FIRST_PREREQ)
+
+if test x$GNU_MAKE = xyes; then
+ FIRST_PREREQ="\$<"
+fi
+
diff --git a/source4/build/m4/check_path.m4 b/source4/build/m4/check_path.m4
index 1dacd956ea..08a858ebb2 100644
--- a/source4/build/m4/check_path.m4
+++ b/source4/build/m4/check_path.m4
@@ -132,7 +132,7 @@ AC_SUBST(modulesdir)
selftest_prefix="./st"
AC_SUBST(selftest_prefix)
AC_ARG_WITH(selftest-prefix,
-[ --with-selftest-prefix=DIR The prefix where make test will be runned ($selftest_prefix)],
+[ --with-selftest-prefix=DIR The prefix where make test will be run ($selftest_prefix)],
[ case "$withval" in
yes|no)
AC_MSG_WARN([--with-selftest-prefix called without argument - will use default])
diff --git a/source4/build/m4/public.m4 b/source4/build/m4/public.m4
index 4192128bbd..eb673446c7 100644
--- a/source4/build/m4/public.m4
+++ b/source4/build/m4/public.m4
@@ -8,7 +8,7 @@ dnl SMB_SUBSYSTEM(name,obj_files,required_subsystems)
dnl
dnl SMB_EXT_LIB_FROM_PKGCONFIG(name,pkg-config name,[ACTION-IF-FOUND],[ACTION-IF-NOT-FOUND])
dnl
-dnl SMB_EXT_LIB(name,libs,cflags,cppflags,ldflags,pcname)
+dnl SMB_EXT_LIB(name,libs,cflags,cppflags,ldflags)
dnl
dnl SMB_ENABLE(name,default_build)
dnl
@@ -21,33 +21,45 @@ dnl #######################################################
dnl SMB_SUBSYSTEM(name,obj_files,required_subsystems,cflags)
AC_DEFUN([SMB_SUBSYSTEM],
[
+MAKE_SETTINGS="$MAKE_SETTINGS
+$1_OBJ_FILES = $2
+$1_CFLAGS = $4
+$1_ENABLE = YES
+"
+
SMB_INFO_SUBSYSTEMS="$SMB_INFO_SUBSYSTEMS
###################################
# Start Subsystem $1
@<:@SUBSYSTEM::$1@:>@
-OBJ_FILES = $2
+OBJ_FILES = \$($1_OBJ_FILES)
PRIVATE_DEPENDENCIES = $3
-CFLAGS = $4
+CFLAGS = \$($1_CFLAGS)
ENABLE = YES
# End Subsystem $1
###################################
"
])
-dnl SMB_LIBRARY(name,obj_files,required_subsystems,version,so_version,cflags,ldflags,pcname)
+dnl SMB_LIBRARY(name,obj_files,required_subsystems,version,so_version,cflags,ldflags)
AC_DEFUN([SMB_LIBRARY],
[
+MAKE_SETTINGS="$MAKE_SETTINGS
+$1_OBJ_FILES = $2
+$1_CFLAGS = $6
+$1_LDFLAGS = $7
+$1_ENABLE = YES
+"
+
SMB_INFO_LIBRARIES="$SMB_INFO_LIBRARIES
###################################
# Start Library $1
@<:@LIBRARY::$1@:>@
-OBJ_FILES = $2
+OBJ_FILES = \$($1_OBJ_FILES)
PRIVATE_DEPENDENCIES = $3
VERSION = $4
SO_VERSION = $5
-CFLAGS = $6
-LDFLAGS = $7
-PC_NAME = $8
+CFLAGS = \$($1_CFLAGS)
+LDFLAGS = \$($1_LDFLAGS)
ENABLE = YES
# End Library $1
###################################
@@ -91,8 +103,7 @@ AC_DEFUN([SMB_EXT_LIB_FROM_PKGCONFIG],
[`$PKG_CONFIG --libs-only-l '$2'`],
[`$PKG_CONFIG --cflags-only-other '$2'`],
[`$PKG_CONFIG --cflags-only-I '$2'`],
- [`$PKG_CONFIG --libs-only-other '$2'` `$PKG_CONFIG --libs-only-L '$2'`],
- [ $2 ])
+ [`$PKG_CONFIG --libs-only-other '$2'` `$PKG_CONFIG --libs-only-L '$2'`])
ac_cv_$1_found=yes
else
@@ -120,33 +131,28 @@ dnl SMB_INCLUDE_MK(file)
AC_DEFUN([SMB_INCLUDE_MK],
[
SMB_INFO_EXT_LIBS="$SMB_INFO_EXT_LIBS
-include $1
+mkinclude $1
"
])
-dnl SMB_EXT_LIB(name,libs,cflags,cppflags,ldflags,pcname)
+dnl SMB_EXT_LIB(name,libs,cflags,cppflags,ldflags)
AC_DEFUN([SMB_EXT_LIB],
[
-
-SMB_INFO_EXT_LIBS="$SMB_INFO_EXT_LIBS
-###################################
-# Start Ext Lib $1
-@<:@EXT_LIB::$1@:>@
-LIBS = $2
-CFLAGS = $3
-CPPFLAGS = $4
-LDFLAGS = $5
-PC_NAME = $6
-# End Ext Lib $1
-###################################
+MAKE_SETTINGS="$MAKE_SETTINGS
+$1_LIBS = $2
+$1_CFLAGS = $3
+$1_CPPFLAGS = $4
+$1_LDFLAGS = $5
"
+
])
dnl SMB_ENABLE(name,default_build)
AC_DEFUN([SMB_ENABLE],
[
- [SMB_ENABLE_][$1]="$2";
-
+ MAKE_SETTINGS="$MAKE_SETTINGS
+$1_ENABLE = $2
+"
SMB_INFO_ENABLES="$SMB_INFO_ENABLES
\$enabled{$1} = \"$2\";"
])
diff --git a/source4/build/smb_build/cflags.pm b/source4/build/smb_build/cflags.pm
index ad6cd42c65..a4ab90a8cd 100755
--- a/source4/build/smb_build/cflags.pm
+++ b/source4/build/smb_build/cflags.pm
@@ -23,6 +23,8 @@ sub create_cflags($$$$) {
open(CFLAGS_TXT,">$file") || die ("Can't open `$file'\n");
+ print CFLAGS_TXT "include mkconfig.mk\n";
+
my $src_ne_build = ($srcdir ne $builddir) ? 1 : 0;
foreach my $key (values %{$CTX}) {
diff --git a/source4/build/smb_build/config_mk.pm b/source4/build/smb_build/config_mk.pm
index aa075490bc..4d8db8a04e 100644
--- a/source4/build/smb_build/config_mk.pm
+++ b/source4/build/smb_build/config_mk.pm
@@ -18,7 +18,6 @@ my $section_types = {
"CFLAGS" => "list",
"CPPFLAGS" => "list",
"LDFLAGS" => "list",
- "PC_NAME" => "string",
},
"PYTHON" => {
SWIG_FILE => "string",
@@ -90,7 +89,6 @@ my $section_types = {
"SO_VERSION" => "string",
"LIBRARY_REALNAME" => "string",
- "PC_NAME" => "string",
"PC_FILE" => "string",
"INIT_FUNCTION_TYPE" => "string",
@@ -241,7 +239,7 @@ sub run_config_mk($$$$)
}
# include
- if ($line =~ /^include (.*)$/) {
+ if ($line =~ /^mkinclude (.*)$/) {
my $subfile= $1;
my $subdir = dirname($filename);
$subdir =~ s/^\.$//g;
diff --git a/source4/build/smb_build/dot.pl b/source4/build/smb_build/dot.pl
index 82f89c081a..e50ee50f95 100755
--- a/source4/build/smb_build/dot.pl
+++ b/source4/build/smb_build/dot.pl
@@ -44,7 +44,7 @@ my $name = "samba4";
my $only;
if (defined($subsys)) {
my $DEPEND = smb_build::input::check($INPUT, \%config::enabled,
- "STATIC_LIBRARY", "SHARED_LIBRARY", "SHARED_LIBRARY");
+ "MERGED_OBJ", "SHARED_LIBRARY", "SHARED_LIBRARY");
die("No such subsystem $subsys") unless (defined($DEPEND->{$subsys}));
diff --git a/source4/build/smb_build/header.pm b/source4/build/smb_build/header.pm
index b52464922b..c2bdbaf4c8 100644
--- a/source4/build/smb_build/header.pm
+++ b/source4/build/smb_build/header.pm
@@ -44,8 +44,14 @@ sub _prepare_build_h($)
$DEFINE->{VAL} .= "\t$_, \\\n";
unless (/{/) {
my $fn = $key->{INIT_FUNCTION_TYPE};
- $fn =~ s/\(\*\)/$_/;
- $output .= "$fn;\n";
+ my $n = $_;
+ if ($fn =~ /\(\*\)/) {
+ $fn =~ s/\(\*\)/$n/;
+ $output .= "$fn;\n";
+ } else {
+ $n =~ s/\&//;
+ $output .= "$fn $n;\n";
+ }
}
}
@@ -82,4 +88,5 @@ sub create_smb_build_h($$)
print __FILE__.": creating $file\n";
}
+
1;
diff --git a/source4/build/smb_build/input.pm b/source4/build/smb_build/input.pm
index 6d5c4f4a1e..da90e9db48 100644
--- a/source4/build/smb_build/input.pm
+++ b/source4/build/smb_build/input.pm
@@ -5,13 +5,10 @@
# Copyright (C) Jelmer Vernooij 2004
# Released under the GNU GPL
-use smb_build::config;
use strict;
package smb_build::input;
use File::Basename;
-my $srcdir = $config::config{srcdir};
-
sub strtrim($)
{
$_ = shift;
@@ -60,14 +57,9 @@ sub check_subsystem($$$)
my ($INPUT, $subsys, $default_ot) = @_;
return if ($subsys->{ENABLE} ne "YES");
- unless(defined($subsys->{OUTPUT_TYPE})) {
- $subsys->{OUTPUT_TYPE} = $default_ot;
- }
-
+ unless (defined($subsys->{OUTPUT_TYPE})) { $subsys->{OUTPUT_TYPE} = $default_ot; }
unless (defined($subsys->{INIT_FUNCTION_TYPE})) { $subsys->{INIT_FUNCTION_TYPE} = "NTSTATUS (*) (void)"; }
unless (defined($subsys->{INIT_FUNCTION_SENTINEL})) { $subsys->{INIT_FUNCTION_SENTINEL} = "NULL"; }
-
- add_libreplace($subsys);
}
sub check_module($$$)
@@ -76,18 +68,16 @@ sub check_module($$$)
die("Module $mod->{NAME} does not have a SUBSYSTEM set") if not defined($mod->{SUBSYSTEM});
- my $use_default = 0;
-
if (not exists($INPUT->{$mod->{SUBSYSTEM}}{INIT_FUNCTIONS})) {
$INPUT->{$mod->{SUBSYSTEM}}{INIT_FUNCTIONS} = [];
}
if (!(defined($INPUT->{$mod->{SUBSYSTEM}}))) {
- $mod->{ENABLE} = "NO";
- return;
+ die("Unknown subsystem $mod->{SUBSYSTEM} for module $mod->{NAME}");
}
if ($INPUT->{$mod->{SUBSYSTEM}} eq "NO") {
+ warn("Disabling module $mod->{NAME} because subsystem $mod->{SUBSYSTEM} is disabled");
$mod->{ENABLE} = "NO";
return;
}
@@ -102,7 +92,7 @@ sub check_module($$$)
if (not defined($mod->{OUTPUT_TYPE})) {
if ($INPUT->{$mod->{SUBSYSTEM}}->{TYPE} eq "EXT_LIB") {
- $mod->{OUTPUT_TYPE} = ["SHARED_LIBRARY"];
+ $mod->{OUTPUT_TYPE} = undef;
} else {
$mod->{OUTPUT_TYPE} = $default_ot;
}
@@ -113,11 +103,12 @@ sub check_module($$$)
$sane_subsystem =~ s/^lib//;
$mod->{INSTALLDIR} = "MODULESDIR/$sane_subsystem";
push (@{$mod->{PUBLIC_DEPENDENCIES}}, $mod->{SUBSYSTEM});
+ add_libreplace($mod);
}
- if (grep(/INTEGRATED/, @{$mod->{OUTPUT_TYPE}})) {
+ if (grep(/MERGED_OBJ/, @{$mod->{OUTPUT_TYPE}})) {
push (@{$INPUT->{$mod->{SUBSYSTEM}}{INIT_FUNCTIONS}}, $mod->{INIT_FUNCTION}) if defined($mod->{INIT_FUNCTION});
+ unshift (@{$INPUT->{$mod->{SUBSYSTEM}}{PRIVATE_DEPENDENCIES}}, $mod->{NAME});
}
- add_libreplace($mod);
}
sub check_library($$$)
@@ -126,9 +117,7 @@ sub check_library($$$)
return if ($lib->{ENABLE} ne "YES");
- unless (defined($lib->{OUTPUT_TYPE})) {
- $lib->{OUTPUT_TYPE} = $default_ot;
- }
+ unless (defined($lib->{OUTPUT_TYPE})) { $lib->{OUTPUT_TYPE} = $default_ot; }
if (defined($lib->{VERSION}) and not defined($lib->{SO_VERSION})) {
print "$lib->{NAME}: Please specify SO_VERSION when specifying VERSION\n";
@@ -141,12 +130,8 @@ sub check_library($$$)
}
unless (defined($lib->{INIT_FUNCTION_TYPE})) { $lib->{INIT_FUNCTION_TYPE} = "NTSTATUS (*) (void)"; }
-
unless (defined($lib->{INIT_FUNCTION_SENTINEL})) { $lib->{INIT_FUNCTION_SENTINEL} = "NULL"; }
-
- unless(defined($lib->{INSTALLDIR})) {
- $lib->{INSTALLDIR} = "LIBDIR";
- }
+ unless (defined($lib->{INSTALLDIR})) { $lib->{INSTALLDIR} = "LIBDIR"; }
add_libreplace($lib);
}
@@ -169,8 +154,8 @@ sub check_python($$$)
$python->{OBJ_FILES} = ["$dirname$basename\_wrap.o"];
$python->{LIBRARY_REALNAME} = "_$basename.\$(SHLIBEXT)";
$python->{PYTHON_FILES} = ["$dirname$basename.py"];
- push (@{$python->{CFLAGS}}, $config::config{CFLAG_NO_UNUSED_MACROS});
- push (@{$python->{CFLAGS}}, $config::config{CFLAG_NO_CAST_QUAL});
+ push (@{$python->{CFLAGS}}, "\$(CFLAG_NO_UNUSED_MACROS)");
+ push (@{$python->{CFLAGS}}, "\$(CFLAG_NO_CAST_QUAL)");
$python->{INIT_FUNCTION} = "{ (char *)\"_$basename\", init_$basename }";
} else {
my $basename = $python->{NAME};
@@ -178,7 +163,7 @@ sub check_python($$$)
$python->{LIBRARY_REALNAME} = "$basename.\$(SHLIBEXT)";
$python->{INIT_FUNCTION} = "{ (char *)\"$basename\", init$basename }";
}
- push (@{$python->{CFLAGS}}, @{$INPUT->{EXT_LIB_PYTHON}->{CFLAGS}});
+ push (@{$python->{CFLAGS}}, "\$(EXT_LIB_PYTHON_CFLAGS)");
$python->{SUBSYSTEM} = "LIBPYTHON";
@@ -197,25 +182,20 @@ sub check_binary($$)
add_libreplace($bin);
}
-sub import_integrated($$)
+sub add_implicit($$)
{
- my ($lib, $depend) = @_;
-
- foreach my $mod (values %$depend) {
- next if(not defined($mod->{OUTPUT_TYPE}));
- next if(not grep(/INTEGRATED/, @{$mod->{OUTPUT_TYPE}}));
- next if(not defined($mod->{SUBSYSTEM}));
- next if($mod->{SUBSYSTEM} ne $lib->{NAME});
- next if($mod->{ENABLE} ne "YES");
-
- push (@{$lib->{FULL_OBJ_LIST}}, "\$($mod->{TYPE}_$mod->{NAME}_FULL_OBJ_LIST)");
- push (@{$lib->{LINK_FLAGS}}, "\$($mod->{TYPE}_$mod->{NAME}_LINK_FLAGS)");
- push (@{$lib->{CFLAGS}}, @{$mod->{CFLAGS}}) if defined($mod->{CFLAGS});
- push (@{$lib->{PUBLIC_DEPENDENCIES}}, @{$mod->{PUBLIC_DEPENDENCIES}}) if defined($mod->{PUBLIC_DEPENDENCIES});
- push (@{$lib->{PRIVATE_DEPENDENCIES}}, @{$mod->{PRIVATE_DEPENDENCIES}}) if defined($mod->{PRIVATE_DEPENDENCIES});
-
- $mod->{ENABLE} = "NO";
- }
+ my ($INPUT, $n) = @_;
+
+ $INPUT->{$n} = {
+ TYPE => "MAKE_RULE",
+ NAME => $n,
+ TARGET => "",
+ OUTPUT_TYPE => undef,
+ LIBS => ["\$(".uc($n)."_LIBS)"],
+ LDFLAGS => ["\$(".uc($n)."_LDFLAGS)"],
+ CFLAGS => ["\$(".uc($n)."_CFLAGS)"],
+ CPPFLAGS => ["\$(".uc($n)."_CPPFLAGS)"]
+ };
}
sub calc_unique_deps($$$$$$$$)
@@ -224,16 +204,19 @@ sub calc_unique_deps($$$$$$$$)
my ($name, $INPUT, $deps, $udeps, $withlibs, $forward, $pubonly, $busy) = @_;
foreach my $n (@$deps) {
- die("Dependency unknown: $n (for $name)") unless (defined($INPUT->{$n}));
- die("Recursive dependency: $n, list: " . join(',', @$busy)) if (grep (/^$n$/, @$busy));
- next if (grep /^$n$/, @$udeps);
+ add_implicit($INPUT, $n) unless (defined($INPUT->{$n}));
my $dep = $INPUT->{$n};
+ if (grep (/^$n$/, @$busy)) {
+ next if (@{$dep->{OUTPUT_TYPE}}[0] eq "MERGED_OBJ");
+ die("Recursive dependency: $n, list: " . join(',', @$busy));
+ }
+ next if (grep /^$n$/, @$udeps);
push (@{$udeps}, $dep->{NAME}) if $forward;
if (defined ($dep->{OUTPUT_TYPE}) &&
($withlibs or
- (@{$dep->{OUTPUT_TYPE}}[0] eq "INTEGRATED") or
+ (@{$dep->{OUTPUT_TYPE}}[0] eq "MERGED_OBJ") or
(@{$dep->{OUTPUT_TYPE}}[0] eq "STATIC_LIBRARY"))) {
push (@$busy, $dep->{NAME});
calc_unique_deps($dep->{NAME}, $INPUT, $dep->{PUBLIC_DEPENDENCIES}, $udeps, $withlibs, $forward, $pubonly, $busy);
@@ -280,11 +263,9 @@ sub check($$$$$)
}
}
- foreach my $k (keys %$INPUT) {
- my $part = $INPUT->{$k};
-
+ foreach my $part (values %$INPUT) {
$part->{LINK_FLAGS} = [];
- $part->{FULL_OBJ_LIST} = ["\$($part->{TYPE}_$part->{NAME}_OBJ_LIST)"];
+ $part->{FULL_OBJ_LIST} = ["\$($part->{NAME}_OBJ_LIST)"];
if ($part->{TYPE} eq "SUBSYSTEM") {
check_subsystem($INPUT, $part, $subsys_ot);
@@ -306,7 +287,6 @@ sub check($$$$$)
if (defined($part->{INIT_FUNCTIONS})) {
push (@{$part->{LINK_FLAGS}}, "\$(DYNEXP)");
}
- import_integrated($part, $INPUT);
}
foreach my $part (values %$INPUT) {
diff --git a/source4/build/smb_build/main.pl b/source4/build/smb_build/main.pl
index fb769103d0..3ed0327d6d 100644
--- a/source4/build/smb_build/main.pl
+++ b/source4/build/smb_build/main.pl
@@ -19,8 +19,7 @@ use strict;
my $INPUT = {};
my $mkfile = smb_build::config_mk::run_config_mk($INPUT, $config::config{srcdir}, $config::config{builddir}, "main.mk");
-my $subsys_output_type;
-$subsys_output_type = ["STATIC_LIBRARY"];
+my $subsys_output_type = ["MERGED_OBJ"];
my $library_output_type;
if ($config::config{USESHARED} eq "true") {
@@ -35,7 +34,7 @@ my $module_output_type;
if ($config::config{USESHARED} eq "true") {
$module_output_type = ["SHARED_LIBRARY"];
} else {
- $module_output_type = ["INTEGRATED"];
+ $module_output_type = ["MERGED_OBJ"];
}
my $DEPEND = smb_build::input::check($INPUT, \%config::enabled,
@@ -43,36 +42,31 @@ my $DEPEND = smb_build::input::check($INPUT, \%config::enabled,
$library_output_type,
$module_output_type);
my $OUTPUT = output::create_output($DEPEND, \%config::config);
-$config::config{SUBSYSTEM_OUTPUT_TYPE} = $subsys_output_type;
-$config::config{LIBRARY_OUTPUT_TYPE} = $library_output_type;
-$config::config{MODULE_OUTPUT_TYPE} = $module_output_type;
my $mkenv = new smb_build::makefile(\%config::config, $mkfile);
+my $shared_libs_used = 0;
foreach my $key (values %$OUTPUT) {
- next unless defined $key->{OUTPUT_TYPE};
-
- $mkenv->Integrated($key) if grep(/INTEGRATED/, @{$key->{OUTPUT_TYPE}});
+ $mkenv->_prepare_list($key, "OBJ_LIST");
+ push(@{$mkenv->{all_objs}}, "\$($key->{NAME}_OBJ_LIST)");
}
-my $shared_libs_used = 0;
-
foreach my $key (values %$OUTPUT) {
next unless defined $key->{OUTPUT_TYPE};
+ $mkenv->MergedObj($key) if grep(/MERGED_OBJ/, @{$key->{OUTPUT_TYPE}});
$mkenv->StaticLibrary($key) if grep(/STATIC_LIBRARY/, @{$key->{OUTPUT_TYPE}});
if (defined($key->{PC_FILE})) {
push(@{$mkenv->{pc_files}}, "$key->{BASEDIR}/$key->{PC_FILE}");
}
- $mkenv->SharedLibrary($key) if ($key->{TYPE} eq "LIBRARY") and
+ $mkenv->SharedLibraryPrimitives($key) if ($key->{TYPE} eq "LIBRARY") and
grep(/SHARED_LIBRARY/, @{$key->{OUTPUT_TYPE}});
if ($key->{TYPE} eq "LIBRARY" and
${$key->{OUTPUT_TYPE}}[0] eq "SHARED_LIBRARY") {
$shared_libs_used = 1;
}
- $mkenv->SharedModule($key) if ($key->{TYPE} eq "MODULE" or
+ $mkenv->SharedModulePrimitives($key) if ($key->{TYPE} eq "MODULE" or
$key->{TYPE} eq "PYTHON") and
grep(/SHARED_LIBRARY/, @{$key->{OUTPUT_TYPE}});
- $mkenv->Binary($key) if grep(/BINARY/, @{$key->{OUTPUT_TYPE}});
$mkenv->PythonFiles($key) if defined($key->{PYTHON_FILES});
$mkenv->Manpage($key) if defined($key->{MANPAGE});
$mkenv->Header($key) if defined($key->{PUBLIC_HEADERS});
@@ -80,7 +74,18 @@ foreach my $key (values %$OUTPUT) {
defined($key->{PUBLIC_PROTO_HEADER});
}
-$mkenv->write("Makefile");
+foreach my $key (values %$OUTPUT) {
+ next unless defined $key->{OUTPUT_TYPE};
+
+ $mkenv->SharedLibrary($key) if ($key->{TYPE} eq "LIBRARY") and
+ grep(/SHARED_LIBRARY/, @{$key->{OUTPUT_TYPE}});
+ $mkenv->SharedModule($key) if ($key->{TYPE} eq "MODULE" or
+ $key->{TYPE} eq "PYTHON") and
+ grep(/SHARED_LIBRARY/, @{$key->{OUTPUT_TYPE}});
+ $mkenv->Binary($key) if grep(/BINARY/, @{$key->{OUTPUT_TYPE}});
+}
+
+$mkenv->write("data.mk");
header::create_smb_build_h($OUTPUT, "include/build.h");
cflags::create_cflags($OUTPUT, $config::config{srcdir},
diff --git a/source4/build/smb_build/makefile.pm b/source4/build/smb_build/makefile.pm
index 452e4254a3..17474db00e 100644
--- a/source4/build/smb_build/makefile.pm
+++ b/source4/build/smb_build/makefile.pm
@@ -24,35 +24,23 @@ sub new($$$)
$self->{manpages} = [];
$self->{sbin_progs} = [];
$self->{bin_progs} = [];
- $self->{torture_progs} = [];
$self->{static_libs} = [];
$self->{python_dsos} = [];
$self->{python_pys} = [];
$self->{shared_libs} = [];
- $self->{installable_shared_libs} = [];
$self->{headers} = [];
- $self->{shared_modules} = [];
$self->{plugins} = [];
- $self->{install_plugins} = "";
- $self->{uninstall_plugins} = "";
$self->{pc_files} = [];
$self->{proto_headers} = [];
$self->{output} = "";
$self->{mkfile} = $mkfile;
- $self->output("#!gmake\n");
$self->output("################################################\n");
$self->output("# Autogenerated by build/smb_build/makefile.pm #\n");
$self->output("################################################\n");
$self->output("\n");
- $self->output("default: all\n\n");
-
- $self->_prepare_path_vars();
- $self->_prepare_suffix_rules();
- $self->_prepare_compiler_linker();
-
if (!$self->{automatic_deps}) {
$self->output("ALL_PREDEP = proto\n");
$self->output(".NOTPARALLEL:\n");
@@ -68,173 +56,6 @@ sub output($$)
$self->{output} .= $text;
}
-sub _prepare_path_vars($)
-{
- my ($self) = @_;
-
- $self->output(<< "__EOD__"
-prefix = $self->{config}->{prefix}
-exec_prefix = $self->{config}->{exec_prefix}
-selftest_prefix = $self->{config}->{selftest_prefix}
-
-builddir = $self->{config}->{builddir}
-srcdir = $self->{config}->{srcdir}
-datarootdir = $self->{config}->{datarootdir}
-
-VPATH = \$(builddir):\$(srcdir):heimdal_build:heimdal/lib/asn1:heimdal/lib/krb5:heimdal/lib/gssapi:heimdal/lib/hdb:heimdal/lib/roken:heimdal/lib/des
-
-BASEDIR = $self->{config}->{prefix}
-BINDIR = $self->{config}->{bindir}
-SBINDIR = $self->{config}->{sbindir}
-LIBDIR = $self->{config}->{libdir}
-TORTUREDIR = $self->{config}->{libdir}/torture
-MODULESDIR = $self->{config}->{modulesdir}
-INCLUDEDIR = $self->{config}->{includedir}
-CONFIGDIR = $self->{config}->{sysconfdir}
-DATADIR = $self->{config}->{datadir}
-SWATDIR = \$(DATADIR)/swat
-JSDIR = \$(DATADIR)/js
-SETUPDIR = \$(DATADIR)/setup
-VARDIR = $self->{config}->{localstatedir}
-LOGFILEBASE = $self->{config}->{logfilebase}
-NCALRPCDIR = $self->{config}->{localstatedir}/ncalrpc
-LOCKDIR = $self->{config}->{lockdir}
-PIDDIR = $self->{config}->{piddir}
-MANDIR = $self->{config}->{mandir}
-PRIVATEDIR = $self->{config}->{privatedir}
-WINBINDD_SOCKET_DIR = $self->{config}->{winbindd_socket_dir}
-
-__EOD__
-);
-}
-
-sub _prepare_suffix_rules($)
-{
- my ($self) = @_;
- my $first_prereq = '$*.c';
-
- if ($self->{config}->{GNU_MAKE} eq 'yes') {
- $first_prereq = '$<';
- }
-
- $self->output(<< "__EOD__"
-FIRST_PREREQ = $first_prereq
-
-# Dependencies command
-DEPENDS = \$(CC) -M -MG -MP -MT \$(<:.c=.o) -MT \$@ \\
- \$(CFLAGS) `\$(PERL) \$(srcdir)/script/cflags.pl \$@` \\
- \$(CPPFLAGS) \$(FIRST_PREREQ) -o \$@
-# Dependencies for host objects
-HDEPENDS = \$(CC) -M -MG -MP -MT \$(<:.c=.ho) -MT \$@ \\
- \$(HOSTCC_FLAGS) `\$(PERL) \$(srcdir)/script/cflags.pl \$@` \\
- \$(CPPFLAGS) \$(FIRST_PREREQ) -o \$@
-# Dependencies for precompiled headers
-PCHDEPENDS = \$(CC) -M -MG -MT include/includes.h.gch -MT \$@ \\
- \$(CFLAGS) \$(CPPFLAGS) \$(FIRST_PREREQ) -o \$@
-
-# \$< is broken in older BSD versions:
-# when \$@ is foo/bar.o, \$< could be torture/foo/bar.c
-# if it also exists. So better use \$* which is foo/bar
-# and append .c manually to get foo/bar.c
-#
-# If we have GNU Make, it is safe to use \$<, which also lets
-# building with \$srcdir != \$builddir work.
-
-# Run a static analysis checker
-CHECK = \$(CC_CHECKER) \$(CFLAGS) `\$(PERL) \$(srcdir)/script/cflags.pl \$@` \\
- \$(PICFLAG) \$(CPPLAGS) -c \$(FIRST_PREREQ) -o \$@
-
-# Run the configured compiler
-COMPILE = \$(CC) \$(CFLAGS) \$(PICFLAG) \\
- `\$(PERL) \$(srcdir)/script/cflags.pl \$@` \\
- \$(CPPFLAGS) \\
- -c \$(FIRST_PREREQ) -o \$@
-
-# Run the compiler for the build host
-HCOMPILE = \$(HOSTCC) \$(HOSTCC_FLAGS) `\$(PERL) \$(srcdir)/script/cflags.pl \$@` \\
- \$(CPPFLAGS) -c \$(FIRST_PREREQ) -o \$@
-
-# Precompile headers
-PCHCOMPILE = @\$(CC) -Ilib/replace \\
- \$(CFLAGS) `\$(PERL) \$(srcdir)/script/cflags.pl \$@` \\
- \$(PICFLAG) \$(CPPFLAGS) -c \$(FIRST_PREREQ) -o \$@
-
-__EOD__
-);
-}
-
-sub _prepare_compiler_linker($)
-{
- my ($self) = @_;
-
- my $builddir_headers = "";
- my $libdir;
- my $extra_link_flags = "";
-
- if ($self->{config}->{USESHARED} eq "true") {
- $libdir = "\$(builddir)/bin/shared";
- $extra_link_flags = "-Wl,-rpath-link,\$(builddir)/bin/shared";
- } else {
- $libdir = "\$(builddir)/bin/static";
- }
-
- if (!(abs_path($self->{config}->{srcdir}) eq abs_path($self->{config}->{builddir}))) {
- $builddir_headers= "-I\$(builddir)/include -I\$(builddir) -I\$(builddir)/lib ";
- }
-
- $self->output(<< "__EOD__"
-SHELL=$self->{config}->{SHELL}
-
-PERL=$self->{config}->{PERL}
-PYTHON=$self->{config}->{PYTHON}
-SWIG=$self->{config}->{SWIG}
-
-CPP=$self->{config}->{CPP}
-CPPFLAGS=$builddir_headers-I\$(srcdir)/include -I\$(srcdir) -I\$(srcdir)/lib -I\$(srcdir)/lib/replace -I\$(srcdir)/lib/talloc -D_SAMBA_BUILD_=4 -DHAVE_CONFIG_H $self->{config}->{CPPFLAGS}
-
-CC=$self->{config}->{CC}
-CFLAGS=$self->{config}->{CFLAGS}
-CFLAG_NO_UNUSED_MACROS=$self->{config}->{CFLAG_NO_UNUSED_MACROS}
-PICFLAG=$self->{config}->{PICFLAG}
-
-INSTALL_LINK_FLAGS=$extra_link_flags
-
-BNLD=$self->{config}->{LD}
-BNLD_FLAGS=$self->{config}->{LDFLAGS} -L$libdir
-
-STLD=$self->{config}->{STLD}
-STLD_FLAGS=$self->{config}->{STLD_FLAGS}
-
-SHLD=$self->{config}->{SHLD}
-SHLD_FLAGS=$self->{config}->{SHLD_FLAGS} -L\$(builddir)/bin/shared
-
-MDLD=$self->{config}->{MDLD}
-MDLD_FLAGS=$self->{config}->{MDLD_FLAGS} -L\$(builddir)/bin/shared
-
-SHLIBEXT=$self->{config}->{SHLIBEXT}
-
-HOSTCC=$self->{config}->{HOSTCC}
-HOSTCC_FLAGS=-D_SAMBA_HOSTCC_ \$(CFLAGS)
-
-HOSTLD=$self->{config}->{HOSTLD}
-HOSTLD_FLAGS=$self->{config}->{LDFLAGS}
-
-XSLTPROC=$self->{config}->{XSLTPROC}
-
-LIB_PATH_VAR=$self->{config}->{LIB_PATH_VAR}
-
-LEX=$self->{config}->{LEX}
-YACC=$self->{config}->{YACC}
-YAPP=$self->{config}->{YAPP}
-
-GCOV=$self->{config}->{GCOV}
-
-DEFAULT_TEST_OPTIONS=$self->{config}->{DEFAULT_TEST_OPTIONS}
-
-__EOD__
-);
-}
-
sub _prepare_mk_files($)
{
my $self = shift;
@@ -278,35 +99,24 @@ sub array2oneperline($)
return $output;
}
-sub _prepare_list_ex($$$$$)
+sub _prepare_list($$$)
{
- my ($self,$ctx,$var,$pre,$post) = @_;
+ my ($self,$ctx,$var) = @_;
my @tmparr = ();
- push(@tmparr, $pre) if defined($pre);
push(@tmparr, @{$ctx->{$var}}) if defined($ctx->{$var});
- push(@tmparr, $post) if defined($post);
my $tmplist = array2oneperline(\@tmparr);
return if ($tmplist eq "");
- $self->output("$ctx->{TYPE}\_$ctx->{NAME}_$var =$tmplist\n");
+ $self->output("$ctx->{NAME}_$var =$tmplist\n");
}
-sub _prepare_list($$$)
-{
- my ($self,$ctx,$var) = @_;
-
- $self->_prepare_list_ex($ctx, $var, undef, undef);
-}
-
-sub Integrated($$)
+sub SharedModulePrimitives($$)
{
my ($self,$ctx) = @_;
-
- $self->_prepare_list($ctx, "OBJ_LIST");
- $self->_prepare_list($ctx, "FULL_OBJ_LIST");
- $self->_prepare_list($ctx, "LINK_FLAGS");
+
+ #FIXME
}
sub SharedModule($$)
@@ -322,31 +132,36 @@ sub SharedModule($$)
push (@{$self->{python_dsos}},
"$ctx->{SHAREDDIR}/$ctx->{LIBRARY_REALNAME}");
} else {
- push (@{$self->{shared_modules}}, "$ctx->{TARGET_SHARED_LIBRARY}");
push (@{$self->{plugins}}, "$ctx->{SHAREDDIR}/$ctx->{LIBRARY_REALNAME}");
- $self->{install_plugins} .= "\t\@echo Installing $ctx->{SHAREDDIR}/$ctx->{LIBRARY_REALNAME} as \$(DESTDIR)\$(MODULESDIR)/$sane_subsystem/$ctx->{LIBRARY_REALNAME}\n";
- $self->{install_plugins} .= "\t\@mkdir -p \$(DESTDIR)\$(MODULESDIR)/$sane_subsystem/\n";
- $self->{install_plugins} .= "\t\@cp $ctx->{SHAREDDIR}/$ctx->{LIBRARY_REALNAME} \$(DESTDIR)\$(MODULESDIR)/$sane_subsystem/$ctx->{LIBRARY_REALNAME}\n";
- $self->{uninstall_plugins} .= "\t\@echo Uninstalling \$(DESTDIR)\$(MODULESDIR)/$sane_subsystem/$ctx->{LIBRARY_REALNAME}\n";
- $self->{uninstall_plugins} .= "\t\@-rm \$(DESTDIR)\$(MODULESDIR)/$sane_subsystem/$ctx->{LIBRARY_REALNAME}\n";
+ $self->output("installplugins:: $ctx->{SHAREDDIR}/$ctx->{LIBRARY_REALNAME}\n");
+ $self->output("\t\@echo Installing $ctx->{SHAREDDIR}/$ctx->{LIBRARY_REALNAME} as \$(DESTDIR)\$(modulesdir)/$sane_subsystem/$ctx->{LIBRARY_REALNAME}\n");
+ $self->output("\t\@mkdir -p \$(DESTDIR)\$(modulesdir)/$sane_subsystem/\n");
+ $self->output("\t\@cp $ctx->{SHAREDDIR}/$ctx->{LIBRARY_REALNAME} \$(DESTDIR)\$(modulesdir)/$sane_subsystem/$ctx->{LIBRARY_REALNAME}\n");
if (defined($ctx->{ALIASES})) {
foreach (@{$ctx->{ALIASES}}) {
- $self->{install_plugins} .= "\t\@rm -f \$(DESTDIR)\$(MODULESDIR)/$sane_subsystem/$_.\$(SHLIBEXT)\n";
- $self->{install_plugins} .= "\t\@ln -fs $ctx->{LIBRARY_REALNAME} \$(DESTDIR)\$(MODULESDIR)/$sane_subsystem/$_.\$(SHLIBEXT)\n";
- $self->{uninstall_plugins} .= "\t\@-rm \$(DESTDIR)\$(MODULESDIR)/$sane_subsystem/$_.\$(SHLIBEXT)\n";
+ $self->output("\t\@rm -f \$(DESTDIR)\$(modulesdir)/$sane_subsystem/$_.\$(SHLIBEXT)\n");
+ $self->output("\t\@ln -fs $ctx->{LIBRARY_REALNAME} \$(DESTDIR)\$(modulesdir)/$sane_subsystem/$_.\$(SHLIBEXT)\n");
+ }
+ }
+
+ $self->output("uninstallplugins::\n");
+ $self->output("\t\@echo Uninstalling \$(DESTDIR)\$(modulesdir)/$sane_subsystem/$ctx->{LIBRARY_REALNAME}\n");
+ $self->output("\t\@-rm \$(DESTDIR)\$(modulesdir)/$sane_subsystem/$ctx->{LIBRARY_REALNAME}\n");
+
+ if (defined($ctx->{ALIASES})) {
+ foreach (@{$ctx->{ALIASES}}) {
+ $self->output("\t\@-rm \$(DESTDIR)\$(modulesdir)/$sane_subsystem/$_.\$(SHLIBEXT)\n");
}
}
}
- $self->output("$ctx->{TYPE}_$ctx->{NAME}_OUTPUT = $ctx->{OUTPUT}\n");
- $self->_prepare_list($ctx, "OBJ_LIST");
+ $self->output("$ctx->{NAME}_OUTPUT = $ctx->{OUTPUT}\n");
$self->_prepare_list($ctx, "FULL_OBJ_LIST");
$self->_prepare_list($ctx, "DEPEND_LIST");
$self->_prepare_list($ctx, "LINK_FLAGS");
- push(@{$self->{all_objs}}, "\$($ctx->{TYPE}_$ctx->{NAME}_FULL_OBJ_LIST)");
-
- if (defined($ctx->{INIT_FUNCTION}) and $ctx->{TYPE} ne "PYTHON") {
+ if (defined($ctx->{INIT_FUNCTION}) and $ctx->{TYPE} ne "PYTHON" and
+ $ctx->{INIT_FUNCTION_TYPE} =~ /\(\*\)/) {
my $init_fn = $ctx->{INIT_FUNCTION_TYPE};
$init_fn =~ s/\(\*\)/init_module/;
my $proto_fn = $ctx->{INIT_FUNCTION_TYPE};
@@ -370,12 +185,12 @@ __EOD__
$self->output(<< "__EOD__"
#
-$ctx->{SHAREDDIR}/$ctx->{LIBRARY_REALNAME}: \$($ctx->{TYPE}_$ctx->{NAME}_DEPEND_LIST) \$($ctx->{TYPE}_$ctx->{NAME}_FULL_OBJ_LIST) $init_obj
+$ctx->{SHAREDDIR}/$ctx->{LIBRARY_REALNAME}: \$($ctx->{NAME}_DEPEND_LIST) \$($ctx->{NAME}_FULL_OBJ_LIST) $init_obj
\@echo Linking \$\@
\@mkdir -p $ctx->{SHAREDDIR}
- \@\$(MDLD) \$(MDLD_FLAGS) -o \$\@ \$(INSTALL_LINK_FLAGS) \\
- \$($ctx->{TYPE}_$ctx->{NAME}\_FULL_OBJ_LIST) $init_obj \\
- \$($ctx->{TYPE}_$ctx->{NAME}_LINK_FLAGS)
+ \@\$(MDLD) \$(LDFLAGS) \$(MDLD_FLAGS) \$(INTERN_LDFLAGS) -o \$\@ \$(INSTALL_LINK_FLAGS) \\
+ \$($ctx->{NAME}\_FULL_OBJ_LIST) $init_obj \\
+ \$($ctx->{NAME}_LINK_FLAGS)
__EOD__
);
@@ -388,79 +203,91 @@ __EOD__
$self->output("\n");
}
-sub SharedLibrary($$)
+sub SharedLibraryPrimitives($$)
{
my ($self,$ctx) = @_;
- my $has_static_lib = 0;
-
- push (@{$self->{shared_libs}}, "$ctx->{SHAREDDIR}/$ctx->{LIBRARY_REALNAME}") if (defined($ctx->{SO_VERSION}));
- push (@{$self->{installable_shared_libs}}, "$ctx->{SHAREDDIR}/$ctx->{LIBRARY_REALNAME}") if (defined($ctx->{SO_VERSION}));
-
- $has_static_lib = 1 if grep(/STATIC_LIBRARY/, @{$ctx->{OUTPUT_TYPE}});
+ $self->output("$ctx->{NAME}_SOVERSION = $ctx->{SO_VERSION}\n") if (defined($ctx->{SO_VERSION}));
+ $self->output("$ctx->{NAME}_VERSION = $ctx->{VERSION}\n") if (defined($ctx->{VERSION}));
- if (not $has_static_lib) {
- $self->output("$ctx->{TYPE}_$ctx->{NAME}_OUTPUT = $ctx->{OUTPUT}\n");
- $self->_prepare_list($ctx, "OBJ_LIST");
+ if (not grep(/STATIC_LIBRARY/, @{$ctx->{OUTPUT_TYPE}})) {
+ $self->output("$ctx->{NAME}_OUTPUT = $ctx->{OUTPUT}\n");
$self->_prepare_list($ctx, "FULL_OBJ_LIST");
}
+}
+
+sub SharedLibrary($$)
+{
+ my ($self,$ctx) = @_;
+
+ push (@{$self->{shared_libs}}, $ctx->{RESULT_SHARED_LIBRARY}) if (defined($ctx->{SO_VERSION}));
+
$self->_prepare_list($ctx, "DEPEND_LIST");
$self->_prepare_list($ctx, "LINK_FLAGS");
-# $self->_prepare_list_ex($ctx, "LINK_FLAGS", "-Wl,--whole-archive", "-Wl,--no-whole-archive");
-
- push(@{$self->{all_objs}}, "\$($ctx->{TYPE}_$ctx->{NAME}_FULL_OBJ_LIST)");
my $soarg = "";
my $lns = "";
if ($self->{config}->{SONAMEFLAG} ne "#" and defined($ctx->{LIBRARY_SONAME})) {
$soarg = "$self->{config}->{SONAMEFLAG}$ctx->{LIBRARY_SONAME}";
if ($ctx->{LIBRARY_REALNAME} ne $ctx->{LIBRARY_SONAME}) {
- $lns .= "\n\t\@rm -f $ctx->{SHAREDDIR}/$ctx->{LIBRARY_SONAME}";
- $lns .= "\n\t\@ln -fs $ctx->{LIBRARY_REALNAME} $ctx->{SHAREDDIR}/$ctx->{LIBRARY_SONAME}";
+ $lns .= "\n\t\@test \$($ctx->{NAME}_VERSION) = \$($ctx->{NAME}_SOVERSION) || ln -fs $ctx->{LIBRARY_REALNAME} $ctx->{SHAREDDIR}/$ctx->{LIBRARY_SONAME}";
}
}
if (defined($ctx->{LIBRARY_SONAME})) {
- $lns .= "\n\t\@rm -f $ctx->{SHAREDDIR}/$ctx->{LIBRARY_DEBUGNAME}";
$lns .= "\n\t\@ln -fs $ctx->{LIBRARY_REALNAME} $ctx->{SHAREDDIR}/$ctx->{LIBRARY_DEBUGNAME}";
}
$self->output(<< "__EOD__"
#
-
-$ctx->{SHAREDDIR}/$ctx->{LIBRARY_REALNAME}: \$($ctx->{TYPE}_$ctx->{NAME}_DEPEND_LIST) \$($ctx->{TYPE}_$ctx->{NAME}_FULL_OBJ_LIST)
+$ctx->{RESULT_SHARED_LIBRARY}: \$($ctx->{NAME}_DEPEND_LIST) \$($ctx->{NAME}_FULL_OBJ_LIST)
\@echo Linking \$\@
\@mkdir -p $ctx->{SHAREDDIR}
- \@\$(SHLD) \$(SHLD_FLAGS) -o \$\@ \$(INSTALL_LINK_FLAGS) \\
- \$($ctx->{TYPE}_$ctx->{NAME}\_FULL_OBJ_LIST) \\
- \$($ctx->{TYPE}_$ctx->{NAME}_LINK_FLAGS) \\
+ \@\$(SHLD) \$(LDFLAGS) \$(SHLD_FLAGS) \$(INTERN_LDFLAGS) -o \$\@ \$(INSTALL_LINK_FLAGS) \\
+ \$($ctx->{NAME}\_FULL_OBJ_LIST) \\
+ \$($ctx->{NAME}_LINK_FLAGS) \\
$soarg$lns
__EOD__
);
$self->output("\n");
}
+sub MergedObj($$)
+{
+ my ($self, $ctx) = @_;
+
+ return unless defined($ctx->{OUTPUT});
+
+ $self->output("$ctx->{NAME}_OUTPUT = $ctx->{OUTPUT}\n");
+ $self->output(<< "__EOD__"
+#
+$ctx->{RESULT_MERGED_OBJ}: \$($ctx->{NAME}_OBJ_LIST)
+ \@echo Partially linking \$@
+ \@mkdir -p bin/mergedobj
+ \$(PARTLINK) -o \$@ \$($ctx->{NAME}_OBJ_LIST)
+
+__EOD__
+);
+}
+
sub StaticLibrary($$)
{
my ($self,$ctx) = @_;
return unless (defined($ctx->{OBJ_FILES}));
- push (@{$self->{static_libs}}, $ctx->{TARGET_STATIC_LIBRARY}) if ($ctx->{TYPE} eq "LIBRARY");
+ push (@{$self->{static_libs}}, $ctx->{RESULT_STATIC_LIBRARY}) if ($ctx->{TYPE} eq "LIBRARY");
- $self->output("$ctx->{TYPE}_$ctx->{NAME}_OUTPUT = $ctx->{OUTPUT}\n");
- $self->_prepare_list($ctx, "OBJ_LIST");
+ $self->output("$ctx->{NAME}_OUTPUT = $ctx->{OUTPUT}\n");
$self->_prepare_list($ctx, "FULL_OBJ_LIST");
- push(@{$self->{all_objs}}, "\$($ctx->{TYPE}_$ctx->{NAME}_FULL_OBJ_LIST)");
-
$self->output(<< "__EOD__"
#
-$ctx->{TARGET_STATIC_LIBRARY}: \$($ctx->{TYPE}_$ctx->{NAME}_FULL_OBJ_LIST)
+$ctx->{RESULT_STATIC_LIBRARY}: \$($ctx->{NAME}_FULL_OBJ_LIST)
\@echo Linking \$@
\@rm -f \$@
\@mkdir -p $ctx->{STATICDIR}
- \@\$(STLD) \$(STLD_FLAGS) \$@ \$($ctx->{TYPE}_$ctx->{NAME}_FULL_OBJ_LIST)
+ \@\$(STLD) \$(STLD_FLAGS) \$@ \$($ctx->{NAME}_FULL_OBJ_LIST)
__EOD__
);
@@ -479,51 +306,37 @@ sub Binary($$)
{
my ($self,$ctx) = @_;
- my $installdir;
my $extradir = "";
- if (defined($ctx->{INSTALLDIR}) && $ctx->{INSTALLDIR} =~ /^TORTUREDIR/) {
- $extradir = "/torture" . substr($ctx->{INSTALLDIR}, length("TORTUREDIR"));
- }
- my $localdir = "bin$extradir";
-
- $installdir = "bin$extradir";
-
- push(@{$self->{all_objs}}, "\$($ctx->{TYPE}_$ctx->{NAME}_FULL_OBJ_LIST)");
-
unless (defined($ctx->{INSTALLDIR})) {
} elsif ($ctx->{INSTALLDIR} eq "SBINDIR") {
- push (@{$self->{sbin_progs}}, "$installdir/$ctx->{BINARY}");
+ push (@{$self->{sbin_progs}}, $ctx->{RESULT_BINARY});
} elsif ($ctx->{INSTALLDIR} eq "BINDIR") {
- push (@{$self->{bin_progs}}, "$installdir/$ctx->{BINARY}");
- } elsif ($ctx->{INSTALLDIR} =~ /^TORTUREDIR/) {
- push (@{$self->{torture_progs}}, "$installdir/$ctx->{BINARY}");
+ push (@{$self->{bin_progs}}, $ctx->{RESULT_BINARY});
}
+ $self->output("binaries:: $ctx->{TARGET_BINARY}\n");
- push (@{$self->{binaries}}, "$localdir/$ctx->{BINARY}");
-
- $self->_prepare_list($ctx, "OBJ_LIST");
$self->_prepare_list($ctx, "FULL_OBJ_LIST");
$self->_prepare_list($ctx, "DEPEND_LIST");
$self->_prepare_list($ctx, "LINK_FLAGS");
$self->output(<< "__EOD__"
-$installdir/$ctx->{BINARY}: \$($ctx->{TYPE}_$ctx->{NAME}_DEPEND_LIST) \$($ctx->{TYPE}_$ctx->{NAME}_FULL_OBJ_LIST)
+$ctx->{RESULT_BINARY}: \$($ctx->{NAME}_DEPEND_LIST) \$($ctx->{NAME}_FULL_OBJ_LIST)
\@echo Linking \$\@
__EOD__
);
if (defined($ctx->{USE_HOSTCC}) && $ctx->{USE_HOSTCC} eq "YES") {
$self->output(<< "__EOD__"
- \@\$(HOSTLD) \$(HOSTLD_FLAGS) -o \$\@ \$(INSTALL_LINK_FLAGS) \\
- \$\($ctx->{TYPE}_$ctx->{NAME}_LINK_FLAGS)
+ \@\$(HOSTLD) \$(HOSTLD_FLAGS) -L\${builddir}/bin/static -o \$\@ \$(INSTALL_LINK_FLAGS) \\
+ \$\($ctx->{NAME}_LINK_FLAGS)
__EOD__
);
} else {
$self->output(<< "__EOD__"
- \@\$(BNLD) \$(BNLD_FLAGS) -o \$\@ \$(INSTALL_LINK_FLAGS) \\
- \$\($ctx->{TYPE}_$ctx->{NAME}_LINK_FLAGS)
+ \@\$(BNLD) \$(BNLD_FLAGS) \$(INTERN_LDFLAGS) -o \$\@ \$(INSTALL_LINK_FLAGS) \\
+ \$\($ctx->{NAME}_LINK_FLAGS)
__EOD__
);
@@ -586,35 +399,28 @@ sub ProtoHeader($$)
$pub = output::add_dir_str($ctx->{BASEDIR}, $ctx->{PUBLIC_PROTO_HEADER});
}
- $self->output("$pub: $ctx->{MK_FILE} \$($ctx->{TYPE}_$ctx->{NAME}_OBJ_LIST:.o=.c) \$(srcdir)/script/mkproto.pl\n");
+ $self->output("$pub: $ctx->{MK_FILE} \$($ctx->{NAME}_OBJ_LIST:.o=.c) \$(srcdir)/script/mkproto.pl\n");
$self->output("\t\@echo \"$comment\"\n");
- $self->output("\t\@\$(PERL) \$(srcdir)/script/mkproto.pl --srcdir=\$(srcdir) --builddir=\$(builddir) --private=$priv --public=$pub \$($ctx->{TYPE}_$ctx->{NAME}_OBJ_LIST)\n\n");
+ $self->output("\t\@\$(PERL) \$(srcdir)/script/mkproto.pl --srcdir=\$(srcdir) --builddir=\$(builddir) --private=$priv --public=$pub \$($ctx->{NAME}_OBJ_LIST)\n\n");
}
sub write($$)
{
- my ($self,$file) = @_;
+ my ($self, $file) = @_;
- $self->output("MANPAGES = ".array2oneperline($self->{manpages})."\n");
+ $self->output("MANPAGES = " . array2oneperline($self->{manpages})."\n");
$self->output("BIN_PROGS = " . array2oneperline($self->{bin_progs}) . "\n");
$self->output("SBIN_PROGS = " . array2oneperline($self->{sbin_progs}) . "\n");
- $self->output("TORTURE_PROGS = " . array2oneperline($self->{torture_progs}) . "\n");
- $self->output("BINARIES = " . array2oneperline($self->{binaries}) . "\n");
$self->output("STATIC_LIBS = " . array2oneperline($self->{static_libs}) . "\n");
$self->output("SHARED_LIBS = " . array2oneperline($self->{shared_libs}) . "\n");
$self->output("PYTHON_DSOS = " . array2oneperline($self->{python_dsos}) . "\n");
$self->output("PYTHON_PYS = " . array2oneperline($self->{python_pys}) . "\n");
- $self->output("INSTALLABLE_SHARED_LIBS = " . array2oneperline($self->{installable_shared_libs}) . "\n");
$self->output("PUBLIC_HEADERS = " . array2oneperline($self->{headers}) . "\n");
$self->output("PC_FILES = " . array2oneperline($self->{pc_files}) . "\n");
$self->output("ALL_OBJS = " . array2oneperline($self->{all_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: \$(PLUGINS)\n".$self->{install_plugins}."\n");
- $self->output("\nuninstallplugins:\n".$self->{uninstall_plugins}."\n");
-
$self->_prepare_mk_files();
$self->output($self->{mkfile});
diff --git a/source4/build/smb_build/output.pm b/source4/build/smb_build/output.pm
index fbf14f7e91..ff9afe8e8c 100644
--- a/source4/build/smb_build/output.pm
+++ b/source4/build/smb_build/output.pm
@@ -81,12 +81,30 @@ sub generate_shared_library($)
$lib->{LIBRARY_DEBUGNAME} = $lib->{LIBRARY_REALNAME};
if (defined($lib->{VERSION}) and $config::config{SONAMEFLAG} ne "#") {
- $lib->{LIBRARY_SONAME} = "$lib->{LIBRARY_REALNAME}.$lib->{SO_VERSION}";
- $lib->{LIBRARY_REALNAME} = "$lib->{LIBRARY_REALNAME}.$lib->{VERSION}";
+ $lib->{LIBRARY_SONAME} = "$lib->{LIBRARY_REALNAME}.\$($lib->{NAME}_SOVERSION)";
+ $lib->{LIBRARY_REALNAME} = "$lib->{LIBRARY_REALNAME}.\$($lib->{NAME}_VERSION)";
}
- $lib->{TARGET_SHARED_LIBRARY} = "$lib->{SHAREDDIR}/$lib->{LIBRARY_REALNAME}";
- $lib->{OUTPUT_SHARED_LIBRARY} = $lib->{TARGET_SHARED_LIBRARY};
+ $lib->{RESULT_SHARED_LIBRARY} = "$lib->{SHAREDDIR}/$lib->{LIBRARY_REALNAME}";
+ $lib->{OUTPUT_SHARED_LIBRARY} = "-l$link_name";
+ $lib->{TARGET_SHARED_LIBRARY} = $lib->{RESULT_SHARED_LIBRARY};
+}
+
+sub generate_merged_obj($)
+{
+ my $lib = shift;
+
+ my $link_name = $lib->{NAME};
+ $link_name =~ s/^LIB//;
+
+ if (defined($lib->{OBJ_FILES})) {
+ $lib->{MERGED_OBJNAME} = lc($link_name).".o";
+ $lib->{RESULT_MERGED_OBJ} = $lib->{OUTPUT_MERGED_OBJ} = "bin/mergedobj/$lib->{MERGED_OBJNAME}";
+ $lib->{TARGET_MERGED_OBJ} = $lib->{RESULT_MERGED_OBJ};
+ } else {
+ $lib->{TARGET_MERGED_OBJ} = "";
+ $lib->{RESULT_MERGED_OBJ} = "";
+ }
}
sub generate_static_library($)
@@ -102,12 +120,15 @@ sub generate_static_library($)
$lib->{LIBRARY_NAME} = "lib".lc($link_name).".a";
if (defined($lib->{OBJ_FILES})) {
- $lib->{TARGET_STATIC_LIBRARY} = "bin/static/$lib->{LIBRARY_NAME}";
+ $lib->{RESULT_STATIC_LIBRARY} = "bin/static/$lib->{LIBRARY_NAME}";
+ $lib->{TARGET_STATIC_LIBRARY} = $lib->{RESULT_STATIC_LIBRARY};
$lib->{STATICDIR} = 'bin/static';
+ $lib->{OUTPUT_STATIC_LIBRARY} = "-l".lc($link_name);
} else {
+ $lib->{RESULT_STATIC_LIBRARY} = "";
$lib->{TARGET_STATIC_LIBRARY} = "";
+ $lib->{OUTPUT_STATIC_LIBRARY} = "";
}
- $lib->{OUTPUT_STATIC_LIBRARY} = $lib->{TARGET_STATIC_LIBRARY};
}
sub generate_binary($)
@@ -115,10 +136,11 @@ sub generate_binary($)
my $bin = shift;
$bin->{DEPEND_LIST} = [];
- push(@{$bin->{LINK_FLAGS}}, "\$($bin->{TYPE}_$bin->{NAME}\_OBJ_LIST)");
+ push(@{$bin->{LINK_FLAGS}}, "\$($bin->{NAME}\_FULL_OBJ_LIST)");
- $bin->{DEBUGDIR} = "bin/";
- $bin->{TARGET_BINARY} = $bin->{OUTPUT_BINARY} = "$bin->{DEBUGDIR}/$bin->{NAME}";
+ $bin->{DEBUGDIR} = "bin";
+ $bin->{RESULT_BINARY} = $bin->{OUTPUT_BINARY} = "$bin->{DEBUGDIR}/$bin->{NAME}";
+ $bin->{TARGET_BINARY} = $bin->{RESULT_BINARY};
$bin->{BINARY} = $bin->{NAME};
}
@@ -152,6 +174,7 @@ sub create_output($$)
generate_binary($part) if grep(/BINARY/, @{$part->{OUTPUT_TYPE}});
generate_shared_library($part) if grep(/SHARED_LIBRARY/, @{$part->{OUTPUT_TYPE}});
generate_static_library($part) if grep(/STATIC_LIBRARY/, @{$part->{OUTPUT_TYPE}});
+ generate_merged_obj($part) if grep(/MERGED_OBJ/, @{$part->{OUTPUT_TYPE}});
$part->{OUTPUT} = $part->{"OUTPUT_" . @{$part->{OUTPUT_TYPE}}[0]};
$part->{TARGET} = $part->{"TARGET_" . @{$part->{OUTPUT_TYPE}}[0]};
}
@@ -162,7 +185,7 @@ sub create_output($$)
merge_array(\$part->{FINAL_CFLAGS}, $part->{CPPFLAGS});
merge_array(\$part->{FINAL_CFLAGS}, $part->{CFLAGS});
- foreach (@{$part->{UNIQUE_DEPENDENCIES_COMPILE}}) {
+ foreach (@{$part->{UNIQUE_DEPENDENCIES_ALL}}) {
my $elem = $depend->{$_};
next if $elem == $part;
@@ -175,15 +198,19 @@ sub create_output($$)
my $elem = $depend->{$_};
next if $elem == $part;
- push(@{$part->{LINK_FLAGS}}, $elem->{OUTPUT}) if defined($elem->{OUTPUT});
push(@{$part->{LINK_FLAGS}}, @{$elem->{LIBS}}) if defined($elem->{LIBS});
- push(@{$part->{LINK_FLAGS}},@{$elem->{LDFLAGS}}) if defined($elem->{LDFLAGS});
- push(@{$part->{DEPEND_LIST}}, $elem->{TARGET}) if defined($elem->{TARGET});
+ push(@{$part->{LINK_FLAGS}}, @{$elem->{LDFLAGS}}) if defined($elem->{LDFLAGS});
+ if (defined($elem->{OUTPUT_TYPE}) and @{$elem->{OUTPUT_TYPE}}[0] eq "MERGED_OBJ") {
+ push (@{$part->{FULL_OBJ_LIST}}, $elem->{TARGET});
+ } else {
+ push(@{$part->{LINK_FLAGS}}, "\$($elem->{NAME}_OUTPUT)") if defined($elem->{OUTPUT});
+ push(@{$part->{DEPEND_LIST}}, $elem->{TARGET}) if defined($elem->{TARGET});
+ }
}
}
foreach $part (values %{$depend}) {
- if (($part->{STANDARD_VISIBILITY} ne "default") and
+ if (defined($part->{STANDARD_VISIBILITY}) and ($part->{STANDARD_VISIBILITY} ne "default") and
($config->{visibility_attribute} eq "yes")) {
push(@{$part->{FINAL_CFLAGS}}, "-fvisibility=$part->{STANDARD_VISIBILITY}");
}
diff --git a/source4/build/smb_build/summary.pm b/source4/build/smb_build/summary.pm
index 52817f3597..a6557fb1fe 100644
--- a/source4/build/smb_build/summary.pm
+++ b/source4/build/smb_build/summary.pm
@@ -5,6 +5,7 @@
# Released under the GNU GPL
package summary;
+use smb_build::config;
use strict;
sub enabled($)
@@ -21,9 +22,7 @@ sub showitem($$$)
my @need = ();
foreach (@$items) {
- if (!enabled($output->{$_}->{ENABLE})) {
- push (@need, $_);
- }
+ push (@need, $_) if (enabled($config::enable{$_}));
}
print "Support for $desc: ";
@@ -54,6 +53,9 @@ sub show($$)
showitem($output, "using libblkid", ["BLKID"]);
showitem($output, "using iconv", ["ICONV"]);
showitem($output, "using pam", ["PAM"]);
+ if (enabled($config->{developer})) {
+ showitem($output, "using VDE", ["VDEPLUG"]);
+ }
showitem($output, "python bindings", ["LIBPYTHON"]);
showisexternal($output, "popt", "LIBPOPT");
showisexternal($output, "talloc", "LIBTALLOC");