help-make
[Top][All Lists]
Advanced

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

Re: combining $(eval) with $(shell)


From: Paul Smith
Subject: Re: combining $(eval) with $(shell)
Date: Tue, 10 Sep 2013 10:47:29 -0400

On Tue, 2013-09-10 at 15:53 +0200, Reinier Post wrote:
> On Tue Sep 10 08:13:36 2013, address@hidden (Paul Smith) wrote:
> > On Mon, 2013-09-09 at 17:45 -0700, Adam Kellas wrote:
> > > I'm having a problem using these two together. There's a program which
> > > spits out a series of variable assignments so I need $(shell) to
> > > invoke it, but the shell function strips newlines which garbles the
> > > result. Example below. Ideas?
> > > 
> > > % cat Makefile
> > > $(eval $(shell ./vars.sh))
> > 
> >    TMPFILE := $(shell var=`mktemp /tmp/mk.XXXXXX`; ./vars.sh > $$var; echo 
> > $$var)
> >    include $(TMPFILE)
> >    __d := $(shell rm -f $(TMPFILE))
> 
> I think I'd usually prefer an explicitly included makefile fragment.
> 
> include vars.mk
> 
> vars.mk: vars.sh
>       $< > $@ || rm -f $@

Yeah, that's a MUCH better solution.  I got locked into the shell idea.

Nice!  Cheers.




reply via email to

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