Setting up a build tree for a new architecture

J. Johnston jjohnstn@redhat.com
Tue Jul 9 14:31:00 GMT 2002


Doug Evans wrote:
> 
> J. Johnston writes:
>  > "H. Peter Anvin" wrote:
>  > > [...]
>  > > I have added my new platform, i386-pc-com32, to config.sub, and since
>  > > newlib seems to insist on calling i386-pc-com32-<toolname> for all the
>  > > tools (gcc, ld, ar, ...) I set up symlinks for them.
>  > > [...]
>  >
>  > [...]
>  > Note you can override the tools used when you issue the make command.  There are a
>  > number of them, all ending in _FOR_TARGET:
>  >
>  >   CC_FOR_TARGET, AS_FOR_TARGET, LD_FOR_TARGET, RANLIB_FOR_TARGET, AR_FOR_TARGET, NM_FOR_TARGET
>  >
>  > e.g. make all-target-newlib CC_FOR_TARGET=i386-elf-gcc AS_FOR_TARGET=i386-elf-as ...
> 
> I wonder if newlib should obey --program-prefix, etc.
> [if it doesn't already].
> 
> Maybe what one wants is --build-program-prefix.  Ugh.

All of the calculations for the FOR_TARGET tools are done in the top-level Makefile
and the --program-prefix is honored by the top-level configure.  It should work
in the case of newlib on its own, but it is really meant to specify the install names.
It so happens that in the absence of any cross-tools, the Makefile will use the
prefix to determine default tool names to use.  As you have alluded, a --build-program-prefix
option is really what is wanted.  IMHO, such a change isn't probably needed enough to
justify the work.

The --program-prefix option gets rolled into the --program-transformation sed string which is used to calculate cross-tool names in the absence of
said cross-tools in the build tree.  It is stored in the variable: program_transform_name which can be overridden on the make command.  Note that
the variable is not used to calculate CC_FOR_TARGET so CC_FOR_TARGET must still be overridden.  

For example,

  make all-target-newlib CC_FOR_TARGET=prefixiwant-gcc program_transform_name='-e s,^,prefixiwant-'

This won't work in a build tree that has built xgcc or other cross-tools.  In such a case,
the tools would have to be specified manually on the make command as previously mentioned.

-- Jeff J.



More information about the Newlib mailing list