Skip to content

Conversation

fanquake
Copy link
Member

@fanquake fanquake commented Jul 23, 2025

This picks up #22126. Previously, this was more complicated to do, as depends packages (upnp, natpmp) used the rules being disabled. Those packages have since been removed.

When there is no rule to build a target in the makefile, make looks for a builtin rule. When -r is specified make no longer performs this lookup.

E.g. the following in an excerpt from make -d output. Here, make looks for a rule to build all.

Considering target file 'all'.
 File 'all' does not exist.
 Looking for an implicit rule for 'all'.
 Trying pattern rule with stem 'all'.
 Trying implicit prerequisite 'all.o'.
 Trying pattern rule with stem 'all'.
 Trying implicit prerequisite 'all.c'.
 Trying pattern rule with stem 'all'.
 Trying implicit prerequisite 'all.cc'.
 Trying pattern rule with stem 'all'.
 Trying implicit prerequisite 'all.C'.
 Trying pattern rule with stem 'all'.
 Trying implicit prerequisite 'all.cpp'.
 Trying pattern rule with stem 'all'.
 Trying implicit prerequisite 'all.p'.
 Trying pattern rule with stem 'all'.
 Trying implicit prerequisite 'all.f'.
...

Many more lines like this are omitted.

Because this build system does not use make builtin rules or suffixes, there is no benefit in having builtin rules enabled.

There are 2 benefits in having builtin rules disabled.

  1. Improves performance by eliminating redundant lookups.
  2. Simplifies troubleshooting by reducing the output of make -d or make -p.

Also see: https://www.gnu.org/software/make/manual/make.html#index-_002d_002dno_002dbuiltin_002drules.

@DrahtBot
Copy link
Contributor

DrahtBot commented Jul 23, 2025

The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.

Code Coverage & Benchmarks

For details see: https://corecheck.dev/bitcoin/bitcoin/pulls/33045.

Reviews

See the guideline for information on the review process.

Type Reviewers
Concept ACK theuni

If your review is incorrectly listed, please react with 👎 to this comment and the bot will ignore it on the next update.

@DrahtBot
Copy link
Contributor

Guix builds (on x86_64) [untrusted test-only build, possibly unsafe, not for production use]

File commit 73e754b
(master)
commit 21f4a31
(pull/33045/merge)
*-aarch64-linux-gnu-debug.tar.gz 66323aae7b9ce287... 913afa27e7edcace...
*-aarch64-linux-gnu.tar.gz f91f331b0f58ca41... 8e0a47321ef370f2...
*-arm-linux-gnueabihf-debug.tar.gz 35514683e2c806eb... 3f654c51e8fca816...
*-arm-linux-gnueabihf.tar.gz 03b34325a162d549... 4f5b75460a1b99bd...
*-arm64-apple-darwin-codesigning.tar.gz f22f13c2eca5fdfb... e6ce8199724a107b...
*-arm64-apple-darwin-unsigned.tar.gz 3391effee20ec6af... 34e88ab254c31f2d...
*-arm64-apple-darwin-unsigned.zip a502fe719ba93cd6... 551be5fd8181cfbf...
*-powerpc64-linux-gnu-debug.tar.gz 5056cab7e5846f1a... 24eb381acb4a0e21...
*-powerpc64-linux-gnu.tar.gz 8f2a3dc992ad2528... d58c2be9bbdc0a1e...
*-riscv64-linux-gnu-debug.tar.gz dff0790128ad3e3b... 8fe4b7b1d494eebd...
*-riscv64-linux-gnu.tar.gz 36f075d3e82d8118... ca4c95d02bc10b7c...
*-x86_64-apple-darwin-codesigning.tar.gz f5c98678f07abadb... 29d3165d030c199c...
*-x86_64-apple-darwin-unsigned.tar.gz 92f3bdbf703a28ba... 01b2a075580bea08...
*-x86_64-apple-darwin-unsigned.zip 1ce72bf9ece268b9... 253a27b1fb825dd7...
*-x86_64-linux-gnu-debug.tar.gz 6378973406ab790c... 77c232b9b592bd82...
*-x86_64-linux-gnu.tar.gz 852bd5993a5e0af6... 4654cfb476133c39...
*.tar.gz c374850b77d3191b... b677fe2965b77171...
SHA256SUMS.part bb4156ff76c39233... e89eb8569e44abd8...
guix_build.log 945c1eaecc45dbdd... f6a192c8fa22676a...
guix_build.log.diff 61d0d7d432f7f2b2...

@fanquake fanquake requested a review from theuni August 1, 2025 12:56
@fanquake fanquake force-pushed the 22126_rebased branch 2 times, most recently from dc52d2d to d3c2bf1 Compare August 6, 2025 13:52
@fanquake fanquake force-pushed the 22126_rebased branch 2 times, most recently from c467b06 to 803a2f5 Compare September 4, 2025 14:18
@theuni
Copy link
Member

