CFLAGS only for clang in mixed-compiler project?
Ian Lepore
ian at freebsd.org
Thu Jan 1 16:47:02 UTC 2015
On Thu, 2015-01-01 at 19:01 +0300, Lev Serebryakov wrote:
> I'm trying to update arm-eabi (microcontroller) cross-gcc port to
> latest version 4.9 and have one weird problem.
>
> Some part of gcc for arm (neon coprocessor machine description, to be
> precise) requires more than 256 nested parenthesis in version 4.9 (4.8
> doesn't have this problem). Due to this parenthesis madness clang
> needs "-fbracket-depth=1024" option. If I add this option to CFLAGS in
> environment variable, I have other problem. Later in build process gcc
> uses newly-built gcc (xgcc) to build library. And this gcc picks up
> "-fbracket-depth=1024" from environment and fails due to unknown option!
>
> How could I provide options only for clang but not for gcc?
Don't set it in the env, set it in a make variable. The
devel/arm-none-eabi-gcc port (which builds a bare-metal arm cross
compiler and may be exactly what you need) has this:
.include <bsd.port.options.mk>
# The following is required for clang to bootstrap gcc.
.if ${COMPILER_TYPE} == clang
MAKE_ARGS+= CXXFLAGS=-fbracket-depth=512
.endif
-- Ian
More information about the freebsd-hackers
mailing list