[RFC] external compiler support

Warner Losh imp at bsdimp.com
Wed Feb 27 21:06:42 UTC 2013


On Feb 27, 2013, at 1:28 PM, Simon J. Gerraty wrote:

> 
> On Wed, 27 Feb 2013 13:58:07 -0600, Brooks Davis writes:
>> Adding the equivalent of Warner's ${__X} (however you spell it) doesn't
>> seem to hurt anything, but it doesn't seem to help much either.  You
> 
> The advantage of Warner's approach is that it can work from anywhere in
> the tree rather than only from top-level.
> 
> One of my goals is that I should be able to [cross-]build bin/cat just
> as easily from src/bin/cat as from top-level.
> Warner's approach fits better in that regard.
> 
> There is of course a lot more needed.
> Being able to add machine and even target specific flags for example.
> These can be just as easily dealt with in share/mk:
> 
> # add machine/taget flags in order of least to most specific
> CFLAGS+= ${CFLAGS.${MACHINE}} \
> 	 ${CFLAGS.${.TARGET:T:R}} \
> 	 ${CFLAGS.${.TARGET:T}}
> 
> etc.  I also find it handy to have 
> 
> CFLAGS_LAST+= ${CFLAGS_LAST.${MACHINE}} \
>         ${CFLAGS_LAST.${.TARGET:T:R}} \
>         ${CFLAGS_LAST.${.TARGET:T}}
> 
> and add ${CFLAGS_LAST} to CFLAGS after Makefile has been read
> so for example when you don't have proper sysroot support you can add
> the equivalent of -I/tree/of/headers/include to the end of the -I list.

Yes. We don't really have proper sysroot support in our build tree, or at least didn't for the longest time, so our build doesn't depend on it. I'm OK making it depend on it, so long as we have this sort of fallback for includes and libraries...

>> This appears to work:
>> 
>> --sysroot /tree/of/headers/and/libraries -B/path/to/binutils
>> 
>> For the whole tree to build it must be part of the value of CC.
> 
> No, they just need to be part of the compiler command line.

Correct.  I said in email a second ago I wanted to do CC?="${__X}cc ${__Y}" but what I really want is a CFLAGS="${__Y}..." instead. Again, for properly named __X and __Y...

>> Otherwise /rescue fails as do several things in /boot.
> 
> That would presumably be bugs in the relevant makefiles no?

Yea, since I've build the whole tree with 'make xdev'-built external tools with at least some version of the stuff I build. There was no problem with /boot and only minor issues with /rescue which were long ago fixed.

Warner


More information about the freebsd-arch mailing list