[Top][All Lists]

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

Re: Difference between AM_CFLAGS, AM_CPPFLAGS, and AM_LDFLAGS

From: Paul Smith
Subject: Re: Difference between AM_CFLAGS, AM_CPPFLAGS, and AM_LDFLAGS
Date: 10 Sep 2002 02:06:20 -0400
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.2

%% Stephen Torri <address@hidden> writes:

  st> On Mon, 2002-09-09 at 23:11, Steve M. Robbins wrote:
  >> On Mon, Sep 09, 2002 at 10:33:40PM -0500, Stephen Torri wrote:

  >> > AM_CFLAGS - compile time flags
  >> > AM_CPPFLAGS - preprocessor flags (e.g. -I, -D)
  >> > AM_LDFLAGS - linker flags (e.g. -L)
  >> > I am working on a project that is updating its files. I see
  >> > a variety of flags in one variable like CFLAGS contains -I and -F flags
  >> > for example. I was wondering what is the advantage of doing this with
  >> > automake variables?
  >> Are you asking what is the advantage of separating them as automake
  >> does?  I guess the advantage is that automake uses, e.g. LDFLAGS for
  >> linking lines where generic CFLAGS (-O, -g) might upset the linker.

  st> Yes. What is the advantage of separating them?

Steve gave you the advantage: so you can run them individually.

There are many compilers that won't accept linker flags (libraries,
etc.) on a command line meant to compile a file (but not link it).

The reason for having a separate CFLAGS and CPPFLAGS is even stronger:
often you want to just run the C preprocessor (or a tool that takes the
same arguments as the C preprocessor) either for debugging, or running
tools like lint, or instrumenting your code with special debugging
capabilities, etc.  In this case you need to be able to run the
preprocessor and be sure you're getting all the same arguments as when
you compile the code into an object file.

 Paul D. Smith <address@hidden> HASMAT--HA Software Mthds & Tools
 "Please remain calm...I may be mad, but I am a professional." --Mad Scientist
   These are my opinions---Nortel Networks takes no responsibility for them.

reply via email to

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