bin/183762: make(1) .undef does not work with variables set to a value
julio at meroh.net
Thu Nov 7 20:20:04 UTC 2013
>Synopsis: make(1) .undef does not work with variables set to a value
>Arrival-Date: Thu Nov 07 20:20:00 UTC 2013
>Originator: Julio Merino
>Release: FreeBSD 11.0-CURRENT powerpc
System: FreeBSD mastodon.meroh.net 11.0-CURRENT FreeBSD 11.0-CURRENT #2 r257556M: Sat Nov 2 17:24:33 EDT 2013 jmmv at mastodon.meroh.net:/usr/obj/usr/src/sys/GENERIC64 powerpc
The .undef directive of make(1) does not seem to work on a
variable that has been defined to a value (even if empty) either
via the environment or a command-line argument to make. However
.undef works on variables that have been defined using make's
-D flag and variables defined in the same Makefile.
I have found this while debugging build issues in bsd.own.mk.
Makefile.inc1 has to pass -DNO_* to make in order to explicitly
disable some features during the build bootstrap. However, if
the user explicitly sets WITH_* from the command line (without
using -D), the build fails because it finds both WITH_* and
I believe .undef is buggy and hence the reason for this PR. And
if it is not a bug, make(1) probably deserves some note about
this as well as the build documentation (maybe in src.conf(5))
to warn about this.
And sample invocations:
$ make -DVAR
$ make -DDEFINE_VAR_IN_MAKEFILE
$ make VAR=
$ VAR= make
The last two cases shown above are unexpected behavior to me.
I would expect the ".undef VAR" to take effect at all times.
More information about the freebsd-bugs