theuni commented Sep 4, 2025

Concept ACK and utACK 803a2f5.

I was going to suggest:

  • Using --no-builtin-rules rather than -r to be a little more self-documenting
  • Using GNUMAKEFLAGS rather than MAKEFLAGS for better compatibility

But...

BSD Make supports -r, so that pretty much moots both points. Also, I'm pretty sure we require GNU Make anyway.

Only nit: Does anything depend on the builtin variables, or could we use -R as well?

gtkiller and others added 2 commits September 5, 2025 11:06
When there is no rule to build a target in the makefile, make looks
for a builtin rule.
When -r is specified make no longer performs this lookup.

E.g. the following in an excerpt from make -d output.
Here, make looks for a rule to build 'all'.

Considering target file 'all'.
 File 'all' does not exist.
 Looking for an implicit rule for 'all'.
 Trying pattern rule with stem 'all'.
 Trying implicit prerequisite 'all.o'.
 Trying pattern rule with stem 'all'.
 Trying implicit prerequisite 'all.c'.
 Trying pattern rule with stem 'all'.
 Trying implicit prerequisite 'all.cc'.
 Trying pattern rule with stem 'all'.
 Trying implicit prerequisite 'all.C'.
 Trying pattern rule with stem 'all'.
 Trying implicit prerequisite 'all.cpp'.
 Trying pattern rule with stem 'all'.
 Trying implicit prerequisite 'all.p'.
 Trying pattern rule with stem 'all'.
 Trying implicit prerequisite 'all.f'.
...
Many more lines like this are omitted.

Because this build system does not use make builtin rules or suffixes,
there is no benefit in having builtin rules enabled.

There are 2 benefits in having builtin rules disabled.

1. Improves performance by eliminating redundant lookups.
2. Simplifies troubleshooting by reducing the output of make -d or
make -p.
@fanquake
Copy link
Member Author

fanquake commented Sep 5, 2025

or could we use -R as well?

Pushed up a commit.

@fanquake fanquake changed the title depends: disable builtin rules and suffixes. depends: disable variables, rules and suffixes. Sep 5, 2025
@DrahtBot
Copy link
Contributor

DrahtBot commented Sep 6, 2025

Guix builds (on x86_64) [untrusted test-only build, possibly unsafe, not for production use]

File commit e04cb9c
(master)
commit 60623ac
(pull/33045/merge)
*-aarch64-linux-gnu-debug.tar.gz cd50bfed7e9bc0f8... 87104f63233496ca...
*-aarch64-linux-gnu.tar.gz 36a02623053223bc... 4dea2f22e2960ba8...
*-arm-linux-gnueabihf-debug.tar.gz 458c2f80c194deb2... 2547fc07072da046...
*-arm-linux-gnueabihf.tar.gz b64957c7554150f0... 99bb29541b6a6292...
*-arm64-apple-darwin-codesigning.tar.gz 60882ae5d893d3a5... 51a056eb204b46f0...
*-arm64-apple-darwin-unsigned.tar.gz cb0c6481e288a0ac... 2a157c9be42c3c22...
*-arm64-apple-darwin-unsigned.zip 1368db96c33512d3... 4c4fa278aa1f1b1e...
*-powerpc64-linux-gnu-debug.tar.gz 364b4bcb42c3fd42... f5208f711bd2d3d7...
*-powerpc64-linux-gnu.tar.gz c8f45ac13000d807... 7077086ce168746a...
*-riscv64-linux-gnu-debug.tar.gz 919495916d8c36d9... d39dbafc71c5f423...
*-riscv64-linux-gnu.tar.gz feb064a4d3f3e9f3... 83148f565a8d9ad1...
*-x86_64-apple-darwin-codesigning.tar.gz 08bb05b29e5b466a... 3c0fba3b0f6d22d5...
*-x86_64-apple-darwin-unsigned.tar.gz 968b1f2e17f0eb67... 07162534362b09fd...
*-x86_64-apple-darwin-unsigned.zip 351e8c1f1df53a31... 3acffe679480c073...
*-x86_64-linux-gnu-debug.tar.gz d1bfb9b513bb03d6... 61d5dc3bbbbc511c...
*-x86_64-linux-gnu.tar.gz 504457dd348fe70d... ce70220960f8da3c...
*.tar.gz 6944fc8c6b7504b6... 73e9ba02c5d91050...
SHA256SUMS.part 077beb6922793d39... 8ead66dfe9edef6c...
guix_build.log bea83b2d9bf46459... 29725b817fc58608...
guix_build.log.diff 1d72d106a748a136...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants