Hi,

Currently, the following code can be found in $TOPDIR/Makefile:

        @echo 'HOSTCC:=${CC}' >>lbin/prereq.mk

and 

        @cc='${CC}'; if test x"$$cc" = x"gcc"; then \
                ln -s $$(lbin/which "$$cc") lbin/gcc; \
        else \
                ( echo "#!$$(lbin/which bash)"; \
                  echo "export PATH=$$PATH"; \
                  echo "exec $$cc" '"$$@"' ) >lbin/gcc; \
                chmod 555 lbin/gcc; \
        fi

This either symlinks gcc to lbin/gcc (lbin/ is first in the PATH when
building, keep this in mind) or creates a script lbin/gcc which executes
the real compiler.

There are some problems with this implementation. Please correct me if
i'm wrong with some assumption.

Case a) CC=gcc. The gcc binary (e.g. /usr/bin/gcc) is symlinked to
lbin/gcc and later on used. Works as expected, but i don't see why we
need the symlink.

Case b) CC=someothercompiler. lbin/gcc is a script which executes
"someothercompiler". But because HOSTCC is also set to be
"someothercompiler", lbin/gcc is never called, thus unneeded. But it
doesn't break and works as expected.
As a small variation of this, if CC is not set at all, "cc" is used on
my machine as HOSTCC (and also in lbin/gcc: exec cc "$@"). Again,
lbin/gcc is never called at all.

Case c) CC="something gcc". We prefix gcc with some other programm, e.g.
ccache. lbin/gcc is a script which executes "something gcc" (where gcc
is the real compiler, because of the PATH definition). HOSTCC is also
set to "something gcc", but this time gcc is lbin/gcc. So this expands
to "something something gcc" beeing called as the compiler in the end.

So, let's recapitulate: either lbin/gcc is a symlink, not used at all or
producing problems. I just kicked this whole lbin/gcc stuff on my box,
and everyting works as expected.

Please object.

Bye
Lothar

_______________________________________________
freewrt-developers mailing list
[email protected]
https://www.freewrt.org/lists/listinfo/freewrt-developers

Reply via email to