help-make
[Top][All Lists]
Advanced

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

Re: How to specify a dependence on a directory?


From: Paul Smith
Subject: Re: How to specify a dependence on a directory?
Date: Sun, 10 Jan 2010 12:02:26 -0500

On Sun, 2010-01-10 at 10:22 -0600, Peng Yu wrote:
> The code that you suggested is not working properly, when make is
> called the second time. Would you please take a look at how to fix it?

> $ cat Makefile
> TXT_FILES:=$(wildcard somedir/*.txt)
> 
> ifeq ($(TXT_FILES),)
> .PHONY: all
> endif
> 
> .PHONY: clean
> 
> all: $(TXT_FILES)
>       ./command.sh

> $make   # I do not expect command.sh should be called here, because
> all *.txt is newer than command.sh

?!?!  What does whether the text files are newer than command.sh have to
do with anything?

Your makefile shows that the target "all" depends on the text files, so
the only thing make cares about is whether any of the text files are
newer than "all".  Make doesn't know ANYTHING about command.sh.


If you don't want the command to be run when the text files haven't been
changed then you to be sure the file "all" exists with a timestamp newer
than the text files.  Or, change your rules.

-- 
-------------------------------------------------------------------------------
 Paul D. Smith <address@hidden>          Find some GNU make tips at:
 http://www.gnu.org                      http://make.mad-scientist.net
 "Please remain calm...I may be mad, but I am a professional." --Mad Scientist





reply via email to

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