J.T. Conklin wrote:
While testing my implementation, I realized that using $(or ...) can
mostly approximate this:
t:
$(or $(if ${COND1},${RESULTS1}), \
$(if ${COND2},${RESULTS2}), \
$(if ${COND3},${RESULTS3}), \
${RESULTS4})
The significant difference is that if ${CONDN} is true but ${RESULTN}
expands to false, $(or ...) will continue on where $(cond ...) would
have stopped. Accidently adding an else-part to an $(if ...) would
cause problems too.
You don't show what CONDN or RESULTSN are in your case, but generally
speaking at least, you can address your first concern above by appending
a space character _after_ the reference to each RESULTSN variable. For
example:
t:
$(or $(if ${COND1},${RESULTS1} ), \
$(if ${COND2},${RESULTS2} ), \
$(if ${COND3},${RESULTS3} ), \
${RESULTS4})
That's sufficient to make the expression evaluate to "true" for purposes
of gmake and short-circuit out of the evaluation of the other
expressions. You can trace which expressions are evaluated by inserting
a $(info) call into them, like this:
COND1=$(info COND1)
COND2=$(info COND2)
COND3=$(info COND3)
RESULTS1=$(info RESULTS1)
RESULTS2=$(info RESULTS2)
RESULTS3=$(info RESULTS3)
RESULTS4=$(info RESULTS4)
With this set of values, you'll see that COND1, COND2, COND3 and
RESULTS4 are evaluated; change COND2 to "$(info COND2)x" (again, the x
is enough to make it "true") and instead you get COND1, COND2 and
RESULTS2 evaluated.
Hope that helps,
Eric Melski
Electric Cloud, Inc.
_______________________________________________
Help-make mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/help-make