On Sun, Dec 26, 2004 at 11:36:59AM -0600, Ken Williams wrote:
> On Dec 24, 2004, at 1:52 PM, Michael G Schwern wrote:
> >
> >The moral of the story? Directory targets in Makefiles are a bad idea
> >after
> >all. Argh.
> >
> >So, god help me, I may have to return to .exists files.
>
> Couldn't you just 'touch' the directories? Or is that not portably
> easy?
Doesn't matter. Every time a file gets moved into the directory its
effectively touched. Consider the following Makefile.
directory :
$(MKPATH) directory
file.foo : directory
generate file.foo
$(CP) file.foo directory
file.bar : directory
generate file.bar
$(CP) file.foo directory
all : file.foo file.bar
The timeline for "make all" looks like this.
1 $(MKPATH) directory (now has a mod time of 1)
generate file.foo (file.foo has a mod time of 1)
$(CP) file.foo directory (directory still has a mod time of 1
2 generate file.bar (file.bar has a mod time of 2)
$(CP) file.bar directory (directory now has a mod time of 2)
And then if make is rerun...
3 directory is newer than file.foo therefore file.foo must be
rebuilt
With large enough projects (such as mod_perl) you get spurious rebuilds
like this. I was even getting it in MakeMaker (it would always run the
FIXIN macro on installmodsh) and didn't notice it.
So no, its not a portability thing but rather a "this is the way directories
act" thing. It would be nice if one could tell make to consider directory
dependencies to mean "just make sure this exists" but afaik there isn't.
One could probably be very careful and reset the mod time for each directory
every time its used but that just seems very fragile and not worth the
trouble.
--
Michael G Schwern [EMAIL PROTECTED] http://www.pobox.com/~schwern/
Me? A robot? That's rediculous! For one thing, that doesn't compute at all!