[Top][All Lists]

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

Re: How to: organize application files and get GNU make to put theoutput

From: Greg Chicares
Subject: Re: How to: organize application files and get GNU make to put theoutput files into the right place.
Date: Mon, 25 Jan 2010 19:14:22 +0000
User-agent: Thunderbird (Windows/20090812)

On 2010-01-25 18:14Z, Ted Byers wrote:
> One last question.  Right now, I have:
> CPPFLAGS = -Wall -pedantic -I ../include
> I haven't set a variable for linking, so I suppose I am using whatever
> default value there may be (if there is one).

See "Variables Used by Implicit Rules" in the gnu make manual.

  LDFLAGS  --> linker
  CPPFLAGS --> preprocessor (not C++ '.cpp' files)
  CFLAGS   --> C compiler
  CXXFLAGS --> C++ compiler

This probably works for you:
> CPPFLAGS = -Wall -pedantic -I ../include
because all preprocessor flags are being passed to the compiler,
but more canonically you'd split them:
  CPPFLAGS = -I ../include
  CXXFLAGS = -Wall -pedantic

> What would be the procedure to extend the CPPFLAGS (and whatever the
> corresponding link variable) so that if I invoke it in one way, the
> executable has all the debug info and no optimization, and if invoked in
> another way, without debug info and full optimization?  Ideally, if I
> specify either 'make debug' or 'make production', all the code, whether for
> a library or for the executable, would be compiled with either the debug
> info and no optimization or no debug info and full optimization.  Is there a
> standard way to do this?

See "Variables for Specifying Commands" in the gnu make manual
(the ALL_CFLAGS example).

reply via email to

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