r15052: Do not add builddir variants into include paths when building in-tree
authorAlexander Bokovoy <ab@samba.org>
Wed, 12 Apr 2006 13:02:56 +0000 (13:02 +0000)
committerGerald (Jerry) Carter <jerry@samba.org>
Wed, 10 Oct 2007 19:04:04 +0000 (14:04 -0500)
(This used to be commit 2e2a33ce3f72164a4ed16a81025dc55a55f5e465)

source4/build/smb_build/makefile.pm

index eab8674ed17fcad759c754962329aee252840342..c6ab0d7220a0156ce477b67db2f65a654447688d 100644 (file)
@@ -10,6 +10,7 @@ use smb_build::env;
 use strict;
 
 use base 'smb_build::env';
+use Cwd 'abs_path';
 
 sub new($$$)
 {
@@ -103,6 +104,7 @@ sub _prepare_compiler_linker($)
 
        my $devld_local = "";
        my $devld_install = "";
+       my $builddir_headers = "";
 
        $self->{duplicate_build} = 0;
        if ($self->{config}->{LIBRARY_OUTPUT_TYPE} eq "SHARED_LIBRARY") {
@@ -112,6 +114,10 @@ sub _prepare_compiler_linker($)
                }
                $devld_install = " -Wl,-rpath-link,\$(builddir)/bin";
        }
+       
+       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}
@@ -122,7 +128,7 @@ CPP=$self->{config}->{CPP}
 CPPFLAGS=$self->{config}->{CPPFLAGS}
 
 CC=$self->{config}->{CC}
-CFLAGS=-I\$(builddir)/include -I\$(builddir) -I\$(builddir)/lib -I\$(srcdir)/include -I\$(srcdir) -I\$(srcdir)/lib -D_SAMBA_BUILD_ -DHAVE_CONFIG_H $self->{config}->{CFLAGS} \$(CPPFLAGS)
+CFLAGS=$builddir_headers-I\$(srcdir)/include -I\$(srcdir) -I\$(srcdir)/lib -D_SAMBA_BUILD_ -DHAVE_CONFIG_H $self->{config}->{CFLAGS} \$(CPPFLAGS)
 PICFLAG=$self->{config}->{PICFLAG}
 HOSTCC=$self->{config}->{HOSTCC}