[Top][All Lists]

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

Re: Implementing an "eval" function

From: Eray Ozkural
Subject: Re: Implementing an "eval" function
Date: Fri, 16 Feb 2001 13:26:31 +0200
User-agent: Mutt/1.3.12i

Hi Paul,

On Fri, Feb 16, 2001 at 01:02:37AM -0500, Paul D. Smith wrote:
> I'm not ready to release it for testing yet.

All right. :}

> You are, of course, free to do what you like, but my previous suggestion
> is still the best one I have.  You have a simple implementation that
> works for you on the system you care about (Linux), so my advice is to
> go ahead and use that until such time as 3.80 is available or in
> pretest.

I decided to do some kludges and write dynamic rules to an output file
which is later included. The only problem I ran into is that I can't
invoke a shell command which contains newlines from make itself.
There seems to be no way to write this within the shell.

$ cat rules | sed 's/<newline>/\
/' > rules2

Neither this works, although I use a define
define write-rule
$(subst dollar,$$,$(1))
ENDOFFILE  >> rules

eval = $(shell $(write-rule))

the eval function won't accept this single shell command with newlines in it.
is there a way to use shell 'here documents' like this which I have omitted?

Trying to use define, I was also unable to provide multi-line output using
a code like this:
define call-build-exec
  echo test!
prog-deprule = $(call eval,$(1): dollar($(1)_EXECFILE) $(call-build-exec))
$(call map,prog-deprule,$(PROGRAMS))

Here the eval implementation is very simple:
define write-rule
echo '$(subst dollar,$$,$(1))' >> rules
eval = $(shell $(write-rule))

and map is the usual one

map = $(foreach a,$(2),$(call $(1),$(a)))

In brief, there seems to be something wrong about the interpretation of
newlines. I simply can't invoke this shell command from make:

orion:cxx$ echo "hi
> this was a newline"
this was a newline

I am at a loss with this. Any ideas?


Eray (exa) Ozkural
Comp. Sci. Dept., Bilkent University, Ankara
e-mail: address@hidden
www: http://www.cs.bilkent.edu.tr/~erayo

reply via email to

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