tech-toolchain archive

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

make -V default behavior change



Hi,

I just changed the default behavior 'make -V <VARIABLE>' to print
the expanded variable name instead of the raw variable name. This
was already proposed by sjg in 2002, the code was added, but the
default was never changed for fear that it would break backwards
compatibility:

http://mail-index.netbsd.org/tech-toolchain/2012/08/06/msg001900.html

In fact the code was added so that:

	make -dV -V <variable>

would print the raw variable name. Since that was the default until
now, it has been a NO/OP.

This behavior was documented in make(1). The intermediate form
is only useful for debugging and one would need make(1) to process
is correctly. To wit:

$ make -V MACHINE_CPU
${MACHINE_ARCH:C/mipse[bl]/mips/:C/mips64e[bl]/mips/:C/sh3e[bl]/sh3/:S/coldfire/m68k/:S/m68000/m68k/:C/arm.*/arm/:C/earm.*/arm/:S/earm/arm/:S/powerpc64/powerpc/:S/aarch64eb/aarch64/:S/or1knd/or1k/:C/riscv../riscv/}

After this change, make(1) prints the expanded value:

$ make -V MACHINE_CPU
x86_64

and the following prints the unexpanded value.

$ make -dV -V MACHINE_CPU
${MACHINE_ARCH:C/mipse[bl]/mips/:C/mips64e[bl]/mips/:C/sh3e[bl]/sh3/:S/coldfire/m68k/:S/m68000/m68k/:C/arm.*/arm/:C/earm.*/arm/:S/earm/arm/:S/powerpc64/powerpc/:S/aarch64eb/aarch64/:S/or1knd/or1k/:C/riscv../riscv/}

One can always get the expanded value by using:

$ make -V '${MACHINE_CPU}'

There is also another variable that controls the default behavior that
was added then: ".MAKE.EXPAND_VARIABLES", which one can set to change
the default behavior.

I've been asked to revert my change because:

1. It will break things.
2. It is the way it has always been.

I will revert it if someone shows me a single case where an existing
makefile breaks, or where the behavior is useful programatically.

I don't buy the 'this is how it has always been' because then we can
never make any changes/progress.

In this case, I believe that printing the unexpanded variable by default
was an accident (which did not get noticed because most variables don't
need further expansions). When we finally noticed it, we added '${var}'
expansions. After that in 2002 we questioned if the default was correct,
but did not changed it because of an unfounded fear that it would break
things.

christos


Home | Main Index | Thread Index | Old Index