From owner-freebsd-hackers@FreeBSD.ORG Tue Oct 14 02:40:24 2014 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 1315130E for ; Tue, 14 Oct 2014 02:40:24 +0000 (UTC) Received: from mail-pd0-f179.google.com (mail-pd0-f179.google.com [209.85.192.179]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id DB2346B4 for ; Tue, 14 Oct 2014 02:40:23 +0000 (UTC) Received: by mail-pd0-f179.google.com with SMTP id r10so6616748pdi.38 for ; Mon, 13 Oct 2014 19:40:22 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:content-type:mime-version:subject:from :in-reply-to:date:cc:content-transfer-encoding:message-id:references :to; bh=fXquTGTEXE1S/fw9Xoa430BHuhv/uu1UidWhLNs/lxk=; b=UNhH4g/0OV8DeY4ZY/IbLTqOYNpbkpW29099E4F95ZNcZktY+8sbRg3EkTncewWfrT EwacTKW6IsunR3wY0KyDRlgm1WI30XbN3Jp9ukz4n38raAcbbqE9NOx4I5A3j5TRZSE/ 3yC3dseoTL8RQDnzIWNnylEbUT3sfw4fsfeX4tlzMWgr4bz0ZEpuRILDy6xGghXqm9wy zwF7PNbll079reCORb55N2dkY3y1fgCukDkNQR7/FsGHXkb4LzEkOLZADWmlhhxK2SJq 360Toonb8aizNYDfRAByS1GCd4xfI2xndxhYq42l+TdPvXAwYRrPy/1Ea5vnT2b8p1YH WPBQ== X-Gm-Message-State: ALoCoQmn+LVWYg660/JUsXzhdMANO7VtIYiWtJ142fXltMZMJ1y3xPX0Ld/4VU2aWnZOT0DpSOQr X-Received: by 10.70.62.74 with SMTP id w10mr660656pdr.140.1413254422734; Mon, 13 Oct 2014 19:40:22 -0700 (PDT) Received: from [192.168.1.100] (c-24-6-220-224.hsd1.ca.comcast.net. [24.6.220.224]) by mx.google.com with ESMTPSA id h6sm8754482pdk.38.2014.10.13.19.40.16 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 13 Oct 2014 19:40:22 -0700 (PDT) Content-Type: text/plain; charset=windows-1252 Mime-Version: 1.0 (Mac OS X Mail 7.3 \(1878.6\)) Subject: Re: gmake && file time precision of 1 second From: Tim Kientzle In-Reply-To: <20141013092018.GA2737@unixarea.DDR.dd> Date: Mon, 13 Oct 2014 19:40:14 -0700 Content-Transfer-Encoding: quoted-printable Message-Id: References: <20141013092018.GA2737@unixarea.DDR.dd> To: Matthias Apitz X-Mailer: Apple Mail (2.1878.6) Cc: freebsd-hackers@freebsd.org X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 14 Oct 2014 02:40:24 -0000 On Oct 13, 2014, at 2:20 AM, Matthias Apitz 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