tech-toolchain archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
make: .for loops in commands
Is there, in make, any sane way to assemble a single shell command using
.for loops and .if conditionals? I want to do something along the lines of
target:
{\
.for i in ${list}
echo ${i};\
.done
} > ${.TARGET}
(of course it's more complicated than the example, wehere I could simply
echo ${list}, it involves nested loops and conditionals)
I could do
target:
echo >${.TARGET}
.for i in ${list}
echo ${i} >>${.TARGET}
.done
but that's certainly more expensive.
I could also try to use the :@ loop construct and :U, :D and :? modifiers,
but given the structure of the loops and conditional expressions, that's
going to become unreadable at best.
From reading the man page, I was under the impression that (provided I don't
use -B)
target:
exec >${.TARGET}
.for i in ${list}
echo ${i}
.done
would work, but make calls one shell per echo line.
I also guess it won't work to assemble the shell command into a make variable
and execute that due to the quoting hell that's going to be.
Home |
Main Index |
Thread Index |
Old Index