help-make
[Top][All Lists]
Advanced

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

Using MAKEFLAGS with --warn-undefined-variables


From: Lane Schwartz
Subject: Using MAKEFLAGS with --warn-undefined-variables
Date: Wed, 15 Jun 2011 16:41:37 -0400

I'm writing a complex Makefile, and for safety I'd like
--warn-undefined-variables to always be on when any user runs this Makefile.
I've attempted to obtain this functionality by setting MAKEFLAGS to contain
--warn-undefined-variables, but so far this doesn't appear to work.

Here's my minimal makefile (minimal.mk):

MAKEFLAGS:=--warn-undefined-variables
$(info ${BAR})


I get no warning when I run:
$ make -f minimal.mk

But, I do get a warning when I explicitly add the flag at the command line:
$ make -f minimal.mk --warn-undefined-variables


I was concerned that maybe make doesn't interpret MAKFLAGS in this case
where I'm not recursively calling child makefiles. But, when using a single
character flag, MAKEFLAGS behaves as I expect (file called thisworks.mk):

MAKEFLAGS:=B

foo:
     date > $@ <address@hidden>

$ make -f thisworks.mk

With the above, make correctly runs, unconditionally making the target as if
the --always-make flag had been specified.

I can also get MAKEFLAGS to behave as expected when setting
MAKEFLAGS=--always-run, so it's not simply a matter of single character
options versus multicharacter options.

Does anyone know what's going on here?

Thanks,
Lane


reply via email to

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