what is $(ps .. ) in zaptel makefile?

Tzafrir Cohen tzafrir.cohen@xorcom.com
Thu, 24 Feb 2005 16:22:05 +0200


On Thu, Feb 24, 2005 at 02:14:56PM +0100, Kilian Krause wrote:
> Hi Tzafrir,
> 
> Am Donnerstag, den 24.02.2005, 14:32 +0200 schrieb Tzafrir Cohen:
> > Hi
> > 
> > One of the current differences between my package and the deb is:
> > 
> > diff -ur ./Makefile ../Debs/zaptel-1.0.4/Makefile
> > --- ./Makefile  2005-02-19 14:37:35.000000000 +0200
> > +++ ../Debs/zaptel-1.0.4/Makefile       2005-02-24 13:40:40.000000000 +0200
> > @@ -38,11 +38,11 @@
> >  ifeq (${BUILDVER},linux24)
> >  #We only support DEVFS in linux 2.4 kernels, since its considered obsolete post 2.4
> > -DYNFS=$(shell ps ax | grep -v grep | grep -q devfsd && echo "yes")
> > +DYNFS=$(ps ax | grep -v grep | grep -q devfsd && echo "yes")
> >  endif
> >  ifeq (${BUILDVER},linux26)
> >  #Tests for newer linux-2.6 udev support
> > -DYNFS=$(shell ps ax | grep -v grep | grep udevd && echo "yes")
> > +DYNFS=$(ps ax | grep -v grep | grep udevd && echo "yes")
> >  endif

I'll just state that $(ps ...) does not seem to work here:

tzafrir@boole:~$ make -f <(echo -e 'var=$(shell ps 1)\nall:\n\t@echo var=$(var)')
var= PID TTY STAT TIME COMMAND 1 ? S 0:00 init [2]
tzafrir@boole:~$ make -f <(echo -e 'var=$(ps 1)\nall:\n\t@echo var=$(var)')
var=


> > 
> > BTW: is there something to gain from using := in the asterisk makefiles, 
> > with the common use of $(shell ...) ?
> 
> Well, from the make infopage:
>    Variables defined with `=' are "recursively expanded" variables.
> Variables defined with `:=' are "simply expanded" variables; these
> definitions can contain variable references which will be expanded
> before the definition is made.  *Note The Two Flavors of Variables:
> Flavors.
> -(snip)-
> 
> I don't see a reason for either the "shell" to be removed, or the := to
> be introduced. Is there any known problem with the way we put it?
> Especially for clarification it might be worth leaving the "shell" in
> there, so it's easier to spot what happens, yet the effect should be
> identical for both notations.

basically a matter of performance. When you use, e.g. the variable PROC 
in the (original) asterisk makefile you're not quite aware of the facty 
that each such use spawns a shell.

-- 
Tzafrir Cohen     icq#16849755  +972-50-7952406
tzafrir.cohen@xorcom.com  http://www.xorcom.com