|
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:1.9.2.13) 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:Hi, how can you for example do this ------------------------------------ PICS=%.pdf all: PICS PICS: $(@:pdf=.png) do something ------------------------------------ i would really appreciate your help and sorry if it has been posted already but I only checked the newest pages of the forumWhy 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: .PHONY: BADTARGET BADTARGET: command-for-BADTARGET $(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. -- С уважением, Александр Гавенко.
[Prev in Thread] | Current Thread | [Next in Thread] |