From owner-svn-src-head@FreeBSD.ORG Tue Apr 7 19:49:38 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9741B1065673; Tue, 7 Apr 2009 19:49:38 +0000 (UTC) (envelope-from fjoe@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 84B3E8FC19; Tue, 7 Apr 2009 19:49:38 +0000 (UTC) (envelope-from fjoe@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n37Jncxb024496; Tue, 7 Apr 2009 19:49:38 GMT (envelope-from fjoe@svn.freebsd.org) Received: (from fjoe@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n37Jnc9g024492; Tue, 7 Apr 2009 19:49:38 GMT (envelope-from fjoe@svn.freebsd.org) Message-Id: <200904071949.n37Jnc9g024492@svn.freebsd.org> From: Max Khon Date: Tue, 7 Apr 2009 19:49:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r190821 - head/usr.bin/make X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 07 Apr 2009 19:49:39 -0000 Author: fjoe Date: Tue Apr 7 19:49:38 2009 New Revision: 190821 URL: http://svn.freebsd.org/changeset/base/190821 Log: Avoid infinite loops when remaking makefiles not only for Makefile targets but also for targets they depend on. Modified: head/usr.bin/make/globals.h head/usr.bin/make/main.c head/usr.bin/make/make.1 head/usr.bin/make/make.c Modified: head/usr.bin/make/globals.h ============================================================================== --- head/usr.bin/make/globals.h Tue Apr 7 19:44:06 2009 (r190820) +++ head/usr.bin/make/globals.h Tue Apr 7 19:49:38 2009 (r190821) @@ -81,6 +81,7 @@ extern Boolean noExecute; /* True if sho extern Boolean allPrecious; /* True if every target is precious */ extern Boolean is_posix; /* .POSIX target seen */ extern Boolean mfAutoDeps; /* .MAKEFILEDEPS target seen */ +extern Boolean remakingMakefiles; /* True if remaking makefiles is in progress */ /* True if should continue on unaffected portions of the graph * when have an error in one portion */ Modified: head/usr.bin/make/main.c ============================================================================== --- head/usr.bin/make/main.c Tue Apr 7 19:44:06 2009 (r190820) +++ head/usr.bin/make/main.c Tue Apr 7 19:49:38 2009 (r190821) @@ -124,6 +124,7 @@ Lst create = Lst_Initializer(create); Boolean allPrecious; /* .PRECIOUS given on line by itself */ Boolean is_posix; /* .POSIX target seen */ Boolean mfAutoDeps; /* .MAKEFILEDEPS target seen */ +Boolean remakingMakefiles; /* True if remaking makefiles is in progress */ Boolean beSilent; /* -s flag */ Boolean beVerbose; /* -v flag */ Boolean beQuiet; /* -Q flag */ @@ -732,41 +733,6 @@ Remake_Makefiles(void) Suff_FindDeps(gn); /* - * ! dependencies as well as - * dependencies with .FORCE, .EXEC and .PHONY attributes - * are skipped to prevent infinite loops - */ - if (gn->type & (OP_FORCE | OP_EXEC | OP_PHONY)) { - DEBUGF(MAKE, ("skipping (force, exec or phony).\n", - gn->name)); - continue; - } - - /* - * Skip :: targets that have commands and no children - * because such targets are always out-of-date - */ - if ((gn->type & OP_DOUBLEDEP) && - !Lst_IsEmpty(&gn->commands) && - Lst_IsEmpty(&gn->children)) { - DEBUGF(MAKE, ("skipping (doubledep, no sources " - "and has commands).\n")); - continue; - } - - /* - * Skip targets without sources and without commands - */ - if (Lst_IsEmpty(&gn->commands) && - Lst_IsEmpty(&gn->children)) { - DEBUGF(MAKE, - ("skipping (no sources and no commands).\n")); - continue; - } - - DEBUGF(MAKE, ("\n")); - - /* * -t, -q and -n has no effect unless the makefile is * specified as one of the targets explicitly in the * command line @@ -787,7 +753,9 @@ Remake_Makefiles(void) * Check and remake the makefile */ mtime = Dir_MTime(gn); + remakingMakefiles = TRUE; Compat_Make(gn, gn); + remakingMakefiles = FALSE; /* * Restore -t, -q and -n behaviour Modified: head/usr.bin/make/make.1 ============================================================================== --- head/usr.bin/make/make.1 Tue Apr 7 19:44:06 2009 (r190820) +++ head/usr.bin/make/make.1 Tue Apr 7 19:49:38 2009 (r190821) @@ -1629,7 +1629,7 @@ To prevent infinite loops the following .Bl -bullet .It .Ic :: -targets that have no prerequisites but have commands +targets that have no prerequisites .It .Ic ! targets Modified: head/usr.bin/make/make.c ============================================================================== --- head/usr.bin/make/make.c Tue Apr 7 19:44:06 2009 (r190820) +++ head/usr.bin/make/make.c Tue Apr 7 19:49:38 2009 (r190821) @@ -211,11 +211,15 @@ Make_OODate(GNode *gn) } else { DEBUGF(MAKE, (".EXEC node...")); } - oodate = TRUE; - } else if ((gn->mtime < gn->cmtime) || - ((gn->cmtime == 0) && - ((gn->mtime==0) || (gn->type & OP_DOUBLEDEP)))) { + if (remakingMakefiles) { + DEBUGF(MAKE, ("skipping (remaking makefiles)...")); + oodate = FALSE; + } else { + oodate = TRUE; + } + } else if (gn->mtime < gn->cmtime || + (gn->cmtime == 0 && (gn->mtime == 0 || (gn->type & OP_DOUBLEDEP)))) { /* * A node whose modification time is less than that of its * youngest child or that has no children (cmtime == 0) and @@ -226,12 +230,24 @@ Make_OODate(GNode *gn) if (gn->mtime < gn->cmtime) { DEBUGF(MAKE, ("modified before source (%s)...", gn->cmtime_gn ? gn->cmtime_gn->path : "???")); + oodate = TRUE; } else if (gn->mtime == 0) { DEBUGF(MAKE, ("non-existent and no sources...")); + if (remakingMakefiles && Lst_IsEmpty(&gn->commands)) { + DEBUGF(MAKE, ("skipping (no commands and remaking makefiles)...")); + oodate = FALSE; + } else { + oodate = TRUE; + } } else { DEBUGF(MAKE, (":: operator and no sources...")); + if (remakingMakefiles) { + DEBUGF(MAKE, ("skipping (remaking makefiles)...")); + oodate = FALSE; + } else { + oodate = TRUE; + } } - oodate = TRUE; } else oodate = FALSE;