Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 13 Oct 2014 19:40:14 -0700
From:      Tim Kientzle <tim@kientzle.com>
To:        Matthias Apitz <guru@unixarea.de>
Cc:        freebsd-hackers@freebsd.org
Subject:   Re: gmake && file time precision of 1 second
Message-ID:  <E930C1E7-E5C9-42C4-A9C4-D30281607370@kientzle.com>
In-Reply-To: <20141013092018.GA2737@unixarea.DDR.dd>
References:  <20141013092018.GA2737@unixarea.DDR.dd>

next in thread | previous in thread | raw e-mail | index | archive | help

On Oct 13, 2014, at 2:20 AM, Matthias Apitz <guru@unixarea.de> wrote:

>=20
> Hello,
>=20
> I have a large project where a shell script fires up
> gmake runs in subdirs as:
>=20
> for dir in src norm print ....; do=20
>   cd $dir
>   gmake
>   cd ..
> done
>=20
> 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:
>=20
> SRCS =3D f1.c f2.c
> OBJS =3D $(SRCS:.c=3D.o)
>=20
> .c.o:
> 	$(CC) -c ... $*.c
>=20
> lib.a:: $(OBJS)
> 	$(AR) $@ $(OBJS)
>=20
>=20
> 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.
>=20
> 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 =
=97format=3Dar but I=92ve not tried it.

Cheers,

Tim




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?E930C1E7-E5C9-42C4-A9C4-D30281607370>