help-make
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: HELP! Can I construct individial shell commands using a function


From: Luke Shumaker
Subject: Re: HELP! Can I construct individial shell commands using a function
Date: Sat, 26 Feb 2011 21:23:15 -0500

The trick is to get the different commands on different lines.  Try
this:

define _ExecuteShcmdArray
$(foreach c,$1,@$($c)
)
endef

shellcmd1 = cd .. ; pwd
shellcmd2 = cd .. ; pwd

all:
        $(call _ExecuteShcmdArray,shellcmd1 shellcmd2)

-- 
~ LukeShu
http://lukeshu.ath.cx


On Sun, 2011-02-27 at 08:39 +0800, address@hidden wrote:
> Using make 3.82 
> 
> Check the following makefile please, 
> 
> ========
> define _ExecuteShcmdArray
>       @$(foreach c,$1,$($c);) # Not what I desire, how can I???
> endef
> 
> shellcmd1 = cd .. ; pwd
> shellcmd2 = cd .. ; pwd
> 
> all:
>       $(call _ExecuteShcmdArray,shellcmd1 shellcmd2)
> ========
> 
> It outputs somthing like
> 
> =========
> G:/w/makingsys/GMU-addons
> G:/w/makingsys
> =========
> 
> But what I disire is
> =========
> G:/w/makingsys/GMU-addons
> G:/w/makingsys/GMU-addons
> =========
> 
> To clarify, the question is, I want to write a function called
> _ExecuteShcmdArray, and it can execute variable number of shell commands
> according to parameter($1) given. In that above example, I hope shellcmd1
> and shellcmd2 can be executed in different shell process, but how to write
> _ExecuteShcmdArray function to accomplish that goal?
> 
> Can $(eval ) help this?
> 
> Thank you in advance.
> 
> 
> 
> _______________________________________________
> Help-make mailing list
> address@hidden
> http://lists.gnu.org/mailman/listinfo/help-make




reply via email to

[Prev in Thread] Current Thread [Next in Thread]