Brian - try this:

# Path to this current makefile
MAKEFILE=$(lastword $(MAKEFILE_LIST))

# constructed path to a subdirectory to hold datestamp files
DATESTAMP=$(MAKEFILE).d/datestamp

# rule to create datestamp files, copying the files date
$(DATESTAMP)/%:  %
        mkdir -p $(@D) ; \
        touch -r $* $@

T: O $(DATESTAMP)/O 
        cat O > T


~Malcolm


> -----Original Message-----
> From: [email protected] 
> [mailto:[email protected]] On Behalf Of Brian
> J. Murrell
> Sent: Monday, December 03, 2012 6:00 PM
> To: [email protected]
> Subject: Re: using the date relationship of two older files as a prerequisite
> 
> On 12-11-29 12:50 PM, Brian J. Murrell wrote:
> > I have a file which is not created by make but is created/updated by an
> > outside process.  The time stamp on this file will always be some time
> > in the past.  Let's call this file "O".
> >
> > I have a target which I want make to build which we'll call "T".  I want
> > T rebuilt if file O is newer than it was the last time T was built.  But
> > even though the time on O might be newer than it was the last time T was
> > built, it will still not be newer than T.
> 
> I think I've figured it out:
> 
> FORCE:
> 
> T: $(shell [[ O -nt O-stamp ]] && echo "FORCE")
>       touch T
>       touch -r O O-stamp
> 
> It seems a shame to have to call out the shell to perform one of the
> functions at the heart of make (comparing the modification time of two
> files) but I couldn't figure out any way to make make do that.
> 
> Still open to suggestions.  :-)
> 
> Cheers,
> b.
> 


_______________________________________________
Help-make mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/help-make

Reply via email to