[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: How to specify a dependence on a directory?
From: |
Peng Yu |
Subject: |
Re: How to specify a dependence on a directory? |
Date: |
Fri, 20 Nov 2009 22:10:34 -0600 |
On Fri, Nov 20, 2009 at 8:26 PM, Paul Smith <address@hidden> wrote:
> On Fri, 2009-11-20 at 18:50 -0600, Peng Yu wrote:
>> But I don't want to explicitly specify the files, because I might
>> change 'some_command' to generate different files. I don't want to
>> modify Makefile every time I change 'some_command'.
>
> So, to be clear: you want the rule to run if there are no files in the
> directory, or if there are any files and any of them are newer than the
> target?
I want the rule to run if there is no such a directory, or there are
no files in the directory, or there is any file that is older than the
dependent files.
> How about:
>
> FILES := $(wildcard somedir/*)
> ifeq ($(FILES),)
> .PHONY: target
> endif
> target: $(FILES)
> somecommand
>
> --
> -------------------------------------------------------------------------------
> 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
>
>