[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] Add -nostdinc to TARGET_CFLAGS
From: |
Felix Zielcke |
Subject: |
Re: [PATCH] Add -nostdinc to TARGET_CFLAGS |
Date: |
Sun, 15 Nov 2009 12:17:50 +0100 |
Am Sonntag, den 15.11.2009, 12:04 +0100 schrieb Robert Millan:
> On Sat, Nov 14, 2009 at 10:16:45PM +0100, Felix Zielcke wrote:
> > Am Mittwoch, den 04.11.2009, 11:48 +0100 schrieb Felix Zielcke:
> > >
> > > Thanks to the hint from rubisher I looked now at Linux Makefiles.
> > > They use this:
> > >
> > > NOSTDINC_FLAGS += -nostdinc -isystem $(shell $(CC)
> > > -print-file-name=include)
> > >
> > > # ls $(gcc-4.4 -print-file-name=include)/stdarg.h
> > > /usr/lib/gcc/x86_64-linux-gnu/4.4.2/include/stdarg.h
> > >
> >
> > Robert?
> > IMO this makes at least more sense then what we have now
> > and I just tested this now with and without a seperate build directory
> > with experimental branch and it works
> > TARGET_CPPFLAGS = @TARGET_CPPFLAGS@ -nostdinc -isystem $(shell $(CC)
> > -print-file-name=include) -I$(srcdir)/include -I$(builddir)
> > -I$(builddir)/include -Wall -W
>
> What's the advantage?
>
The advantage is that this does exatly what we want for the target.
Remove /usr/include from the include search directories but still keep
the gcc internal one for e.g. stdarg.h
As far as I understand the gcc manual, isystem adds this directory to
the search path and treats all headers there in as system headers.
And with the = between -isystem and $(srcdir) it actually uses
${sysroot}{$srcdir} but we don't use any --sysroot or -isysroot.
The arguments we currently have there just look wrong with my understand
of the gcc manual
$ cat test.c
#include <stdarg.h>
#include <stdint.h>
int main (void)
{
return 0;
}
$ srcdir=$PWD builddir=$PWD gcc -isystem=$srcdir/include -I$srcdir/include
-I$builddir -I$builddir/include test.c -o test && ls test
test
$ srcdir=$PWD builddir=$PWD gcc -nostdinc -isystem $(gcc
-print-file-name=include) -I$srcdir/include -I$builddir -I$builddir/include
test.c
test.c:2:20: error: stdint.h: No such file or directory
--
Felix Zielcke
Proud Debian Maintainer and GNU GRUB developer
- Re: [PATCH] Add -nostdinc to TARGET_CFLAGS, Felix Zielcke, 2009/11/04
- Re: [PATCH] Add -nostdinc to TARGET_CFLAGS, Felix Zielcke, 2009/11/14
- Re: [PATCH] Add -nostdinc to TARGET_CFLAGS, Robert Millan, 2009/11/15
- Re: [PATCH] Add -nostdinc to TARGET_CFLAGS,
Felix Zielcke <=
- Re: [PATCH] Add -nostdinc to TARGET_CFLAGS, Robert Millan, 2009/11/15
- Re: [PATCH] Add -nostdinc to TARGET_CFLAGS, Felix Zielcke, 2009/11/15
- Re: [PATCH] Add -nostdinc to TARGET_CFLAGS, Robert Millan, 2009/11/15
- Re: [PATCH] Add -nostdinc to TARGET_CFLAGS, Felix Zielcke, 2009/11/15