summaryrefslogtreecommitdiff
path: root/source4/build
diff options
context:
space:
mode:
Diffstat (limited to 'source4/build')
-rw-r--r--source4/build/smb_build/main.pl11
-rw-r--r--source4/build/smb_build/makefile.pm20
-rw-r--r--source4/build/smb_build/output.pm61
3 files changed, 30 insertions, 62 deletions
diff --git a/source4/build/smb_build/main.pl b/source4/build/smb_build/main.pl
index c3dc46461b..0e42155537 100644
--- a/source4/build/smb_build/main.pl
+++ b/source4/build/smb_build/main.pl
@@ -52,7 +52,7 @@ 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}});
+ $mkenv->StaticLibraryPrimitives($key) if grep(/STATIC_LIBRARY/, @{$key->{OUTPUT_TYPE}});
if (defined($key->{PC_FILE})) {
$mkenv->output("PC_FILES += $key->{BASEDIR}/$key->{PC_FILE}\n");
}
@@ -66,19 +66,26 @@ foreach my $key (values %$OUTPUT) {
$key->{TYPE} eq "PYTHON") and
grep(/SHARED_LIBRARY/, @{$key->{OUTPUT_TYPE}});
$mkenv->PythonFiles($key) if defined($key->{PYTHON_FILES});
- $mkenv->ProtoHeader($key) if defined($key->{PRIVATE_PROTO_HEADER});
$mkenv->CFlags($key);
}
foreach my $key (values %$OUTPUT) {
next unless defined $key->{OUTPUT_TYPE};
+ $mkenv->Integrated($key) if grep(/INTEGRATED/, @{$key->{OUTPUT_TYPE}});
+}
+
+foreach my $key (values %$OUTPUT) {
+ next unless defined $key->{OUTPUT_TYPE};
+ $mkenv->StaticLibrary($key) if grep(/STATIC_LIBRARY/, @{$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->ProtoHeader($key) if defined($key->{PRIVATE_PROTO_HEADER});
}
$mkenv->write("data.mk");
diff --git a/source4/build/smb_build/makefile.pm b/source4/build/smb_build/makefile.pm
index 2470fa1459..7728bc4f8d 100644
--- a/source4/build/smb_build/makefile.pm
+++ b/source4/build/smb_build/makefile.pm
@@ -23,12 +23,11 @@ sub new($$$)
$self->{output} = "";
- $self->{mkfile} = $mkfile;
-
$self->output("################################################\n");
$self->output("# Autogenerated by build/smb_build/makefile.pm #\n");
$self->output("################################################\n");
$self->output("\n");
+ $self->output($mkfile);
return $self;
}
@@ -203,6 +202,14 @@ __EOD__
$self->output("\n");
}
+sub StaticLibraryPrimitives($$)
+{
+ my ($self,$ctx) = @_;
+
+ $self->output("$ctx->{NAME}_OUTPUT = $ctx->{OUTPUT}\n");
+ $self->_prepare_list($ctx, "FULL_OBJ_LIST");
+}
+
sub SharedLibraryPrimitives($$)
{
my ($self,$ctx) = @_;
@@ -273,9 +280,6 @@ sub StaticLibrary($$)
$self->output("STATIC_LIBS += $ctx->{TARGET_STATIC_LIBRARY}\n") if ($ctx->{TYPE} eq "LIBRARY");
- $self->output("$ctx->{NAME}_OUTPUT = $ctx->{OUTPUT}\n");
- $self->_prepare_list($ctx, "FULL_OBJ_LIST");
-
$self->output("$ctx->{RESULT_STATIC_LIBRARY}: \$($ctx->{NAME}_FULL_OBJ_LIST)\n");
}
@@ -324,9 +328,9 @@ sub PythonFiles($$)
foreach (@{$ctx->{PYTHON_FILES}}) {
my $target = "bin/python/".basename($_);
- my $source = output::add_dir_str($ctx->{BASEDIR}, $_);
+ my $source = "\$(addprefix $ctx->{BASEDIR}/, $target)";
$self->output("$target: $source\n\n");
- $self->output("PYTHON_PYS += $target\n");
+ $self->output("PYTHON_PYS += $source\n");
}
}
@@ -334,7 +338,7 @@ sub ProtoHeader($$)
{
my ($self,$ctx) = @_;
- my $priv = output::add_dir_str($ctx->{BASEDIR}, $ctx->{PRIVATE_PROTO_HEADER});
+ my $priv = "\$(addprefix $ctx->{BASEDIR}/, $ctx->{PRIVATE_PROTO_HEADER})";
$self->output("PROTO_HEADERS += $priv\n");
$self->output("$priv: $ctx->{MK_FILE} \$($ctx->{NAME}_OBJ_LIST:.o=.c) \$(srcdir)/script/mkproto.pl\n");
diff --git a/source4/build/smb_build/output.pm b/source4/build/smb_build/output.pm
index 4ae4a62cf4..aeff7d48ce 100644
--- a/source4/build/smb_build/output.pm
+++ b/source4/build/smb_build/output.pm
@@ -7,39 +7,6 @@
package output;
use strict;
-use smb_build::config;
-
-sub add_dir_str($$)
-{
- my ($dir,$file) = @_;
- my $dirsep = "/";
-
- $dir =~ s/^\.$//g;
- $dir =~ s/^\.\///g;
-
- $dirsep = "" if ($dir eq "");
-
- my $ret = $file;
- if (substr($ret, 0, 1) ne "\$") {
- $ret = "$dir$dirsep$file";
- $ret =~ s/([^\/\.]+)\/\.\.\///g;
- $ret =~ s/([^\/\.]+)\/\.\.\///g;
- }
-
- return $ret;
-}
-
-sub add_dir_array($$)
-{
- my ($dir,$files) = @_;
- my @ret = ();
-
- foreach (@{$files}) {
- push (@ret, add_dir_str($dir, $_));
- }
-
- return @ret;
-}
sub generate_shared_library($)
{
@@ -80,10 +47,8 @@ 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->{NAME}_SOVERSION)";
- $lib->{LIBRARY_REALNAME} = "$lib->{LIBRARY_REALNAME}.\$($lib->{NAME}_VERSION)";
- }
+ $lib->{LIBRARY_SONAME} = "\$(if \$($lib->{NAME}_SOVERSION),$lib->{LIBRARY_REALNAME}.\$($lib->{NAME}_SOVERSION),$lib->{LIBRARY_REALNAME})";
+ $lib->{LIBRARY_REALNAME} = "\$(if \$($lib->{NAME}_VERSION),$lib->{LIBRARY_REALNAME}.\$($lib->{NAME}_VERSION),$lib->{LIBRARY_REALNAME})";
$lib->{RESULT_SHARED_LIBRARY} = "$lib->{SHAREDDIR}/$lib->{LIBRARY_REALNAME}";
$lib->{OUTPUT_SHARED_LIBRARY} = "-l$link_name";
@@ -97,11 +62,9 @@ sub generate_merged_obj($)
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};
- }
+ $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};
}
sub generate_static_library($)
@@ -116,12 +79,10 @@ sub generate_static_library($)
$lib->{LIBRARY_NAME} = "lib".lc($link_name).".a";
- if (defined($lib->{OBJ_FILES})) {
- $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);
- }
+ $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);
}
sub generate_binary($)
@@ -160,10 +121,6 @@ sub create_output($$)
foreach $part (values %{$depend}) {
next unless(defined($part->{OUTPUT_TYPE}));
- # Combine object lists
- my @list = add_dir_array($part->{BASEDIR}, $part->{OBJ_FILES});
- push(@{$part->{OBJ_LIST}}, @list) if defined($part->{OBJ_FILES});
-
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}});