Please be sure to keep the mailing list in the loop, thanks!

On Thu, 2016-08-25 at 11:55 -0800, Britton Kerin wrote:
> It should explicitly mention that setting it in a makefile won't set
> flags for that instance.

It does set them for that instance, just not until after all the
makefiles have been parsed.  So the new flags take effect after the
makefiles have been parsed and before make starts trying to build
targets.

As far as I know it should be possible to do any combination of things
that you want with the current behavior.  It will be more ugly than
using a simple ?= (for example) but it will be less ugly than testing
for command line flags and failing if they're not provided.

For example this:

  MAKEFLAGS += -rR

  CC ?= my_gcc

says, as far as I can tell, "use the user's version of CC from either
the command line or the environment, or if that's not set then use
my_gcc", which can be written like this:

  # In case you wanted it for other reasons...
  MAKEFLAGS += -rR

  ifneq (,$(filter default undefined,$(origin CC)))
  CC = my_gcc
  endif

You can turn this into a macro and use call or eval if you have a lot
of these.

_______________________________________________
Help-make mailing list
Help-make@gnu.org
https://lists.gnu.org/mailman/listinfo/help-make

Reply via email to