[Top][All Lists]

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

Re: rules and macro query

From: Philip Guenther
Subject: Re: rules and macro query
Date: Thu, 6 May 2010 09:24:31 -0700

On Thu, May 6, 2010 at 1:23 AM, Payal <address@hidden> wrote:
> I have a few simple doubts. Can someone help with them, please?
> 1. In target specific variables, how can I define multiple vars. Is
> this the only way,
> X : a=foo
> X : b=bar

Yes, that's on the only way.  You can only define one variable per line, period.

> 2. How to define a target specific macro (with define)? This does not
> work.
> $ cat -vet Makefile
> aaa : define foo$
> hi foo$
> endef$
> $
> aaa :$
> ^Iecho $(foo)$
> $

Not directly, but this works:

define foo_a
echo foo
echo bar
aaa: foo=${foo_a}
        echo ${foo}

> 3. A silly query. In a rule, after target : prereq. can only these
> things come,
> a. a shell command (after a hard tab)
> b. a make comment
> Can't we give "make" variables or functions there? If yes, can someone
> give simple example or two please?

You can't combine on a single line the specifying of a prerequisite
for a target with the assignment of a target-specific variable, if
that's what you're wondering about.

(If that isn't what you're wondering about, well, "what problem are
you trying to solve?")

Philip Guenther

reply via email to

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