Date: Fri, 11 Aug 95 18:08 CDT From: gordon@sneaky.lonestar.org To: FreeBSD-gnats-submit@freebsd.org Subject: bin/675: make does unnecessary rebuilds starting with FreeBSD 2.0R Message-ID: <m0sh3Bs-0001hRC@hammy.lonestar.org> Resent-Message-ID: <199508120150.SAA05687@freefall.FreeBSD.org>
next in thread | raw e-mail | index | archive | help
>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:
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?m0sh3Bs-0001hRC>