Helmut Karlowski wrote:
No problem: $2 contains the first of them.
Yes, you're right, it's OK.But I think the list of dependencies is unsorted, you may not get the last modification date.
I was thinking to that: xversion.h: $(filter-out xversion.h,$(wildcard *.[ch])) echo '#define BDATETIME "$(shell date -r $(firstword $(shell ls -t $?)) '+%b %e %Y %H:%M')"' >$@ However, the contents of xversion.h will be wrong if some source file is deleted. I must admit my proposition is a bit insane ;-)Maybe that's why I don't understand it ;)
Basically, xversion.h depends of *.c and *.h, excepted xversion.h itself because you would get a circular reference. Beware, there is a trap, you can't use $@ in the list of dependencies because it is not substituted.
First I use "ls -t" to sort the modified dependencies, then I take only the first file to feed "date -r"
For details: http://www.gnu.org/software/make/manual/make.html -- Vincent Rivière