Merge branch 'v4-0-test' into v4-0-gmake3
authorJelmer Vernooij <jelmer@samba.org>
Fri, 29 Feb 2008 14:21:33 +0000 (15:21 +0100)
committerJelmer Vernooij <jelmer@samba.org>
Fri, 29 Feb 2008 14:21:33 +0000 (15:21 +0100)
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)

1  2 
source4/Makefile
source4/build/smb_build/makefile.pm
source4/build/smb_build/output.pm

index 6083ee35b5f8ed415ac557a211a31b3f1f6ca736,f9a753eb6706f5f1be8baf8803cd14655b754879..65f8c2de29e35358b51d451b8bfa9143ec5f2020
@@@ -19,52 -19,11 +19,51 @@@ BNLD_FLAGS = $(LDFLAGS) $(SYS_LDFLAGS
  HOSTCC_FLAGS = -D_SAMBA_HOSTCC_ $(CFLAGS)
  HOSTLD_FLAGS = $(LDFLAGS) $(SYS_LDFLAGS)
  
 -default: all
 +$(srcdir)/version.h: $(srcdir)/VERSION
 +      @$(SHELL) script/mkversion.sh VERSION $(srcdir)/version.h $(srcdir)/
  
 -include rules.mk
 +regen_version::
 +      @$(SHELL) script/mkversion.sh VERSION $(srcdir)/version.h $(srcdir)/
 +
 +clean_pch::
 +      @echo "Removing precompiled headers"
 +      @-rm -f include/includes.h.gch
 +
 +pch:: clean_pch include/includes.h.gch
 +
 +.DEFAULT_GOAL := all
 +
 +ifneq ($(automatic_deps),yes)
 +ALL_PREDEP = proto
 +.NOTPARALLEL:
 +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
 +
 +ifeq ($(automatic_deps),yes)
 +ifneq ($(MAKECMDGOALS),clean)
 +ifneq ($(MAKECMDGOALS),distclean)
 +ifneq ($(MAKECMDGOALS),realdistclean)
 +ifneq ($(SKIP_DEP_FILES),yes)
 +-include $(DEP_FILES)
 +endif
 +endif
 +endif
 +endif
 +
 +ifneq ($(SKIP_DEP_FILES),yes)
 +clean::
 +      @echo Removing dependency files
 +      @find . -name '*.d' -o -name '*.hd' | xargs rm -f
 +endif
 +else
 +include $(srcdir)/static_deps.mk
 +endif
  
  DEFAULT_HEADERS = $(srcdir)/lib/util/dlinklist.h \
                  $(srcdir)/version.h
index 9aa4e409bd6fcdfe0d6b4fc8060998267de02f57,902e8f7f424e0589951510d8ee884f429aaec7a9..b223f53bb2c8c76712af8b3e3db960b13c5cbe57
@@@ -30,32 -30,37 +30,55 @@@ sub new($$$
        $self->output("################################################\n");
        $self->output("\n");
  
 -      if (!$self->{automatic_deps}) {
 -              $self->output("ALL_PREDEP = proto\n");
 -              $self->output(".NOTPARALLEL:\n");
 +      return $self;
 +}
 +
 +sub _set_config($$)
 +{
 +      my ($self, $config) = @_;
 +
 +      $self->{config} = $config;
 +
 +      if (not defined($self->{config}->{srcdir})) {
 +              $self->{config}->{srcdir} = '.';
        }
  
 -      return $self;
 +      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 _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) = @_;
@@@ -316,42 -408,47 +339,95 @@@ sub by_path 
  }
  
  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);
 +
 +      my $ext = "o";
 +      $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;
Simple merge