[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Is there any value in a lisp-like $(cond ...) function?
From: |
Sam Ravnborg |
Subject: |
Re: Is there any value in a lisp-like $(cond ...) function? |
Date: |
Thu, 16 Dec 2010 19:35:58 +0100 |
User-agent: |
Mutt/1.5.18 (2008-05-17) |
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