On Wed, Dec 15, 2010 at 10:47:14PM -0800, J.T. Conklin wrote:
> One of my makefiles contains a rule with a recipe with a shell case
> statement.  For purposes of discussion, something like this:
> 
>       t:
>               case "${FOO}" in \
>               foo) ${RESULTS1} ;; \
>               bar) ${RESULTS2} ;; \
>               baz) ${RESULTS3} ;; \
>               *)   ${RESULTS4} ;; \
>               esac
> 
..
> 
> PS: And if I've totally missed a better idiom for this task, please
> let me know.

I have used the following method in several cases:

do-foo := ${RESULTS1}
do-bar := ${RESULTS2}
do-baz := ${RESULTS3}

t:
        $(do-$(FOO))

With a little exta effort you have your else part covered too.

Notice that you must use "=" assignments if you refer to $@ or similar
in ${RESULT*}

        Sam

_______________________________________________
Help-make mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/help-make

Reply via email to