From owner-freebsd-bugs Fri Aug 11 18:50:02 1995 Return-Path: bugs-owner Received: (from majordom@localhost) by freefall.FreeBSD.org (8.6.11/8.6.6) id SAA05694 for bugs-outgoing; Fri, 11 Aug 1995 18:50:02 -0700 Received: (from gnats@localhost) by freefall.FreeBSD.org (8.6.11/8.6.6) id SAA05687 ; Fri, 11 Aug 1995 18:50:01 -0700 Resent-Date: Fri, 11 Aug 1995 18:50:01 -0700 Resent-Message-Id: <199508120150.SAA05687@freefall.FreeBSD.org> Resent-From: gnats (GNATS Management) Resent-To: freebsd-bugs Resent-Reply-To: FreeBSD-gnats@freefall.FreeBSD.org, gordon@sneaky.lonestar.org Received: from news.onramp.net (news.onramp.net [199.1.11.7]) by freefall.FreeBSD.org (8.6.11/8.6.6) with ESMTP id SAA05560 for ; Fri, 11 Aug 1995 18:48:37 -0700 Received: from rwsys!sneaky.lonestar.org (uucp@localhost) by news.onramp.net (8.6.12/8.6.9) with UUCP id UAA05793 for FreeBSD-gnats-submit@freebsd.org; Fri, 11 Aug 1995 20:48:35 -0500 Received: by lerami.lerctr.org (/\oo/\ Smail3.1.29.1 #29.2) id ; Fri, 11 Aug 95 20:41 CDT Received: by rwsys.lonestar.org (Smail3.1.27.1 #1) id m0sh54Y-00007mC; Fri, 11 Aug 95 20:09 CDT Received: by hammy.lonestar.org (Smail3.1.29.1 #1) id m0sh3Bs-0001hRC; Fri, 11 Aug 95 18:08 CDT Message-Id: Date: Fri, 11 Aug 95 18:08 CDT From: gordon@sneaky.lonestar.org Reply-To: gordon@sneaky.lonestar.org To: FreeBSD-gnats-submit@freebsd.org X-Send-Pr-Version: 3.2 Subject: bin/675: make does unnecessary rebuilds starting with FreeBSD 2.0R Sender: bugs-owner@freebsd.org Precedence: bulk >Number: 675 >Category: bin >Synopsis: make does unnecessary rebuilds >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-bugs >State: open >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Fri Aug 11 18:50:01 PDT 1995 >Last-Modified: >Originator: Gordon Burditt >Organization: what organization? >Release: FreeBSD 2.0-BUILT-19950603 i386 >Environment: FreeBSD 2.0.5R >Description: When make encounters a rule that may or may not update the target, it considers the target modified whether it actually is or not, and forces recompiles of everything that depends on that target. This behavior is new starting with 2.0; 1.1R and 1.1.5.1R forced recompiles of everything that depends on that target only if it was actually modified. The makefile attached below builds a program, and the only thing unusual about it is the use of cproto to automatically build a prototype file included by all source files. The header file is only modified if the prototypes actually change. Recompilation of everything is needed only if proto.h is touched. Is there any way to get the behavior I want? >How-To-Repeat: Create an empty directory (preferably on a non-NFS filesystem) with the attached Makefile, a.c, b.c, and c.c files in it. Do a make, which will build the program. Touch c.c. Do another make. Recompiling c.c is necessary, but recompiling a.c and b.c is not. 2.0R and 2.0.5R make recompile everything; 1.1R and 1.1.5.1R recompile only c.c. Makefile: _______________________________ all: prog prog: a.o b.o c.o $(CC) -o prog a.o b.o c.o proto.h: proto.tmp -if cmp proto.tmp proto.h; then : ; else cp proto.tmp proto.h; fi proto.tmp: a.c b.c c.c cproto a.c b.c c.c > proto.tmp # This would normally go in .depend a.o: proto.h a.c b.o: proto.h b.c c.o: proto.h c.c _______________________________ a.c: _______________________________ # include "proto.h" void a(void) { puts("hello"); } _______________________________ b.c: _______________________________ # include "proto.h" void b(void) { puts("world"); } _______________________________ c.c: _______________________________ # include "proto.h" int main(void) { a(); b(); return 0; } _______________________________ Note: if you don't have cproto, for the purpose of this test you can replace it with "grep frobnicate". Comments in the make source near "RECHECK" in compat.c and make.c discuss this problem. The obvious fix is to define RECHECK. The trouble is, RECHECK already IS defined and it still doesn't work. >Fix: >Audit-Trail: >Unformatted: