summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJelmer Vernooij <jelmer@samba.org>2008-02-29 15:21:33 +0100
committerJelmer Vernooij <jelmer@samba.org>2008-02-29 15:21:33 +0100
commit9be199944d29d8f3c8e25ad96c02c824d2853b54 (patch)
treeb8900763a2a93e1da1cb93b6f0b1fb7fedf5b186
parentc8011b5d09390318ea6aa5639a142797128e5dab (diff)
parent07f6f9b2115b3df03ac11a0db9bf1c4ff5d513cc (diff)
downloadsamba-9be199944d29d8f3c8e25ad96c02c824d2853b54.tar.gz
samba-9be199944d29d8f3c8e25ad96c02c824d2853b54.tar.bz2
samba-9be199944d29d8f3c8e25ad96c02c824d2853b54.zip
Merge branch 'v4-0-test' into v4-0-gmake3
Conflicts: source/Makefile source/build/smb_build/main.pl source/build/smb_build/makefile.pm source/dynconfig.mk source/scripting/python/config.mk (This used to be commit 744d9fd8731321abea37b0cb14ca75e1b4654722)
-rw-r--r--source4/Makefile1
-rw-r--r--source4/build/smb_build/makefile.pm76
-rw-r--r--source4/build/smb_build/output.pm7
3 files changed, 76 insertions, 8 deletions
diff --git a/source4/Makefile b/source4/Makefile
index 6083ee35b5..65f8c2de29 100644
--- a/source4/Makefile
+++ b/source4/Makefile
@@ -41,7 +41,6 @@ endif
include build/make/rules.mk
include build/make/python.mk
include data.mk
-include extra_cflags.txt
DEP_FILES = $(patsubst %.ho,%.hd,$(patsubst %.o,%.d,$(ALL_OBJS))) \
include/includes.d
diff --git a/source4/build/smb_build/makefile.pm b/source4/build/smb_build/makefile.pm
index 9aa4e409bd..b223f53bb2 100644
--- a/source4/build/smb_build/makefile.pm
+++ b/source4/build/smb_build/makefile.pm
@@ -56,6 +56,29 @@ sub _set_config($$)
}
}
+sub _set_config($$)
+{
+ my ($self, $config) = @_;
+
+ $self->{config} = $config;
+
+ if (not defined($self->{config}->{srcdir})) {
+ $self->{config}->{srcdir} = '.';
+ }
+
+ if (not defined($self->{config}->{builddir})) {
+ $self->{config}->{builddir} = '.';
+ }
+
+ if ($self->{config}->{prefix} eq "NONE") {
+ $self->{config}->{prefix} = $self->{config}->{ac_default_prefix};
+ }
+
+ if ($self->{config}->{exec_prefix} eq "NONE") {
+ $self->{config}->{exec_prefix} = $self->{config}->{prefix};
+ }
+}
+
sub output($$)
{
my ($self, $text) = @_;
@@ -354,4 +377,57 @@ sub CFlags($$)
$self->output("\$($key->{NAME}_OBJ_LIST) \$(patsubst %.ho,%.d,\$($key->{NAME}_OBJ_LIST:.o=.d)): CFLAGS+=$cflags\n");
}
+my $sort_available = eval "use sort 'stable'; return 1;";
+$sort_available = 0 unless defined($sort_available);
+
+sub by_path {
+ return 1 if($a =~ m#^\-I/#);
+ return -1 if($b =~ m#^\-I/#);
+ return 0;
+}
+
+sub CFlags($$)
+{
+ my ($self, $key) = @_;
+
+ my $srcdir = $self->{config}->{srcdir};
+ my $builddir = $self->{config}->{builddir};
+
+ my $src_ne_build = ($srcdir ne $builddir) ? 1 : 0;
+
+ return unless defined ($key->{OBJ_LIST});
+ return unless defined ($key->{FINAL_CFLAGS});
+ return unless (@{$key->{FINAL_CFLAGS}} > 0);
+
+ my @sorted_cflags = @{$key->{FINAL_CFLAGS}};
+ if ($sort_available) {
+ @sorted_cflags = sort by_path @{$key->{FINAL_CFLAGS}};
+ }
+
+ # Rewrite CFLAGS so that both the source and the build
+ # directories are in the path.
+ my @cflags = ();
+ foreach my $flag (@sorted_cflags) {
+ if($src_ne_build) {
+ if($flag =~ m#^-I([^/].*$)#) {
+ my $dir = $1;
+ $dir =~ s#^\$\((?:src|build)dir\)/?##;
+ push(@cflags, "-I$builddir/$dir", "-I$srcdir/$dir");
+ next;
+ }
+ }
+ push(@cflags, $flag);
+ }
+
+ my $cflags = join(' ', @cflags);
+
+ foreach (@{$key->{OBJ_LIST}}) {
+ my $ofile = $_;
+ my $dfile = $_;
+ $dfile =~ s/\.o$/.d/;
+ $dfile =~ s/\.ho$/.d/;
+ $self->output("$ofile $dfile: CFLAGS+= $cflags\n");
+ }
+}
+
1;
diff --git a/source4/build/smb_build/output.pm b/source4/build/smb_build/output.pm
index eec438b108..1ddd39d261 100644
--- a/source4/build/smb_build/output.pm
+++ b/source4/build/smb_build/output.pm
@@ -69,9 +69,6 @@ sub generate_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};
- } else {
- $lib->{TARGET_MERGED_OBJ} = "";
- $lib->{RESULT_MERGED_OBJ} = "";
}
}
@@ -92,10 +89,6 @@ sub generate_static_library($)
$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} = "";
}
}