When installing GCC, libraries, header files and some executables are placed in directories similar to /usr/lib/gcc/i686-pc-linux-gnu/4.5.4/
and /usr/libexec/gcc/i686-pc-linux-gnu/4.5.4/
.
I'm building a native compiler on a custom system and would like to place executables in /bin
, header files in /include/gcc
and anything else in /lib/gcc
(no paths containing the target machine name nor the gcc version). Unfortunately this seems to be impossible considering the available options of the gcc configure script. Simply relocating all the installed files is no problem, but then the gcc executable won't be able to find those anymore. The search directories look as follows on my system (pretty ugly in my point of view, a lot of useless paths):
$ gcc -print-search-dirs
install: /usr/lib/gcc/i686-pc-linux-gnu/4.5.4/
programs: =/usr/libexec/gcc/i686-pc-linux-gnu/4.5.4/:/usr/libexec/gcc/i686-pc-linux-gnu/4.5.4/:/usr/libexec/gcc/i686-pc-linux-gnu/:/usr/lib/gcc/i686-pc-linux-gnu/4.5.4/:/usr/lib/gcc/i686-pc-linux-gnu/:/usr/lib/gcc/i686-pc-linux-gnu/4.5.4/../../../../i686-pc-linux-gnu/bin/i686-pc-linux-gnu/4.5.4/:/usr/lib/gcc/i686-pc-linux-gnu/4.5.4/../../../../i686-pc-linux-gnu/bin/
libraries: =/usr/lib/gcc/i686-pc-linux-gnu/4.5.4/:/usr/lib/gcc/i686-pc-linux-gnu/4.5.4/../../../../i686-pc-linux-gnu/lib/i686-pc-linux-gnu/4.5.4/:/usr/lib/gcc/i686-pc-linux-gnu/4.5.4/../../../../i686-pc-linux-gnu/lib/../lib/:/usr/lib/gcc/i686-pc-linux-gnu/4.5.4/../../../i686-pc-linux-gnu/4.5.4/:/usr/lib/gcc/i686-pc-linux-gnu/4.5.4/../../../../lib/:/lib/i686-pc-linux-gnu/4.5.4/:/lib/../lib/:/usr/lib/i686-pc-linux-gnu/4.5.4/:/usr/lib/../lib/:/usr/lib/gcc/i686-pc-linux-gnu/4.5.4/../../../../i686-pc-linux-gnu/lib/:/usr/lib/gcc/i686-pc-linux-gnu/4.5.4/../../../:/lib/:/usr/lib/
I've looked at the source of gcc, but to me it seems that a lot would have to be changed in order to achieve what I want; the structure of those paths are actually hardcoded. Manipulating DEFAULT_TARGET_MACHINE
or DEFAULT_TARGET_VERSION
in gcc/Makefile.in
prior to configuration would do, but that will break other things for sure.
Any help/ideas appreciated.