Several puzzles about gcc top level makefile

2008-11-27 Thread Cheng bin
Hi Groups:
Right now I am studying the procedure of building gcc(mipsel cross
compiler), so I look into the makefiles generated by configure
procedure.
This message is about the top level makefile, I got most of it (It's
some kind of well structured) except several puzzles as following

1  : At the end of that makefile , There is a section noted as
"Regenerating top level configury".
  It is clear what it do, but for what? Where is this piece of
code used in building procedure?
2  : At lines around 462, There is a variable named "RECURSE_FLAGS", I
also puzzled
  about its usage. It says that "When doing recursive invocations
of the top-level Makefile,
  we don't want the outer make to evaluate them, so we pass these
variables down
  unchanged. " Does it mean we will recall the top level makefile?
  if so, Is "RECURSE_FLAGS" have any relations with the first
question. Maybe both
  "Regenerating top level configury" and "RECURSE_FLAGS" is used
to  compile gcc
  several times in bootstrap.
  Here I need a confirmation.
3  : For the cross compiler, I configured and compiled gcc twice, once
with just language C
  supported, once with languages C/C++ supported. I compared the
two top level makefile
  generated by configure and found the difference is that
libiberty and libstdc++-v3 is
  compiled for target at the second time. So here is the question:
libstdc++v3 is compiled
  for target as the c++ runtime library, but what libiberty for? I
can only infer that libstdc++v3
  needs it(otherwise why the first time which only supports c
language do not have it
  compiled?). Unfortunately, I did not find any code in
libstdc++-v3 which calls functions
  in libiberty.

Following is the arguments I used to configure makefile two times, if it useful.
   First time (for C):

/cygdrive/e/work/buildroot/buildroot/toolchain_build_mipsel_nofpu/gcc-3.4.2/configure
--prefix=/cygdrive/e/work/buildroot/buildroot/build_mipsel_nofpu/staging_dir
--build=i386-pc-linux-gnu --host=i386-pc-linux-gnu
--target=mipsel-linux-uclibc --enable-languages=c
--with-sysroot=/cygdrive/e/work/buildroot/buildroot/toolchain_build_mipsel_nofpu/uClibc_dev/
--disable-__cxa_atexit --enable-target-optspace --with-gnu-ld
--disable-shared --disable-nls --enable-threads --enable-multilib
--with-float=soft
---
   Second time (for C&C++):

/cygdrive/e/work/buildroot/buildroot/toolchain_build_mipsel_nofpu/gcc-3.4.2/configure
--prefix=/cygdrive/e/work/buildroot/buildroot/build_mipsel_nofpu/staging_dir
--build=i386-pc-linux-gnu --host=i386-pc-linux-gnu
--target=mipsel-linux-uclibc --enable-languages=c
--disable-__cxa_atexit --enable-target-optspace --with-gnu-ld
--enable-shared --disable-nls --enable-threads --enable-multilib
--with-float=soft
---

Thanks is advance and any messages will be appreciated.

Best wishes.


Re: Several puzzles about gcc top level makefile

2008-11-29 Thread Cheng bin
Thanks very much, Ian Lance Taylor .
I will go deeper into the makefiles.


About the procedure of fixinclude in building gcc

2008-12-01 Thread Cheng bin
Hi All:
 Now I am working on the procedure of fixinclude in building gcc
and got following concepts.
Take three PATH as example to illustrate,
 ginclude: which provided by gcc source includes system
headers wanted by gcc;
 sys_inc : the location of system header files;
 local : the locattion for system headers fixed by gcc;

When building gcc, there are two steps to finish the job of fixing headers:
STEP1:fixinc.sh will fix system headers in PATH: sys_inc and put
fixed ones into
   PATH:local ;
STEP2:gcc(actually is building makefiles) will copy all files from
PATH:ginclude to
   PATH:local. In this step, it will copy anything into
PATH:local even if there
   is one as the result of STEP1.

After all, gcc will search system headers in PATH:local firstly and
then in PATH:sys_inc.

I'am not sure about my comprehension, am I right?

And there is a question about ./fixincludes/Makefile.
I think the gcc's top level Makefile will configure fixincludes and
create that Makefile,
and then will do such "make ./fixincludes/Makefile" thing, But I found
following rules in
./fixincludes/Makefile:

all : oneprocess fixinc.sh mkheaders
fixinc.sh : fixinc.in mkfixinc.sh Makefile
(commands to create fixinc.sh)
Makefile: $(srcdir)/Makefile.in config.status
$(SHELL) ./config.status Makefile

Look at the last rule with target Makefile, does it recreate exactly
this Makefile recursively?
 And why doing this?
I have to admit that I know nothing about config.status except
comments say that it is used
to recreate the current configuration.

Thanks for look at this message, and any suggestion will be greatly appreciated!


views on an old subject"--with-sysroot"

2008-12-07 Thread Cheng bin
Hi All:
  About "--with-sysroot" option, I got some understanding
following but not sure about it.
All words are based on gcc-3.4.2.
  For a native gcc, There are three important macro
LOCAL_INCLUDE_DIR, SYSTEM_INCLUDE_DIR
and STANDARD_INCLUDE_DIR. Gcc built will search headers in directories
defined by these macro.
  For a "build=host != target" cross gcc, there are two cases:
  Firstly, If configured without option "--with-sysroot", the gcc
built will search headers in directory defined
by macro CROSS_INCLUDE_DIR. Everything is ok if CROSS_INCLUDE_DIR is
right and it is makefile's
responsibility to define and pass this macro to gcc(such cppdefault.c etc.).
  Secondly, if gcc is configured with option "--with-sysroot=XXX",
it will search header files in directories
defined by macro LOCAL_INCLUDE_DIR, SYSTEM_INCLUDE_DIR and
STANDARD_INCLUDE_DIR, just
like native compiler do, but start from directory defined by macro
TARGET_SYSTEM_ROOT.
  Though both methods works for cross compiler, the second one
makes it possible to near the gap
between native and cross compiler. I think that is why gcc developers
added "with-sysroot" configure option.
Of course they went even further by providing "sysroot" command option.

  All of those are my comprehension, and I am not sure about it. I
will be very glad if anyone correct it if
I am wrong and any message will be appreciated.
Thanks.