On Tue Sep 10 08:13:36 2013, [email protected] (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))
> 
> There's no way to avoid this feature of the shell function.  The best I
> can suggest is that you write the output to a temporary file, then
> include that; something like:
> 
>    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.
This offers a cleaner syntax and a few more options,
e.g. making generation conditional on the generating script:

include vars.mk

vars.mk: vars.sh
        $< > $@ || rm -f $@

-- 
Reinier Post
http://www.win.tue.nl/~rp/

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

Reply via email to