automake
[Top][All Lists]
Advanced

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

subset of CPPFLAGS for a subtree


From: Christopher Sean Morrison
Subject: subset of CPPFLAGS for a subtree
Date: Mon, 31 Dec 2007 14:11:30 -0500


Is there a good/easy/maintainable way to set the same CFLAGS/CPPFLAGS for the entire project except for one specific subtree?

I'm using a recursive automake build where a few flags are default set by configure (e.g. overrides the default "-O2 -g" to different flags). I'd like to enable more strict compilation flags (e.g. -Wall -Werror -ansi -pedantic) for all but one specific subtree in our project but am not seeing a good way of doing this that doesn't involve editing all the various targets throughout that subtree.

In this particular case, there is a large 'src' tree with all of our sources as well as a 'src/other' subtree that includes user- contributed external sources that we don't modify/maintain any more than we have to but provide for compilation/distribution convenience. There are dozens of other dirs both in src and in the src/other dir that get traversed during compilation with hundreds of targets, so what I'd sort of like to do is be able to specify in src/ other/Makefile.am some directive that says "use the same top-level CPPFLAGS setting for this subtree except for -Wall -Werror -ansi - pedantic" so that the subtreee still gets the same debug/profile/ optimization flags.

I can see how to achieve that goal if I edit all of the Makefile.am's spread throughout src/other via manual CPPFLAGS for all targets, but that's repetitive and would be too much of a maintenance burden. Right now, it all works with just the top-level configure setting what is desired even propagating through to various sub-configures.

The problem is the same as having the following directory structure and wanting dirB to have just flags A and B while everywhere else having CPPFLAGS A, B, C, and D:

src
  dirA
      fooA
      fooB
      ...
  dirB
      barA
      barB
      ...
  dirC
      booA
      booB
      ...

Any suggestions?  Thanks in advance for any help!

Cheers!
Sean



Few caveats:
I'd like to keep the external sources in the src subtree (as opposed to some new top-level dir). I'm hoping to find a solution that works with as far back as automake 1.6+ if possible. I don't really want to have to edit/maintain the compilation setting in multiple places if it can be avoided. (e.g. don't want to edit all the src/dirB/bar[A-Z]/Makefile.am files, hopefully just dirB/ Makefile.am)





reply via email to

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