[Top][All Lists]

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

Re: target variable ($@) as prerequisite

From: Oleksandr Gavenko
Subject: Re: target variable ($@) as prerequisite
Date: Wed, 26 Jan 2011 15:50:26 +0200
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv: Gecko/20101207 Thunderbird/3.1.7

On 26.01.2011 11:46, ulugutz wrote:
Oleksandr Gavenko-2 wrote:

On 26.01.2011 9:20, ulugutz wrote:


how can you for example do this

all: PICS
PICS: $(@:pdf=.png)
          do something
i would really appreciate your help and sorry if it has been posted
but I only checked the newest pages of the forum

Why not use:

PNG_FILES := $(wildcard *.png)
PDF_FILES := $(PNG_FILES:.png=.pdf)

all: $(PDF_FILES)

%.pdf: %.png
        png2pdf -o $@ $*.png

or last rule can be rewritten as:

$(PDF_FILES): %.pdf: %.png
        png2pdf -o $@ $*.png
> that's more or less what I am currently using. but in this case he rebuilds
> ALL pdf files if only one png changes
No. You wrong. Only that .pdf for which .png was changed.

Usually this happen then you place in dependency to pattern target
'.PHONY' target:


$(PDF_FILES): %.pdf: %.png BADTARGET
        png2pdf -o $@ $*.png

In this case .pdf file was rebuilt as  BADTARGET always was rebuilt.

Or may be 'png2pdf' command incorrect set last-modification time for .pdf
You can manually fix it by:

touch $@

Please check you Makefile.

С уважением, Александр Гавенко.

reply via email to

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