gmake && file time precision of 1 second
Tim Kientzle
tim at kientzle.com
Tue Oct 14 02:40:24 UTC 2014
On Oct 13, 2014, at 2:20 AM, Matthias Apitz <guru at unixarea.de> wrote:
>
> Hello,
>
> I have a large project where a shell script fires up
> gmake runs in subdirs as:
>
> for dir in src norm print ....; do
> cd $dir
> gmake
> cd ..
> done
>
> in each subdir *.c are compiled to *.o and the resulting *.o are ar'ed
> into all the same lib.a; based on normal Makefile rules like:
>
> SRCS = f1.c f2.c
> OBJS = $(SRCS:.c=.o)
>
> .c.o:
> $(CC) -c ... $*.c
>
> lib.a:: $(OBJS)
> $(AR) $@ $(OBJS)
>
>
> after moving to a faster server it turned out that gmake sometimes forget
> to ar the *.o into the lib; I investigated it and it turned out that the
> *.o files have the same modification time (in seconds) as the target
> lib.a (which was produced/updated in the last directory worked on) and
> gmake thinks that the lib.a is uptodate.
>
> Any idea how to address this in the Makefiles?
Instead of updating the same lib.a from every makefile, instead consider creating a separate lib.a in each directory and then combining them at the end.
Combining .a libraries is a little tricky: Try creating a dir, extracting each lib.a into that same directory, then creating a new lib.a. It might be possible to combine them directly using tar —format=ar but I’ve not tried it.
Cheers,
Tim
More information about the freebsd-hackers
mailing list