bug-make
[Top][All Lists]
Advanced

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

Re: make manual: CFLAGS and linking


From: Paul Smith
Subject: Re: make manual: CFLAGS and linking
Date: Fri, 9 Mar 2012 12:49:01 -0500

On Fri, 2012-03-09 at 18:17 +0100, Sebastian Pipping wrote:
> on page [1] it reads:
> 
>   "CFLAGS should be used in every invocation of the C compiler,
>    both those which do compilation and those which do linking."
> 
> It would be nice to have an explanation why CFLAGS whould be used with
> linking, too.  Maybe with an example or a dedicated section in the manual.

I'm not sure there's anything so magical about it that it requires a
dedicated section.

There's nothing more to it than some flags on the compile line can also
be useful to the linker, in at least some implementations.  For example
the linker could recognize the optimize or debug flags and do link-time
optimization or generate output with special debug information.

And sometimes, depending on how your makefile is written, it's possible
for a "link command" to also compile; for example in a POSIX "cc"
implementation, this does what you'd expect:

    cc -o foo foo.o bar.c biz.c baz.o

(that is, compile the .c files and link the whole thing together).

If your makefile can never provide source files to the linker, and you
know that the linker you're using has no use for compile flags (doesn't
make use of them) then it's fine to leave them out.




reply via email to

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