makefile - Make and last modification times of directories on Linux -


consider following makefile:

foo :     mkdir foo  foo/a.out : foo a.in     cp a.in foo/a.out  foo/b.out : foo b.in     cp b.in foo/b.out 

and following interaction it, starting directory contains files a.in , b.in , nothing else:

$ make foo/a.out mkdir foo cp a.in foo/a.out 

so far, good.

$ make foo/b.out cp b.in foo/b.out 

still good, now:

$ make foo/a.out   # a.out should date now! cp a.in foo/a.out 

it rebuilds a.out target, though none of prerequisites have changed.

it seems what's happening when foo/b.out created, last modification time of directory foo updated, picks having "changed".

is there way avoid this? example, there way declare foo/a.out depends on foo in foo has exist, , creating of files inside foo doesn't cause foo considered out of date?

as authority on make pointed out:

"the 1 thing must never use directory simple prerequisite. rules filesystem uses update modified time on directories not work make."

but think want:

foo :     mkdir foo  foo/a.out : a.in | foo     cp a.in foo/a.out  foo/b.out : b.in | foo     cp b.in foo/b.out 

Comments

Popular posts from this blog

linux - Does gcc have any options to add version info in ELF binary file? -

android - send complex objects as post php java -

charts - What graph/dashboard product is facebook using in Dashboard: PUE & WUE -