From unknown Sun Jun 22 07:51:23 2025 X-Loop: help-debbugs@gnu.org Subject: bug#64743: Speed up GNU make's internal processing Resent-From: Bruno Haible Original-Sender: "Debbugs-submit" Resent-CC: bug-automake@gnu.org Resent-Date: Thu, 20 Jul 2023 14:09:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 64743 X-GNU-PR-Package: automake X-GNU-PR-Keywords: To: 64743@debbugs.gnu.org Cc: Paul Smith X-Debbugs-Original-To: bug-automake@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.168986209011774 (code B ref -1); Thu, 20 Jul 2023 14:09:02 +0000 Received: (at submit) by debbugs.gnu.org; 20 Jul 2023 14:08:10 +0000 Received: from localhost ([127.0.0.1]:59361 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qMUKA-00033q-7q for submit@debbugs.gnu.org; Thu, 20 Jul 2023 10:08:10 -0400 Received: from lists.gnu.org ([2001:470:142::17]:59242) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qMUK7-00033S-3Z for submit@debbugs.gnu.org; Thu, 20 Jul 2023 10:08:08 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qMUK1-0006Fn-Iq for bug-automake@gnu.org; Thu, 20 Jul 2023 10:08:01 -0400 Received: from mo4-p01-ob.smtp.rzone.de ([85.215.255.52]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qMUJy-0007vB-UG; Thu, 20 Jul 2023 10:08:01 -0400 ARC-Seal: i=1; a=rsa-sha256; t=1689862074; cv=none; d=strato.com; s=strato-dkim-0002; b=Xkw5I+QyjVDRnva09jniOanlQV/xIO1ZHQ5D+fEwqDei1cpWgEjmrAup0Nhn6c7LMg 0mmfYmFROdxq/I74adw0IfcmK3yxpywJkDnYHn3MK9UQQSpODK4lhtLqUYGdezKYwqrK 7M6CxOO6H3eOFCO0jf3exPmle5O4KGDYFM3fq+gANMkFe13XW5k+AcwJJ2YDdPq3UO46 8EBJVKwvwgsBgomeaE8pzBQsuSpaLECCNeFkuaSy1jVuQZvcfIPniw33yp/ObBrV4EMS +uMXge/CgWK3vByr//YL+mBypDin+hC3VNzQ2jS7jht4I8UV2TIajVND9/AqnCeDfy/V oypw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; t=1689862074; s=strato-dkim-0002; d=strato.com; h=Message-ID:Date:Subject:Cc:To:From:Cc:Date:From:Subject:Sender; bh=xfl7s3UisLVW3vbD3WT5kxTGevhp7x2+EyYaH3/35j4=; b=omfOFOUCMWkOzGV042O70KOQ0IlrUVWXutuoUjAzl3GRIF9YP2dNY5oTMNTGQeJP8P 3EZXUxrFVQFayz6gbmuePoPVp5fr4y4pG/kRXQfyydoxiN4x2fLf1Ro7YYhNhGGqyT/p 5Lwj2Mdmujkaj2Nw4Dd3wFLlq0DXtTTOxerOyICf0ARFMgIyKpIW4oCuvJhpegwq9hxY vYz3ZCycRgHO7BEyUNbo2gxWl2Qe5hH9azHWwX8xaLaBOgHv035t0z4HEjwdQRvuQCiZ XVepVmWHzoJs+Qpw+OtjbTJFy5LqWq3KLdR/EMybbH9QrdrWGdXqQKciOiiv/NoEmJEb 2n3g== ARC-Authentication-Results: i=1; strato.com; arc=none; dkim=none X-RZG-CLASS-ID: mo01 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; t=1689862074; s=strato-dkim-0002; d=clisp.org; h=Message-ID:Date:Subject:Cc:To:From:Cc:Date:From:Subject:Sender; bh=xfl7s3UisLVW3vbD3WT5kxTGevhp7x2+EyYaH3/35j4=; b=ovo4BaWckJ4lA9KLNG5nRMiFrcgdtChExSQluERY8Lv2SusSnTZ9OU3WLPcnR9R0Zp +eG4DWqhVviAGK6qIwKmj5n+WUZxGSQcXrqfJI5jlxPCuEqLn32zUt7f88bPR9oIQDKS hJfsiNeTYfID/34R2W6i2l9+QHsxCx+bLl7gLj19Vw/SYFhvDqjgC3uexsmYvw/rOr6n 5h+89UL4lEbQX3g5ggiz2tOoP0fr4OJRQQOqyIfkCs0f9k5aNfIabh5RQL1oFUzc8vvO vdb6q2weg5atffUah6frt3mJo4sWO8g4fIOMZzsII0vRu3070nO2+3kfr00b31q6yflZ jMsw== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; t=1689862074; s=strato-dkim-0003; d=clisp.org; h=Message-ID:Date:Subject:Cc:To:From:Cc:Date:From:Subject:Sender; bh=xfl7s3UisLVW3vbD3WT5kxTGevhp7x2+EyYaH3/35j4=; b=VKj1JKKTKRbSBzeEk7S/eMbUCG/yFV007p+F/5d0um7w8LCsMxSO3L2u0jardhNayS SIvwCzXFcYG3illcOyAg== X-RZG-AUTH: ":Ln4Re0+Ic/6oZXR1YgKryK8brlshOcZlIWs+iCP5vnk6shH0WWb0LN8XZoH94zq68+3cfpPHj/yR9hqV3wLPyhx45bWnBk99Sw==" Received: from nimes.localnet by smtp.strato.de (RZmta 49.6.4 AUTH) with ESMTPSA id J7421fz6KE7rMZc (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256 bits)) (Client did not present a certificate); Thu, 20 Jul 2023 16:07:53 +0200 (CEST) From: Bruno Haible Date: Thu, 20 Jul 2023 16:07:53 +0200 Message-ID: <25512692.Tpi9QaYGo5@nimes> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="nextPart4260629.vtBmWVcJkq" Content-Transfer-Encoding: 7Bit Received-SPF: none client-ip=85.215.255.52; envelope-from=bruno@clisp.org; helo=mo4-p01-ob.smtp.rzone.de X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_PASS=-0.001, SPF_NONE=0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: -0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) This is a multi-part message in MIME format. --nextPart4260629.vtBmWVcJkq Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" Hi, Paul Smith, the GNU make maintainer, gives this recommendation how to disable built-in rules and thus speed up make's processing [1]: - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - My recommendation has been to disable the built-in rules directly, if you don't need them. For example you can use: .SUFFIXES: to disable most of the built in rules (this is a POSIX standard facility so it's helpful even for other versions of make). Unfortunately that doesn't fix all problems because GNU Make also has a few built-in rules that are defined using pattern rules (because suffix rules are not powerful enough). So a full list of "turn it all off" would be this: .SUFFIXES: %:: %,v %:: RCS/%,v %:: RCS/% %:: s.% %:: SCCS/s.% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - GNU Automake already emits the '.SUFFIXES:' line. To optimize things for GNU make, it should also emit the remaining part. It has no effect with non-GNU make [2]. The effect, for example in gettext's gettext-runtime/src directory, is that - The output of "make -n -d" shrinks from 11028 lines to 4928 lines. - The number of 'stat()' calls made by "make -n" shrinks from 188 to 178. (make no longer tests whether various directories have an 'RCS' or 'SCCS' subdirectory.) Patch is attached. Bruno [1] https://lists.gnu.org/archive/html/bug-make/2023-07/msg00063.html [2] https://lists.gnu.org/archive/html/bug-make/2023-07/msg00067.html --nextPart4260629.vtBmWVcJkq Content-Disposition: attachment; filename="0001-Speed-up-GNU-make-s-internal-processing.patch" Content-Transfer-Encoding: 7Bit Content-Type: text/x-patch; charset="UTF-8"; name="0001-Speed-up-GNU-make-s-internal-processing.patch" >From c8ca5b95a0c322177ba0fb55ddabc1c92fa04f10 Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Thu, 20 Jul 2023 11:50:51 +0200 Subject: [PATCH] Speed up GNU make's internal processing. Based on a recommendation by Paul Smith in . * lib/am/footer.am: Disable GNU make's internal pattern rules. * lib/Automake/Rule.pm (_conditionals_for_rule): Add special handling for these pattern rules from footer.am. (define): Likewise. * t/nodep.sh: Update test. --- lib/Automake/Rule.pm | 39 +++++++++++++++++++++++---------------- lib/am/footer.am | 11 +++++++++++ t/nodep.sh | 2 +- 3 files changed, 35 insertions(+), 17 deletions(-) diff --git a/lib/Automake/Rule.pm b/lib/Automake/Rule.pm index 9f72d2728..52ee3be4a 100644 --- a/lib/Automake/Rule.pm +++ b/lib/Automake/Rule.pm @@ -695,6 +695,9 @@ sub _conditionals_for_rule ($$$$) return $cond if !$message; # No ambiguity. + # Don't coalesce the several pattern rules from footer.am into a single one. + return $cond if $target eq "%:" && $where->get =~ /\/am\/footer\.am$/; + if ($owner == RULE_USER) { # For user rules, just diagnose the ambiguity. @@ -764,23 +767,27 @@ sub define ($$$$$) my $tdef = _rule_defn_with_exeext_awareness ($target, $cond, $where); - # A GNU make-style pattern rule has a single "%" in the target name. - msg ('portability', $where, - "'%'-style pattern rules are a GNU make extension") - if $target =~ /^[^%]*%[^%]*$/; - - # See whether this is a duplicated target declaration. - if ($tdef) + # The pattern rules in footer.am look like duplicates, but really aren't. + if ($source !~ /\/am\/footer\.am$/) { - # Diagnose invalid target redefinitions, if any. Note that some - # target redefinitions are valid (e.g., for multiple-targets - # pattern rules). - _maybe_warn_about_duplicated_target ($target, $tdef, $source, - $owner, $cond, $where); - # Return so we don't redefine the rule in our tables, don't check - # for ambiguous condition, etc. The rule will be output anyway - # because '&read_am_file' ignores the return code. - return (); + # A GNU make-style pattern rule has a single "%" in the target name. + msg ('portability', $where, + "'%'-style pattern rules are a GNU make extension") + if $target =~ /^[^%]*%[^%]*$/; + + # See whether this is a duplicated target declaration. + if ($tdef) + { + # Diagnose invalid target redefinitions, if any. Note that some + # target redefinitions are valid (e.g., for multiple-targets + # pattern rules). + _maybe_warn_about_duplicated_target ($target, $tdef, $source, + $owner, $cond, $where); + # Return so we don't redefine the rule in our tables, don't check + # for ambiguous condition, etc. The rule will be output anyway + # because '&read_am_file' ignores the return code. + return (); + } } my $rule = _crule $target; diff --git a/lib/am/footer.am b/lib/am/footer.am index 9715c826c..388defb14 100644 --- a/lib/am/footer.am +++ b/lib/am/footer.am @@ -17,3 +17,14 @@ # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: + +# Tell GNU make to disable its built-in pattern rules. +## This reduces make's internal processing. +## Recommended by Paul Smith in +## . +## These rules have no effect on non-GNU make implementations. +%:: %,v +%:: RCS/%,v +%:: RCS/% +%:: s.% +%:: SCCS/s.% diff --git a/t/nodep.sh b/t/nodep.sh index 4201c8ead..0174b838e 100644 --- a/t/nodep.sh +++ b/t/nodep.sh @@ -37,6 +37,6 @@ $ACLOCAL $AUTOMAKE sed 's/printf .*%s//' Makefile.in > Makefile.tmp -grep '%' Makefile.tmp && exit 1 +grep -v '^%::' Makefile.tmp | grep '%' && exit 1 : -- 2.34.1 --nextPart4260629.vtBmWVcJkq-- From unknown Sun Jun 22 07:51:23 2025 X-Loop: help-debbugs@gnu.org Subject: bug#64743: Speed up GNU make's internal processing Resent-From: Bruno Haible Original-Sender: "Debbugs-submit" Resent-CC: bug-automake@gnu.org Resent-Date: Thu, 20 Jul 2023 21:58:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 64743 X-GNU-PR-Package: automake X-GNU-PR-Keywords: To: 64743@debbugs.gnu.org Cc: Paul Smith X-Debbugs-Original-To: bug-automake@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.168989024210043 (code B ref -1); Thu, 20 Jul 2023 21:58:01 +0000 Received: (at submit) by debbugs.gnu.org; 20 Jul 2023 21:57:22 +0000 Received: from localhost ([127.0.0.1]:60138 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qMbeD-0002bu-Rc for submit@debbugs.gnu.org; Thu, 20 Jul 2023 17:57:22 -0400 Received: from lists.gnu.org ([2001:470:142::17]:57708) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qMbeA-0002bg-Um for submit@debbugs.gnu.org; Thu, 20 Jul 2023 17:57:20 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qMbe5-0004Pn-HP for bug-automake@gnu.org; Thu, 20 Jul 2023 17:57:13 -0400 Received: from mo4-p00-ob.smtp.rzone.de ([81.169.146.160]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qMbe2-00033A-Oo; Thu, 20 Jul 2023 17:57:13 -0400 ARC-Seal: i=1; a=rsa-sha256; t=1689890228; cv=none; d=strato.com; s=strato-dkim-0002; b=KoguljoBCF0XHjg5bLWM0W8MVty5Oyh5B0GOmejfonqEYo5Wpra59N8hd1jx8x9fGO LO5hO52rB20W47YL8kAySL59jrpDtmgHtwlEaLA0zuGwBvctFCpIOHSt3kwz+dj80RnZ nVMTOmmnZ+Y7BGEQYPLlKAyk5Zw14iJnZoHOkSl53Hj77Sux4fF0O1dneWuZDaCnUhaF uMEsSQJM1mm3KN1HMAGVNmX9j8z3Ka/SxF6w0rhoGfXmLbeywBmbJtKhjgvLZByjCYvo XjdGLf7+CBrK1g1rg5J40nZyD5MdN0hS2hwyG3+D+fL3gnXq+3JtarXLjFzRKonHJCMF EKoA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; t=1689890228; s=strato-dkim-0002; d=strato.com; h=References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From:Cc:Date: From:Subject:Sender; bh=a/df7/ixz3a/k4rDcxnFliX8tN54myxVpZGznyJ2bG0=; b=KL+xcuvAImJace3d+9pgpXj5zw3BPHrWNVfo7cjY4HrVOpEIFJbo/rS3zFPuDM9yPW 0Yn3Wr1TCTpMarhE4iMd6FEMcrJkKgNTJsZqzoP0PbUXf+RVg/ph1mVxkKWjnVyxu1Rg 7uhs2M5C63CTtyvACDXK1booZxdpGtm4GwZdzJ9jKBo3Ug9oSo2P+GsFSq2dwcs3imEM Ff+KZbel56sdze3Kc+J0AqY4oZKw6choqRfhzd6eVxyoPdGg343ClUYVrtcRYkwD3X4O sr+XIfe35bxIzRhmyE3Sb9dgpTKGL4GJGu/UmUZ0D+e2ml5BJlbL5d72VuMib/6xz07G KcJw== ARC-Authentication-Results: i=1; strato.com; arc=none; dkim=none X-RZG-CLASS-ID: mo00 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; t=1689890228; s=strato-dkim-0002; d=clisp.org; h=References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From:Cc:Date: From:Subject:Sender; bh=a/df7/ixz3a/k4rDcxnFliX8tN54myxVpZGznyJ2bG0=; b=S2jnigNon+aczxS0lDSnVS83umDQkn5ynbViQ8fe/fMxrRon/gzjBkGjSv5adrZNqU Sa2rQQ1+7gIhOo9OGCAdAsRgWnYiwDsc279ryGxBpUL9wFPHk+PmX3C42Men0fortvty xMrze1voYETz2ikx/GbRLQrG1WehCQC+CDAfeelmioR5ommkm6TYMc9XF3JR/+wqellX M0jT3dQLOMqrbikRp3uh7nJ1oISFjAwK0HFufRpJhK9/4k4KaeKbfePnRPCUickQYJHF 2EJ5+3DxzE+G+9Sceea9Vg9/Z8jUJK9bB8UVDMLkyY5j3I5NuuTsQRGTs9MqvHUIlf20 CEuw== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; t=1689890228; s=strato-dkim-0003; d=clisp.org; h=References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From:Cc:Date: From:Subject:Sender; bh=a/df7/ixz3a/k4rDcxnFliX8tN54myxVpZGznyJ2bG0=; b=lok5RKSy/YlaAJweoV8LyS2QxvCVC+FFAgnDa6BGdzLBmQFxii9B57dceiAJHvqcpP mMYli8eGlZKA/6Mlt6Bg== X-RZG-AUTH: ":Ln4Re0+Ic/6oZXR1YgKryK8brlshOcZlIWs+iCP5vnk6shH0WWb0LN8XZoH94zq68+3cfpPHj/yR9hqV3wLPyhx45bWnBk99Sw==" Received: from nimes.localnet by smtp.strato.de (RZmta 49.6.4 AUTH) with ESMTPSA id J7421fz6KLv8VAr (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256 bits)) (Client did not present a certificate); Thu, 20 Jul 2023 23:57:08 +0200 (CEST) From: Bruno Haible Date: Thu, 20 Jul 2023 23:57:07 +0200 Message-ID: <12273631.vMQnmyANaQ@nimes> In-Reply-To: <25512692.Tpi9QaYGo5@nimes> References: <25512692.Tpi9QaYGo5@nimes> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="nextPart9123617.V6f25PfBSd" Content-Transfer-Encoding: 7Bit Received-SPF: none client-ip=81.169.146.160; envelope-from=bruno@clisp.org; helo=mo4-p00-ob.smtp.rzone.de X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_PASS=-0.001, SPF_NONE=0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: -0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) This is a multi-part message in MIME format. --nextPart9123617.V6f25PfBSd Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" > Patch is attached. Here's a corrected patch. (Fixed another test failure.) --nextPart9123617.V6f25PfBSd Content-Disposition: attachment; filename="0001-Speed-up-GNU-make-s-internal-processing.patch" Content-Transfer-Encoding: 7Bit Content-Type: text/x-patch; charset="UTF-8"; name="0001-Speed-up-GNU-make-s-internal-processing.patch" >From e480457f90748d31601e224ee8d75f766c1a53d6 Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Thu, 20 Jul 2023 11:50:51 +0200 Subject: [PATCH] Speed up GNU make's internal processing. Based on a recommendation by Paul Smith in . * lib/am/footer.am: Disable GNU make's internal pattern rules. * lib/Automake/Rule.pm (_conditionals_for_rule): Add special handling for these pattern rules from footer.am. (define): Likewise. * t/fnoc.sh: Update test. * t/nodep.sh: Update test. --- lib/Automake/Rule.pm | 39 +++++++++++++++++++++++---------------- lib/am/footer.am | 11 +++++++++++ t/fnoc.sh | 2 +- t/nodep.sh | 2 +- 4 files changed, 36 insertions(+), 18 deletions(-) diff --git a/lib/Automake/Rule.pm b/lib/Automake/Rule.pm index 9f72d2728..52ee3be4a 100644 --- a/lib/Automake/Rule.pm +++ b/lib/Automake/Rule.pm @@ -695,6 +695,9 @@ sub _conditionals_for_rule ($$$$) return $cond if !$message; # No ambiguity. + # Don't coalesce the several pattern rules from footer.am into a single one. + return $cond if $target eq "%:" && $where->get =~ /\/am\/footer\.am$/; + if ($owner == RULE_USER) { # For user rules, just diagnose the ambiguity. @@ -764,23 +767,27 @@ sub define ($$$$$) my $tdef = _rule_defn_with_exeext_awareness ($target, $cond, $where); - # A GNU make-style pattern rule has a single "%" in the target name. - msg ('portability', $where, - "'%'-style pattern rules are a GNU make extension") - if $target =~ /^[^%]*%[^%]*$/; - - # See whether this is a duplicated target declaration. - if ($tdef) + # The pattern rules in footer.am look like duplicates, but really aren't. + if ($source !~ /\/am\/footer\.am$/) { - # Diagnose invalid target redefinitions, if any. Note that some - # target redefinitions are valid (e.g., for multiple-targets - # pattern rules). - _maybe_warn_about_duplicated_target ($target, $tdef, $source, - $owner, $cond, $where); - # Return so we don't redefine the rule in our tables, don't check - # for ambiguous condition, etc. The rule will be output anyway - # because '&read_am_file' ignores the return code. - return (); + # A GNU make-style pattern rule has a single "%" in the target name. + msg ('portability', $where, + "'%'-style pattern rules are a GNU make extension") + if $target =~ /^[^%]*%[^%]*$/; + + # See whether this is a duplicated target declaration. + if ($tdef) + { + # Diagnose invalid target redefinitions, if any. Note that some + # target redefinitions are valid (e.g., for multiple-targets + # pattern rules). + _maybe_warn_about_duplicated_target ($target, $tdef, $source, + $owner, $cond, $where); + # Return so we don't redefine the rule in our tables, don't check + # for ambiguous condition, etc. The rule will be output anyway + # because '&read_am_file' ignores the return code. + return (); + } } my $rule = _crule $target; diff --git a/lib/am/footer.am b/lib/am/footer.am index 9715c826c..388defb14 100644 --- a/lib/am/footer.am +++ b/lib/am/footer.am @@ -17,3 +17,14 @@ # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: + +# Tell GNU make to disable its built-in pattern rules. +## This reduces make's internal processing. +## Recommended by Paul Smith in +## . +## These rules have no effect on non-GNU make implementations. +%:: %,v +%:: RCS/%,v +%:: RCS/% +%:: s.% +%:: SCCS/s.% diff --git a/t/fnoc.sh b/t/fnoc.sh index 97b694c63..77119a21a 100644 --- a/t/fnoc.sh +++ b/t/fnoc.sh @@ -35,5 +35,5 @@ END $ACLOCAL $AUTOMAKE -grep '[^F]CC' Makefile.in | grep -v MKDEP && exit 1 +grep '[^FS]CC' Makefile.in | grep -v MKDEP && exit 1 exit 0 diff --git a/t/nodep.sh b/t/nodep.sh index 4201c8ead..0174b838e 100644 --- a/t/nodep.sh +++ b/t/nodep.sh @@ -37,6 +37,6 @@ $ACLOCAL $AUTOMAKE sed 's/printf .*%s//' Makefile.in > Makefile.tmp -grep '%' Makefile.tmp && exit 1 +grep -v '^%::' Makefile.tmp | grep '%' && exit 1 : -- 2.34.1 --nextPart9123617.V6f25PfBSd-- From unknown Sun Jun 22 07:51:23 2025 X-Loop: help-debbugs@gnu.org Subject: bug#64743: Speed up GNU make's internal processing References: <25512692.Tpi9QaYGo5@nimes> Resent-From: Karl Berry Original-Sender: "Debbugs-submit" Resent-CC: bug-automake@gnu.org Resent-Date: Fri, 21 Jul 2023 01:05:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 64743 X-GNU-PR-Package: automake X-GNU-PR-Keywords: To: bruno@clisp.org Cc: 64743@debbugs.gnu.org, psmith@gnu.org Received: via spool by 64743-submit@debbugs.gnu.org id=B64743.16899014448229 (code B ref 64743); Fri, 21 Jul 2023 01:05:01 +0000 Received: (at 64743) by debbugs.gnu.org; 21 Jul 2023 01:04:04 +0000 Received: from localhost ([127.0.0.1]:60225 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qMeYt-00028b-Tk for submit@debbugs.gnu.org; Thu, 20 Jul 2023 21:04:04 -0400 Received: from frenzy.freefriends.org ([198.99.81.75]:57438 helo=freefriends.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qMeYo-000281-HX; Thu, 20 Jul 2023 21:04:02 -0400 X-Envelope-From: karl@freefriends.org Received: from freefriends.org (localhost [127.0.0.1]) by freefriends.org (8.14.7/8.14.7) with ESMTP id 36L13qxZ019529 (version=TLSv1/SSLv3 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 20 Jul 2023 19:03:52 -0600 Received: (from apache@localhost) by freefriends.org (8.14.7/8.14.7/Submit) id 36L13qYh019528; Thu, 20 Jul 2023 19:03:52 -0600 Date: Thu, 20 Jul 2023 19:03:52 -0600 Message-Id: <202307210103.36L13qYh019528@freefriends.org> From: Karl Berry In-Reply-To: <25512692.Tpi9QaYGo5@nimes> X-Spam-Score: -0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Hi Bruno, GNU Automake already emits the '.SUFFIXES:' line. To optimize things for GNU make, it should also emit the remaining part. Ok. I just hope those weird-looking %:: rules do not cause trouble with other makes. I guess we'll find out. The fnoc test also failed due to the new rules. I fixed that, added a few words of documentation and NEWS, and pushed it. Thanks Bruno. -k 2023-07-20 Bruno Haible automake: disable GNU make's internal pattern rules, for speed. >From https://bugs.gnu.org/64743. * lib/am/footer.am: Disable GNU make's internal pattern rules. * lib/Automake/Rule.pm (_conditionals_for_rule): Add special handling for these pattern rules from footer.am. (define): Likewise. * t/nodep.sh: Update test to avoid matching the new %:: rules. * t/fnoc.sh: Update test to avoid matching the new %:: SCCS rule. * NEWS: Mention this. * doc/automake.texi (Suffixes): Likewise. (Doc changes written by Karl.) diff --git a/NEWS b/NEWS index c64d4ef15..ced0fd640 100644 --- a/NEWS +++ b/NEWS @@ -21,6 +21,9 @@ New in 1.17: - Variables using escaped \# will trigger portability warnings, but be retained when appended. GNU Make & BSD Makes are known to support it. + - GNU Make's default pattern rules are disabled, for speed and debugging. + (.SUFFIXES was already cleared.) (bug#64743) + - For Texinfo documents, if a .texi.in file exists, but no .texi, the .texi.in will be read. Texinfo source files need not be present at all, and if present, need not contain @setfilename. Then the file name diff --git a/doc/automake.texi b/doc/automake.texi index 4561d1948..3b4f06e73 100644 --- a/doc/automake.texi +++ b/doc/automake.texi @@ -10977,6 +10977,14 @@ Automake generate the suffix list for @code{.SUFFIXES}. Any given @code{SUFFIXES} go at the start of the generated suffixes list, followed by Automake generated suffixes not already in the list. +@c https://bugs.gnu.org/64743. +@cindex built-in suffix and pattern rules, disabled +@cindex suffix rules of Make, disabled +@cindex pattern rules of GNU Make, disabled +Automake disables the Make program's built-in rules with a +@code{.SUFFIXES:} rule, and then adds whatever suffixes are +necessary. Automake also disables GNU Make's built-in pattern rules. + @node Include @chapter Include diff --git a/lib/Automake/Rule.pm b/lib/Automake/Rule.pm index 9f72d2728..52ee3be4a 100644 --- a/lib/Automake/Rule.pm +++ b/lib/Automake/Rule.pm @@ -695,6 +695,9 @@ sub _conditionals_for_rule ($$$$) return $cond if !$message; # No ambiguity. + # Don't coalesce the several pattern rules from footer.am into a single one. + return $cond if $target eq "%:" && $where->get =~ /\/am\/footer\.am$/; + if ($owner == RULE_USER) { # For user rules, just diagnose the ambiguity. @@ -764,23 +767,27 @@ sub define ($$$$$) my $tdef = _rule_defn_with_exeext_awareness ($target, $cond, $where); - # A GNU make-style pattern rule has a single "%" in the target name. - msg ('portability', $where, - "'%'-style pattern rules are a GNU make extension") - if $target =~ /^[^%]*%[^%]*$/; - - # See whether this is a duplicated target declaration. - if ($tdef) + # The pattern rules in footer.am look like duplicates, but really aren't. + if ($source !~ /\/am\/footer\.am$/) { - # Diagnose invalid target redefinitions, if any. Note that some - # target redefinitions are valid (e.g., for multiple-targets - # pattern rules). - _maybe_warn_about_duplicated_target ($target, $tdef, $source, - $owner, $cond, $where); - # Return so we don't redefine the rule in our tables, don't check - # for ambiguous condition, etc. The rule will be output anyway - # because '&read_am_file' ignores the return code. - return (); + # A GNU make-style pattern rule has a single "%" in the target name. + msg ('portability', $where, + "'%'-style pattern rules are a GNU make extension") + if $target =~ /^[^%]*%[^%]*$/; + + # See whether this is a duplicated target declaration. + if ($tdef) + { + # Diagnose invalid target redefinitions, if any. Note that some + # target redefinitions are valid (e.g., for multiple-targets + # pattern rules). + _maybe_warn_about_duplicated_target ($target, $tdef, $source, + $owner, $cond, $where); + # Return so we don't redefine the rule in our tables, don't check + # for ambiguous condition, etc. The rule will be output anyway + # because '&read_am_file' ignores the return code. + return (); + } } my $rule = _crule $target; diff --git a/lib/am/footer.am b/lib/am/footer.am index 9715c826c..388defb14 100644 --- a/lib/am/footer.am +++ b/lib/am/footer.am @@ -17,3 +17,14 @@ # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: + +# Tell GNU make to disable its built-in pattern rules. +## This reduces make's internal processing. +## Recommended by Paul Smith in +## . +## These rules have no effect on non-GNU make implementations. +%:: %,v +%:: RCS/%,v +%:: RCS/% +%:: s.% +%:: SCCS/s.% diff --git a/t/fnoc.sh b/t/fnoc.sh index 97b694c63..7d6b49096 100644 --- a/t/fnoc.sh +++ b/t/fnoc.sh @@ -35,5 +35,10 @@ END $ACLOCAL $AUTOMAKE -grep '[^F]CC' Makefile.in | grep -v MKDEP && exit 1 +# In bug#64743, explicit rules were added to disable make's default +# built-in rules, including one for SCCS: +# %:: SCCS/s.% +# So don't match that. Meanwhile, MKDEP does not occur in the output +# any more, but leaving it in in case it comes back. +grep '[^F]CC' Makefile.in | grep -v MKDEP | grep -v SCCS && exit 1 exit 0 diff --git a/t/nodep.sh b/t/nodep.sh index 4201c8ead..0174b838e 100644 --- a/t/nodep.sh +++ b/t/nodep.sh @@ -37,6 +37,6 @@ $ACLOCAL $AUTOMAKE sed 's/printf .*%s//' Makefile.in > Makefile.tmp -grep '%' Makefile.tmp && exit 1 +grep -v '^%::' Makefile.tmp | grep '%' && exit 1 : compile finished at Thu Jul 20 18:00:35 2023 From unknown Sun Jun 22 07:51:23 2025 MIME-Version: 1.0 X-Mailer: MIME-tools 5.505 (Entity 5.505) X-Loop: help-debbugs@gnu.org From: help-debbugs@gnu.org (GNU bug Tracking System) To: Bruno Haible Subject: bug#64743: closed (Re: bug#64743: Speed up GNU make's internal processing) Message-ID: References: <202307210103.36L13qYh019528@freefriends.org> <25512692.Tpi9QaYGo5@nimes> X-Gnu-PR-Message: they-closed 64743 X-Gnu-PR-Package: automake Reply-To: 64743@debbugs.gnu.org Date: Fri, 21 Jul 2023 01:05:02 +0000 Content-Type: multipart/mixed; boundary="----------=_1689901502-8316-1" This is a multi-part message in MIME format... ------------=_1689901502-8316-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Your bug report #64743: Speed up GNU make's internal processing which was filed against the automake package, has been closed. The explanation is attached below, along with your original report. If you require more details, please reply to 64743@debbugs.gnu.org. --=20 64743: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D64743 GNU Bug Tracking System Contact help-debbugs@gnu.org with problems ------------=_1689901502-8316-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at 64743-done) by debbugs.gnu.org; 21 Jul 2023 01:04:04 +0000 Received: from localhost ([127.0.0.1]:60223 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qMeYt-00028X-83 for submit@debbugs.gnu.org; Thu, 20 Jul 2023 21:04:03 -0400 Received: from frenzy.freefriends.org ([198.99.81.75]:57438 helo=freefriends.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qMeYo-000281-HX; Thu, 20 Jul 2023 21:04:02 -0400 X-Envelope-From: karl@freefriends.org Received: from freefriends.org (localhost [127.0.0.1]) by freefriends.org (8.14.7/8.14.7) with ESMTP id 36L13qxZ019529 (version=TLSv1/SSLv3 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 20 Jul 2023 19:03:52 -0600 Received: (from apache@localhost) by freefriends.org (8.14.7/8.14.7/Submit) id 36L13qYh019528; Thu, 20 Jul 2023 19:03:52 -0600 Date: Thu, 20 Jul 2023 19:03:52 -0600 Message-Id: <202307210103.36L13qYh019528@freefriends.org> From: Karl Berry To: bruno@clisp.org Subject: Re: bug#64743: Speed up GNU make's internal processing In-Reply-To: <25512692.Tpi9QaYGo5@nimes> X-Spam-Score: -0.0 (/) X-Debbugs-Envelope-To: 64743-done Cc: 64743@debbugs.gnu.org, psmith@gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Hi Bruno, GNU Automake already emits the '.SUFFIXES:' line. To optimize things for GNU make, it should also emit the remaining part. Ok. I just hope those weird-looking %:: rules do not cause trouble with other makes. I guess we'll find out. The fnoc test also failed due to the new rules. I fixed that, added a few words of documentation and NEWS, and pushed it. Thanks Bruno. -k 2023-07-20 Bruno Haible automake: disable GNU make's internal pattern rules, for speed. >From https://bugs.gnu.org/64743. * lib/am/footer.am: Disable GNU make's internal pattern rules. * lib/Automake/Rule.pm (_conditionals_for_rule): Add special handling for these pattern rules from footer.am. (define): Likewise. * t/nodep.sh: Update test to avoid matching the new %:: rules. * t/fnoc.sh: Update test to avoid matching the new %:: SCCS rule. * NEWS: Mention this. * doc/automake.texi (Suffixes): Likewise. (Doc changes written by Karl.) diff --git a/NEWS b/NEWS index c64d4ef15..ced0fd640 100644 --- a/NEWS +++ b/NEWS @@ -21,6 +21,9 @@ New in 1.17: - Variables using escaped \# will trigger portability warnings, but be retained when appended. GNU Make & BSD Makes are known to support it. + - GNU Make's default pattern rules are disabled, for speed and debugging. + (.SUFFIXES was already cleared.) (bug#64743) + - For Texinfo documents, if a .texi.in file exists, but no .texi, the .texi.in will be read. Texinfo source files need not be present at all, and if present, need not contain @setfilename. Then the file name diff --git a/doc/automake.texi b/doc/automake.texi index 4561d1948..3b4f06e73 100644 --- a/doc/automake.texi +++ b/doc/automake.texi @@ -10977,6 +10977,14 @@ Automake generate the suffix list for @code{.SUFFIXES}. Any given @code{SUFFIXES} go at the start of the generated suffixes list, followed by Automake generated suffixes not already in the list. +@c https://bugs.gnu.org/64743. +@cindex built-in suffix and pattern rules, disabled +@cindex suffix rules of Make, disabled +@cindex pattern rules of GNU Make, disabled +Automake disables the Make program's built-in rules with a +@code{.SUFFIXES:} rule, and then adds whatever suffixes are +necessary. Automake also disables GNU Make's built-in pattern rules. + @node Include @chapter Include diff --git a/lib/Automake/Rule.pm b/lib/Automake/Rule.pm index 9f72d2728..52ee3be4a 100644 --- a/lib/Automake/Rule.pm +++ b/lib/Automake/Rule.pm @@ -695,6 +695,9 @@ sub _conditionals_for_rule ($$$$) return $cond if !$message; # No ambiguity. + # Don't coalesce the several pattern rules from footer.am into a single one. + return $cond if $target eq "%:" && $where->get =~ /\/am\/footer\.am$/; + if ($owner == RULE_USER) { # For user rules, just diagnose the ambiguity. @@ -764,23 +767,27 @@ sub define ($$$$$) my $tdef = _rule_defn_with_exeext_awareness ($target, $cond, $where); - # A GNU make-style pattern rule has a single "%" in the target name. - msg ('portability', $where, - "'%'-style pattern rules are a GNU make extension") - if $target =~ /^[^%]*%[^%]*$/; - - # See whether this is a duplicated target declaration. - if ($tdef) + # The pattern rules in footer.am look like duplicates, but really aren't. + if ($source !~ /\/am\/footer\.am$/) { - # Diagnose invalid target redefinitions, if any. Note that some - # target redefinitions are valid (e.g., for multiple-targets - # pattern rules). - _maybe_warn_about_duplicated_target ($target, $tdef, $source, - $owner, $cond, $where); - # Return so we don't redefine the rule in our tables, don't check - # for ambiguous condition, etc. The rule will be output anyway - # because '&read_am_file' ignores the return code. - return (); + # A GNU make-style pattern rule has a single "%" in the target name. + msg ('portability', $where, + "'%'-style pattern rules are a GNU make extension") + if $target =~ /^[^%]*%[^%]*$/; + + # See whether this is a duplicated target declaration. + if ($tdef) + { + # Diagnose invalid target redefinitions, if any. Note that some + # target redefinitions are valid (e.g., for multiple-targets + # pattern rules). + _maybe_warn_about_duplicated_target ($target, $tdef, $source, + $owner, $cond, $where); + # Return so we don't redefine the rule in our tables, don't check + # for ambiguous condition, etc. The rule will be output anyway + # because '&read_am_file' ignores the return code. + return (); + } } my $rule = _crule $target; diff --git a/lib/am/footer.am b/lib/am/footer.am index 9715c826c..388defb14 100644 --- a/lib/am/footer.am +++ b/lib/am/footer.am @@ -17,3 +17,14 @@ # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: + +# Tell GNU make to disable its built-in pattern rules. +## This reduces make's internal processing. +## Recommended by Paul Smith in +## . +## These rules have no effect on non-GNU make implementations. +%:: %,v +%:: RCS/%,v +%:: RCS/% +%:: s.% +%:: SCCS/s.% diff --git a/t/fnoc.sh b/t/fnoc.sh index 97b694c63..7d6b49096 100644 --- a/t/fnoc.sh +++ b/t/fnoc.sh @@ -35,5 +35,10 @@ END $ACLOCAL $AUTOMAKE -grep '[^F]CC' Makefile.in | grep -v MKDEP && exit 1 +# In bug#64743, explicit rules were added to disable make's default +# built-in rules, including one for SCCS: +# %:: SCCS/s.% +# So don't match that. Meanwhile, MKDEP does not occur in the output +# any more, but leaving it in in case it comes back. +grep '[^F]CC' Makefile.in | grep -v MKDEP | grep -v SCCS && exit 1 exit 0 diff --git a/t/nodep.sh b/t/nodep.sh index 4201c8ead..0174b838e 100644 --- a/t/nodep.sh +++ b/t/nodep.sh @@ -37,6 +37,6 @@ $ACLOCAL $AUTOMAKE sed 's/printf .*%s//' Makefile.in > Makefile.tmp -grep '%' Makefile.tmp && exit 1 +grep -v '^%::' Makefile.tmp | grep '%' && exit 1 : compile finished at Thu Jul 20 18:00:35 2023 ------------=_1689901502-8316-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at submit) by debbugs.gnu.org; 20 Jul 2023 14:08:10 +0000 Received: from localhost ([127.0.0.1]:59361 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qMUKA-00033q-7q for submit@debbugs.gnu.org; Thu, 20 Jul 2023 10:08:10 -0400 Received: from lists.gnu.org ([2001:470:142::17]:59242) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qMUK7-00033S-3Z for submit@debbugs.gnu.org; Thu, 20 Jul 2023 10:08:08 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qMUK1-0006Fn-Iq for bug-automake@gnu.org; Thu, 20 Jul 2023 10:08:01 -0400 Received: from mo4-p01-ob.smtp.rzone.de ([85.215.255.52]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qMUJy-0007vB-UG; Thu, 20 Jul 2023 10:08:01 -0400 ARC-Seal: i=1; a=rsa-sha256; t=1689862074; cv=none; d=strato.com; s=strato-dkim-0002; b=Xkw5I+QyjVDRnva09jniOanlQV/xIO1ZHQ5D+fEwqDei1cpWgEjmrAup0Nhn6c7LMg 0mmfYmFROdxq/I74adw0IfcmK3yxpywJkDnYHn3MK9UQQSpODK4lhtLqUYGdezKYwqrK 7M6CxOO6H3eOFCO0jf3exPmle5O4KGDYFM3fq+gANMkFe13XW5k+AcwJJ2YDdPq3UO46 8EBJVKwvwgsBgomeaE8pzBQsuSpaLECCNeFkuaSy1jVuQZvcfIPniw33yp/ObBrV4EMS +uMXge/CgWK3vByr//YL+mBypDin+hC3VNzQ2jS7jht4I8UV2TIajVND9/AqnCeDfy/V oypw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; t=1689862074; s=strato-dkim-0002; d=strato.com; h=Message-ID:Date:Subject:Cc:To:From:Cc:Date:From:Subject:Sender; bh=xfl7s3UisLVW3vbD3WT5kxTGevhp7x2+EyYaH3/35j4=; b=omfOFOUCMWkOzGV042O70KOQ0IlrUVWXutuoUjAzl3GRIF9YP2dNY5oTMNTGQeJP8P 3EZXUxrFVQFayz6gbmuePoPVp5fr4y4pG/kRXQfyydoxiN4x2fLf1Ro7YYhNhGGqyT/p 5Lwj2Mdmujkaj2Nw4Dd3wFLlq0DXtTTOxerOyICf0ARFMgIyKpIW4oCuvJhpegwq9hxY vYz3ZCycRgHO7BEyUNbo2gxWl2Qe5hH9azHWwX8xaLaBOgHv035t0z4HEjwdQRvuQCiZ XVepVmWHzoJs+Qpw+OtjbTJFy5LqWq3KLdR/EMybbH9QrdrWGdXqQKciOiiv/NoEmJEb 2n3g== ARC-Authentication-Results: i=1; strato.com; arc=none; dkim=none X-RZG-CLASS-ID: mo01 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; t=1689862074; s=strato-dkim-0002; d=clisp.org; h=Message-ID:Date:Subject:Cc:To:From:Cc:Date:From:Subject:Sender; bh=xfl7s3UisLVW3vbD3WT5kxTGevhp7x2+EyYaH3/35j4=; b=ovo4BaWckJ4lA9KLNG5nRMiFrcgdtChExSQluERY8Lv2SusSnTZ9OU3WLPcnR9R0Zp +eG4DWqhVviAGK6qIwKmj5n+WUZxGSQcXrqfJI5jlxPCuEqLn32zUt7f88bPR9oIQDKS hJfsiNeTYfID/34R2W6i2l9+QHsxCx+bLl7gLj19Vw/SYFhvDqjgC3uexsmYvw/rOr6n 5h+89UL4lEbQX3g5ggiz2tOoP0fr4OJRQQOqyIfkCs0f9k5aNfIabh5RQL1oFUzc8vvO vdb6q2weg5atffUah6frt3mJo4sWO8g4fIOMZzsII0vRu3070nO2+3kfr00b31q6yflZ jMsw== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; t=1689862074; s=strato-dkim-0003; d=clisp.org; h=Message-ID:Date:Subject:Cc:To:From:Cc:Date:From:Subject:Sender; bh=xfl7s3UisLVW3vbD3WT5kxTGevhp7x2+EyYaH3/35j4=; b=VKj1JKKTKRbSBzeEk7S/eMbUCG/yFV007p+F/5d0um7w8LCsMxSO3L2u0jardhNayS SIvwCzXFcYG3illcOyAg== X-RZG-AUTH: ":Ln4Re0+Ic/6oZXR1YgKryK8brlshOcZlIWs+iCP5vnk6shH0WWb0LN8XZoH94zq68+3cfpPHj/yR9hqV3wLPyhx45bWnBk99Sw==" Received: from nimes.localnet by smtp.strato.de (RZmta 49.6.4 AUTH) with ESMTPSA id J7421fz6KE7rMZc (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256 bits)) (Client did not present a certificate); Thu, 20 Jul 2023 16:07:53 +0200 (CEST) From: Bruno Haible To: bug-automake@gnu.org Subject: Speed up GNU make's internal processing Date: Thu, 20 Jul 2023 16:07:53 +0200 Message-ID: <25512692.Tpi9QaYGo5@nimes> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="nextPart4260629.vtBmWVcJkq" Content-Transfer-Encoding: 7Bit Received-SPF: none client-ip=85.215.255.52; envelope-from=bruno@clisp.org; helo=mo4-p01-ob.smtp.rzone.de X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_PASS=-0.001, SPF_NONE=0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: -0.0 (/) X-Debbugs-Envelope-To: submit Cc: Paul Smith X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) This is a multi-part message in MIME format. --nextPart4260629.vtBmWVcJkq Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" Hi, Paul Smith, the GNU make maintainer, gives this recommendation how to disable built-in rules and thus speed up make's processing [1]: - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - My recommendation has been to disable the built-in rules directly, if you don't need them. For example you can use: .SUFFIXES: to disable most of the built in rules (this is a POSIX standard facility so it's helpful even for other versions of make). Unfortunately that doesn't fix all problems because GNU Make also has a few built-in rules that are defined using pattern rules (because suffix rules are not powerful enough). So a full list of "turn it all off" would be this: .SUFFIXES: %:: %,v %:: RCS/%,v %:: RCS/% %:: s.% %:: SCCS/s.% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - GNU Automake already emits the '.SUFFIXES:' line. To optimize things for GNU make, it should also emit the remaining part. It has no effect with non-GNU make [2]. The effect, for example in gettext's gettext-runtime/src directory, is that - The output of "make -n -d" shrinks from 11028 lines to 4928 lines. - The number of 'stat()' calls made by "make -n" shrinks from 188 to 178. (make no longer tests whether various directories have an 'RCS' or 'SCCS' subdirectory.) Patch is attached. Bruno [1] https://lists.gnu.org/archive/html/bug-make/2023-07/msg00063.html [2] https://lists.gnu.org/archive/html/bug-make/2023-07/msg00067.html --nextPart4260629.vtBmWVcJkq Content-Disposition: attachment; filename="0001-Speed-up-GNU-make-s-internal-processing.patch" Content-Transfer-Encoding: 7Bit Content-Type: text/x-patch; charset="UTF-8"; name="0001-Speed-up-GNU-make-s-internal-processing.patch" >From c8ca5b95a0c322177ba0fb55ddabc1c92fa04f10 Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Thu, 20 Jul 2023 11:50:51 +0200 Subject: [PATCH] Speed up GNU make's internal processing. Based on a recommendation by Paul Smith in . * lib/am/footer.am: Disable GNU make's internal pattern rules. * lib/Automake/Rule.pm (_conditionals_for_rule): Add special handling for these pattern rules from footer.am. (define): Likewise. * t/nodep.sh: Update test. --- lib/Automake/Rule.pm | 39 +++++++++++++++++++++++---------------- lib/am/footer.am | 11 +++++++++++ t/nodep.sh | 2 +- 3 files changed, 35 insertions(+), 17 deletions(-) diff --git a/lib/Automake/Rule.pm b/lib/Automake/Rule.pm index 9f72d2728..52ee3be4a 100644 --- a/lib/Automake/Rule.pm +++ b/lib/Automake/Rule.pm @@ -695,6 +695,9 @@ sub _conditionals_for_rule ($$$$) return $cond if !$message; # No ambiguity. + # Don't coalesce the several pattern rules from footer.am into a single one. + return $cond if $target eq "%:" && $where->get =~ /\/am\/footer\.am$/; + if ($owner == RULE_USER) { # For user rules, just diagnose the ambiguity. @@ -764,23 +767,27 @@ sub define ($$$$$) my $tdef = _rule_defn_with_exeext_awareness ($target, $cond, $where); - # A GNU make-style pattern rule has a single "%" in the target name. - msg ('portability', $where, - "'%'-style pattern rules are a GNU make extension") - if $target =~ /^[^%]*%[^%]*$/; - - # See whether this is a duplicated target declaration. - if ($tdef) + # The pattern rules in footer.am look like duplicates, but really aren't. + if ($source !~ /\/am\/footer\.am$/) { - # Diagnose invalid target redefinitions, if any. Note that some - # target redefinitions are valid (e.g., for multiple-targets - # pattern rules). - _maybe_warn_about_duplicated_target ($target, $tdef, $source, - $owner, $cond, $where); - # Return so we don't redefine the rule in our tables, don't check - # for ambiguous condition, etc. The rule will be output anyway - # because '&read_am_file' ignores the return code. - return (); + # A GNU make-style pattern rule has a single "%" in the target name. + msg ('portability', $where, + "'%'-style pattern rules are a GNU make extension") + if $target =~ /^[^%]*%[^%]*$/; + + # See whether this is a duplicated target declaration. + if ($tdef) + { + # Diagnose invalid target redefinitions, if any. Note that some + # target redefinitions are valid (e.g., for multiple-targets + # pattern rules). + _maybe_warn_about_duplicated_target ($target, $tdef, $source, + $owner, $cond, $where); + # Return so we don't redefine the rule in our tables, don't check + # for ambiguous condition, etc. The rule will be output anyway + # because '&read_am_file' ignores the return code. + return (); + } } my $rule = _crule $target; diff --git a/lib/am/footer.am b/lib/am/footer.am index 9715c826c..388defb14 100644 --- a/lib/am/footer.am +++ b/lib/am/footer.am @@ -17,3 +17,14 @@ # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: + +# Tell GNU make to disable its built-in pattern rules. +## This reduces make's internal processing. +## Recommended by Paul Smith in +## . +## These rules have no effect on non-GNU make implementations. +%:: %,v +%:: RCS/%,v +%:: RCS/% +%:: s.% +%:: SCCS/s.% diff --git a/t/nodep.sh b/t/nodep.sh index 4201c8ead..0174b838e 100644 --- a/t/nodep.sh +++ b/t/nodep.sh @@ -37,6 +37,6 @@ $ACLOCAL $AUTOMAKE sed 's/printf .*%s//' Makefile.in > Makefile.tmp -grep '%' Makefile.tmp && exit 1 +grep -v '^%::' Makefile.tmp | grep '%' && exit 1 : -- 2.34.1 --nextPart4260629.vtBmWVcJkq-- ------------=_1689901502-8316-1-- From unknown Sun Jun 22 07:51:23 2025 X-Loop: help-debbugs@gnu.org Subject: bug#64743: Speed up GNU make's internal processing Resent-From: Bruno Haible Original-Sender: "Debbugs-submit" Resent-CC: bug-automake@gnu.org Resent-Date: Fri, 21 Jul 2023 01:19:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 64743 X-GNU-PR-Package: automake X-GNU-PR-Keywords: To: Karl Berry Cc: 64743@debbugs.gnu.org, psmith@gnu.org Received: via spool by 64743-submit@debbugs.gnu.org id=B64743.16899023039587 (code B ref 64743); Fri, 21 Jul 2023 01:19:02 +0000 Received: (at 64743) by debbugs.gnu.org; 21 Jul 2023 01:18:23 +0000 Received: from localhost ([127.0.0.1]:60233 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qMemk-0002UZ-PG for submit@debbugs.gnu.org; Thu, 20 Jul 2023 21:18:23 -0400 Received: from mo4-p00-ob.smtp.rzone.de ([81.169.146.219]:45753) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qMemi-0002UQ-7T for 64743@debbugs.gnu.org; Thu, 20 Jul 2023 21:18:22 -0400 ARC-Seal: i=1; a=rsa-sha256; t=1689902292; cv=none; d=strato.com; s=strato-dkim-0002; b=UOGLaUtWvebCVIIIGHPJ730X7Fwnm0ZKP2LJ9JV8TD9bGNoZSg+1DZQNNx7JWEGwdL 0h8kGxkMngMUOj1L0WhYKV/k7DPI65rntRcMcHHWkYARQpnCVQReVyD0fpq8035PHFAY QgLhbvJb5X9evHfNwc471XzsCsnUB9BgP6/DaLN31MwitwjFFXWs5JlH5IYtn8SOxzO+ lOfFn51QhBDgSEMG/UtHqt93JoKYUFfghoXvYqK9nisASxOlcJ6bwQBGLz+nQ4xmz6kv V4uLqw3R5Djv4yTCpIjAev5pzpdfJ7pVxJethNdDaFS+mXQfawNqxOe71Q/OelktKcZ9 gJZw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; t=1689902292; s=strato-dkim-0002; d=strato.com; h=References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From:Cc:Date: From:Subject:Sender; bh=L7q/UZuy5J3rT860iHaQViZKJNmZwR8p887eZC+HCAk=; b=YilZ6vw57mr+Pl8BJggNRWm4GZT3Z2TECedc4TguJwy1q9/UtVAC9bkWr7PL5PsN4u 5dVphGQrc7zcpdlFXkevbDCMyeTaUvvxkvvF6TKtgrIJhermRhUHH0AtfdjMGFmSqlAO ptxsziYY3fBbhhbI451VBMe9TeAt69zKaAIw7bIsFf4fIuz+Mr/GTdFOhBC8yT7AdBSt +ohnSBK914y2HyMkUEcUI8+oD8m8BKJMiVxxL9rVbukkmvFzsmXckWcd40ihUZ5vWifV tIbaydLiEiGbN1ZS+oWh7LJF9NMUoVluRz6x3FDCZvjnbkpA8vNVrs2QPiNdujQFvGhu DodQ== ARC-Authentication-Results: i=1; strato.com; arc=none; dkim=none X-RZG-CLASS-ID: mo00 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; t=1689902292; s=strato-dkim-0002; d=clisp.org; h=References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From:Cc:Date: From:Subject:Sender; bh=L7q/UZuy5J3rT860iHaQViZKJNmZwR8p887eZC+HCAk=; b=PnJi6JK1zsCc+84BEpNIeJiXnGCVDakmCsEeRugPNAeSupbFtZXSj9ytmAFoZx8meq POGvAcVp2SZbf7M8qX7F7jaGvjH7G+fCcixPQxo5iNxSlgogY0c8hD5xDaY1NBP68u52 4drYP9AUrSlWoHGv3THkYEB9R4/+Uj1x7Ig9GEsIbVOAXPOHmaib1Gln4SIE7bAJHdUF yWXsmYDJJHtn7xgHtXtniMouex0/7AfcknbLvkWZqGSpiElHXzbusvXjKn21mlHs1eZi 0MvwBo9VuXBn2JeEIs1Z9qkOrfjCF7hvlUlnrtSnzkwoFDsJAnkehtpeSO6hp0VJXQpQ SBzg== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; t=1689902292; s=strato-dkim-0003; d=clisp.org; h=References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From:Cc:Date: From:Subject:Sender; bh=L7q/UZuy5J3rT860iHaQViZKJNmZwR8p887eZC+HCAk=; b=ophqvabjpqWJYgkS/d+fJa4RKcI2/AD1Pww972pL1SHWeCqIzHsfhHqLjRE/lvRCMa qlOk1dCUQvdDxnrMPmDA== X-RZG-AUTH: ":Ln4Re0+Ic/6oZXR1YgKryK8brlshOcZlIWs+iCP5vnk6shH0WWb0LN8XZoH94zq68+3cfpPHj/yR9hqV3wLPyhx45bWnBk99Sw==" Received: from nimes.localnet by smtp.strato.de (RZmta 49.6.4 AUTH) with ESMTPSA id J7421fz6L1IBYea (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256 bits)) (Client did not present a certificate); Fri, 21 Jul 2023 03:18:11 +0200 (CEST) From: Bruno Haible Date: Fri, 21 Jul 2023 03:18:11 +0200 Message-ID: <4307674.6007b0iTLj@nimes> In-Reply-To: <202307210103.36L13qYh019528@freefriends.org> References: <202307210103.36L13qYh019528@freefriends.org> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" X-Spam-Score: -0.7 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) Karl Berry wrote: > I just hope those weird-looking %:: rules do not cause trouble with > other makes. I guess we'll find out. I tested the default 'make' of various OSes, before submitting the patch. Whether some other, rarely-used 'make' implementation has problems with it, we'll find out. > The fnoc test also failed due to the new rules. I fixed that I fixed it too, in the second version of the patch. Had a hard time distinguishing spurious and persistent test failures (see bug #64756). > added a few words of documentation and NEWS, and pushed it. Thanks! Bruno From unknown Sun Jun 22 07:51:23 2025 X-Loop: help-debbugs@gnu.org Subject: bug#64743: Speed up GNU make's internal processing Resent-From: Nick Bowler Original-Sender: "Debbugs-submit" Resent-CC: bug-automake@gnu.org Resent-Date: Fri, 21 Jul 2023 02:37:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 64743 X-GNU-PR-Package: automake X-GNU-PR-Keywords: To: Bruno Haible Cc: psmith@gnu.org, 64743@debbugs.gnu.org, Karl Berry Received: via spool by 64743-submit@debbugs.gnu.org id=B64743.168990699318317 (code B ref 64743); Fri, 21 Jul 2023 02:37:01 +0000 Received: (at 64743) by debbugs.gnu.org; 21 Jul 2023 02:36:33 +0000 Received: from localhost ([127.0.0.1]:60261 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qMg0O-0004lL-3f for submit@debbugs.gnu.org; Thu, 20 Jul 2023 22:36:33 -0400 Received: from mail-ua1-x930.google.com ([2607:f8b0:4864:20::930]:46493) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qMg0J-0004l3-2W for 64743@debbugs.gnu.org; Thu, 20 Jul 2023 22:36:31 -0400 Received: by mail-ua1-x930.google.com with SMTP id a1e0cc1a2514c-794af22ed66so598148241.1 for <64743@debbugs.gnu.org>; Thu, 20 Jul 2023 19:36:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=draconx-ca.20221208.gappssmtp.com; s=20221208; t=1689906981; x=1690511781; h=cc:to:subject:message-id:date:from:references:in-reply-to :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=jGDBEI3QV7tLgUVlzGLTlsmk8iJ7GQbJUlTV2yIWiFY=; b=FSDYbAQ6bAXBxt4tGwQBVTS6rlqcSW3ZCDtWctvE/TFjiCq51Qsq88xfs0rIr+1ReO FZL5h/HZBRcgniTf64PsHq4Vp1XU9lHSNM/5yKtJufYEHXsjlT1DgFNp+A1+b3DQcXqL T8CH55SgnXESZ8IOL29qukMOH38+app2aMbqrQEYyrAq5Dbjj+UdJut0C4xIB5ZBTLzE 4hUpazLc7AXOV2qfDR69Gu/rQ6kCSHkLaYYFjPzDbBERaEKkYgFMRpI1PLqJRFzD1FI6 7mO4JKe92cMFZNN9JUcs4LNSW79vnRf2BVv2eM7VSuSAh8ROaBGEpPYnFbtsWAZhQu9H xVzw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1689906981; x=1690511781; h=cc:to:subject:message-id:date:from:references:in-reply-to :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=jGDBEI3QV7tLgUVlzGLTlsmk8iJ7GQbJUlTV2yIWiFY=; b=aJo9APm+Q/l4kbYI1BgF6KHbcPqr1dLAp9P77FMGBLHF0eJ8NiZYXS2LnpEXBqlT4v l/GcIPTeCIGiEZBKyd/horLP05yEzqP8h3LLy9Gp6ENxixPympGo96aJlwP5hdARug3e ikSXuAipay0r5eBBthHdeAihsl4Lq3Lpo/sBBYYzg7DCPrOLrk4k5bbhK+jCkTlsP1kI 9/E/yX0xVpzbFqQqZ562GpdmcJV0zh7N/48io/0it9WsWfy+qM9XPD4DVvA6OzHoOIPh j6fvluu4NATrrOTbxZJGl/3qDVsv1jksgxDKDxHEhpSruJdppcJnq/SGXzG70GHvtdaD vuPw== X-Gm-Message-State: ABy/qLaOHfkcIP+HR+KgD7Sb03F1lUAZ9Mk9jzGVr+AzqrNI7OnwxGj/ WAi/40gF6rF02S2vRacLrTxwU+BIUMEyasSbYC7Kzg== X-Google-Smtp-Source: APBJJlEH1T5ywlZrGvTDAK9+P+cBXoXVvCi63LkzPSudANzRPUy6VsUtU5SFPlPDSA0xBvIAP37fmNio0jNOejkpD7Q= X-Received: by 2002:a05:6102:45a:b0:446:e7aa:ae63 with SMTP id e26-20020a056102045a00b00446e7aaae63mr336182vsq.25.1689906981270; Thu, 20 Jul 2023 19:36:21 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:ab0:6597:0:b0:794:1113:bb24 with HTTP; Thu, 20 Jul 2023 19:36:20 -0700 (PDT) X-Originating-IP: [24.53.241.2] In-Reply-To: <4307674.6007b0iTLj@nimes> References: <202307210103.36L13qYh019528@freefriends.org> <4307674.6007b0iTLj@nimes> From: Nick Bowler Date: Thu, 20 Jul 2023 22:36:20 -0400 Message-ID: Content-Type: text/plain; charset="UTF-8" X-Spam-Score: -0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) On 20/07/2023, Bruno Haible wrote: > Karl Berry wrote: >> I just hope those weird-looking %:: rules do not cause trouble with >> other makes. I guess we'll find out. > > I tested the default 'make' of various OSes, before submitting the patch. > Whether some other, rarely-used 'make' implementation has problems with it, > we'll find out. FWIW I tried the makes on FreeBSD 9, HP-UX 11 and ULTRIX 4.5 and there was no obvious negative effect with the snippet shown in the original post. I expect all the non-GNU implementations are interpreting these lines as ordinary target rules for a funnily-named files with funnily-named prerequisites. So it's not quite right to say it has "no effect", but I think it shouldn't cause any particular problem for packages using portable file names. Cheers, Nick