[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Bug-gnubg] building on FreeBSD.......

From: Michael Petch
Subject: Re: [Bug-gnubg] building on FreeBSD.......
Date: Tue, 18 Feb 2014 14:41:17 -0700
User-agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:24.0) Gecko/20100101 Thunderbird/24.3.0

On 2014-02-18 13:03, Philippe Michel wrote:
> This doesn't look right. Only -I is a preprocessor flag. The others
> are compiler (or linker) flags :
> CFLAGS="-O3 -funroll-loops -march=native -mtune=native"
> CPPFLAGS="-I/usr/local/include"
> LDFLAGS="-L/usr/local/lib" 

It is correct as any flag the preprocessor doesn't handle will get
passed to the back end program using it (C, C++, Ada compilers etc).

In single language C environment CPPFLAGS and CFLAGS are effectively the
same thing. No matter what language backend the preprocessor will pass
the other parameters that it may not use to the backend when using CPPFLAGS.

If you start mixing languages like C and C++ then there is more of a
distinction. CPPFLAGS will be passed to both compilers (g++ and gcc). So
if I want to enable debugging or simd instructions to both the C and C++
compilers I can use CPPFLAGS. If I want the flags to be different then I
can can specifically use CFLAGS for C, and CXXFLAGS for C++.



Would produce compiled code with no (-O0) optimizations for C++ and more
optimizations for C (-O3). Both C++ and C will be built with debug
information (-g)

The default GNU make rules for C++ and C look like this:

If you call the pre-processor directly with extra flags you should find
it accepts them (but doesn't use them of course). For as long as I can
remember (at least back to 2.x of gcc) the pre-processor will also
complain about flags that are not supported.

cpp -O3 -g -I/path/to/includes filename.xxx

You should find it it doesn't choke on the known compile flags, even
though it can't do anything useful with them. It will of course know
about and use the -I flag.

Michael Petch
GNU Backgammon Maintainer / Developer
OpenPGP FingerPrint=D81C 6A0D 987E 7DA5 3219 6715 466A 2ACE 5CAE 3304

reply via email to

[Prev in Thread] Current Thread [Next in Thread]