%% Peter Simons <[EMAIL PROTECTED]> writes:

  ps> I want to include several sub-makefiles from my top-level
  ps> makefile, but I need to overwrite some of the variables they
  ps> define.  Unfortunately, I need to overwrite these variables with
  ps> different values for each sub-makefile! Since recursive make is
  ps> not an option in my case, I wonder whether GNU Make supports a
  ps> construct like this:

  ps>  | foo/GNUmakefile:        CPPFLAGS=-I/somewhere
  ps>  | bar/GNUmakefile:        CPPFLAGS=-I/elsewhere
  ps>  |
  ps>  | include foo/GNUmakefile bar/GNUmakefile

No, nothing like that is supported.  Why not just do:

  CPPFLAGS = -I/somewhere

  include foo/GNUmakefile

  CPPFLAGS = -I/elsewhere

  include bar/GNUmakefile

Of course, if what you really meant was for all targets defined in the
given makefiles to somehow magically have those values set, then of
course the above won't do that.  You'd have to do something like:

  include foo/GNUmakefile

  $(TARGETS) : CPPFLAGS = -I/somewhere

  include bar/GNUmakefile

  $(TARGETS) : CPPFLAGS = -I/somewhere


Then in foo/GNUmakefile:

  TARGETS = foo foobiz foobaz

and in bar/GNUmakefile:

  TARGETS = bar barbiz barbaz

  ps> I know I can specify per-target variables in newer makes, but can
  ps> I somehow specify an per-include variable as well?

No, definitely not.

  ps> If not, would it be very difficult to add this feature?

Yes.

-- 
-------------------------------------------------------------------------------
 Paul D. Smith <[EMAIL PROTECTED]>          Find some GNU make tips at:
 http://www.gnu.org                      http://make.paulandlesley.org
 "Please remain calm...I may be mad, but I am a professional." --Mad Scientist


_______________________________________________
Help-make mailing list
[EMAIL PROTECTED]
http://mail.gnu.org/mailman/listinfo/help-make

Reply via email to