Re: g++ default options/flags

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

 



kyp44 wrote:

> After searching pretty extensively the web and nabble I could not find the
> answer to what I think ought to be a simple question: is there a way to
> change the default options/flags so that every time g++ is invoked
> additional, default flags are added to those flags passed with the command?
> In my particular example I need to have the -ffriend-injection flag passed
> every time I call g++ and I don't want to have to add it to all my
> makefiles. I am fairly new to linux and I tried making an alias (alias
> g++='g++ -ffriend-injection') but this did not work when g++ is called from
> make, which I guess makes sense since it is not executed as a command to
> bash. Any help with this would be appreciated.

Any properly written Makefile should provide the user a way to specify
things like CXXFLAGS in the environment or when invoking make.  For
autoconf based packages you can create a config.site file with the
desired settings.

If that's not enough you can create a wrapper script for g++ and put it
ahead of the actual g++ in the PATH.  Alternatively, you could edit the
gcc specs file.  But these are both horribly ugly solutions -- the
various *FLAGS are meant to be the domain of the user, not the package,
so it's a bug in the package if they can't be reasonably set somehow;
editing a bunch of Makefiles should never be necessary.

Brian

[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux