[Top][All Lists]

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

Re: mention how to get the other half of $*

From: Philip Guenther
Subject: Re: mention how to get the other half of $*
Date: Mon, 14 Mar 2011 10:39:50 -0700

On Mon, Mar 14, 2011 at 5:30 AM,  <address@hidden> wrote:
> (info "(make) Automatic Variables") says
> `$*'
>     The stem with which an implicit rule matches
> OK, that is the stem. Now mention what can we use to get the other half.
> OK, the answer apparently is here. Please mention it.
> %.xcf %.jpeg:%.pdf; gs -sDEVICE=$(subst .,,$(suffix $@)) -sOutputFile=$@ 
>                                ^^^^^^^^^^^^^^^^^^^^^^^^

That rule is not correct: it *claims* to generate both whatever.xcf
_and_ whatever.jpeg when its commands are run, but it does not do so.
The result is that if you ask make to build both files, it will only
generate one of them.  You need separate pattern rules to get what you

I would probably just write it like this:

run_gs = gs -sDEVICE=$1 -sOutputFile=$@ -dNOPAUSE -dBATCH $<
%.xcf: %.pdf; $(call run_gs,xcf)
%.jpeg: %.pdf: $(call run_gs,jpeg)

(Yes, you could use $(foreach) and $(eval) to iterate across the types
and define rules for each...and it'll take you longer to write and GNU
make longer to process.)

Philip Guenther

reply via email to

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