NetBSD-Bugs archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
bin/60850: Make could do with a syntax for immediate var expansion
>Number: 60850
>Category: bin
>Synopsis: Make could do with a syntax for immediate var expansion
>Confidential: no
>Severity: non-critical
>Priority: medium
>Responsible: bin-bug-people
>State: open
>Class: change-request
>Submitter-Id: net
>Arrival-Date: Mon Oct 05 05:40:00 +0000 2026
>Originator: Robert Elz
>Release: NetBSD
>Organization:
>Environment:
Machine: everything
>Description:
There are times when Make variables are transitory, existing
just for a short period before vanishing. They can be expanded
while they exist, but not afterwards. This means that a
typical assignment like
CFLAGS= -D${Var}
doesn't work if Var is one of those transitory variables, as
it will not have a value when CFLAGS is later expanded.
This leads to nonsense like
XVar:=${Var}
CFLAGS= -D${XVar}
which works OK, if Var only ever has one value, so only one
"XVar" is needed to hold that value, it starts becoming
freakish when Var goes through many different values, and
all (or some subset) of them are needed.
Better would be to simply have a syntax which instructs
make to "expand this variable right now, whatever the context"
which (assuming here it might be $[...] - but I don't care what
the syntax is, $<var> wouldn't work as $< already has a meaning,
but ${=Var} or something like that might work (no idea, I don't
understand make).
Then
CFLAGS= -D$[Var]
would simply assign something like
CFLAGS= -DMake_Is_too_Complex
which is generally what is wanted anyway, it is very rare
to do an assignment like that, and expect the value of the
variable to change later, and actually want to use the changed
value.
>How-To-Repeat:
Try makeing a Makefile.inc that has something like
CPPFLAGS+= -I ${.PARSEDIR}
in it, and see if you can make that work when CPPFLAGS
ends up being used in one of the standard build rules
from the bsd.*.mk files.
>Fix:
Introduce sanity.
Home |
Main Index |
Thread Index |
Old Index