Hello,

the GNU GCC and Binutils packages have the following feature: when
compiled for cross compilation, e.g., for
        TARGET=arm-none-eabi
they are compiled with the names $TARGET-gcc, $TARGET-nm, etc.  Various
programs such as the compiler driver, the linker etc. automatically
change their search paths, such as the standard include or library
directories, which basically change from $PREFIX/lib to
$PREFIX/$TARGET/lib etc.

In general, make is oblivious to these changes, and has predefined
macros, such as CC, etc. to allow a single Makefile to be used for
several environments, both hosted and cross-compilation.

However, the Info node (make.info)Libraries/Search documents the
"Directory Search for Link Libraries" feature.  This feature does not
extend to cross compilation environments: make does not take a possible
cross-compilation environment into account.  That is, the compiled-in
path /lib, /usr/lib, and PREFIX/lib is not changed to e.g.,
PREFIX/TARGET/lib.  Makefiles that use the feature will require rework
for cross-compilation environments, which is a shame.

It does not seem difficult to extend the current feature to work in
cross-compilation environments.  E.g., the name of the executable could
be examined to determine if it was invoked with a base name of XXX-make
and to use XXX as the prefix.  At the same time, the location of the
executable would need to be determined to instantiate PREFIX.

By referring to the same executable by different names (multiple hard
links to the file), different cross compilation environments could be
supported by one executable.

A related change would be to instantiate the predefined macros such as
CC from gcc to $TARGET-gcc in those cases where CC is initialized to
gcc.

Regards,

Konrad Schwarz
BEGIN:VCARD
VERSION:2.1
N:Schwarz;Konrad
FN:Konrad Schwarz
ORG:Siemens AG;CT SE 2
TITLE:Principal Engineer
TEL;WORK;VOICE:+49 (89) 636-53579
TEL;WORK;FAX:+49 (89) 636-45450
ADR;WORK;ENCODING=QUOTED-PRINTABLE:;53 518;Siemens AG=0D=0ACT SE 2;M=FCnchen;;81730;Germany
LABEL;WORK;ENCODING=QUOTED-PRINTABLE:53 518=0D=0ASiemens AG=0D=0ACT SE 2=0D=0AM=FCnchen 81730=0D=0AGermany
ADR;POSTAL;ENCODING=QUOTED-PRINTABLE:;;Siemens AG=0D=0ACT SE 2;M=FCnchen;;81730;Germany
LABEL;POSTAL;ENCODING=QUOTED-PRINTABLE:Siemens AG=0D=0ACT SE 2=0D=0AM=FCnchen 81730=0D=0AGermany
EMAIL;PREF;INTERNET:[EMAIL PROTECTED]
REV:20060130T101011Z
END:VCARD
_______________________________________________
Bug-make mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/bug-make

Reply via email to