Repository navigation
Improve the rerun logic for the config target - #348
Merged
Merged
Conversation
jserv
reviewed
Oct 21, 2026
jserv
reviewed
Oct 21, 2026
jserv
reviewed
Oct 21, 2026
jserv
reviewed
Oct 21, 2026
Collaborator
|
Merging this as is turns every static-linking CI job red: the workflow passes |
DrXiao
force-pushed
the
enhance-rebuild-logic
branch
from
October 25, 2026 11:27
ef884db to
c484ba3
Compare
Running "make" previously always ran the config target and indirectly caused the bootstrap target to run as well. The main reason was that the config target writes the TRANSLATION_DEFS variable, whose value always differs on each run, to the generated "config" file. This triggered the bootstrap target through the indirect dependency. These changes therefore rewrite the Makefile logic as follows: - Make the BINDING variable be undefined by default. Conditionally set it to lazy when DYNLINK is set to 1. - The build system reads the configuration from the build session file if it exists, and then sets the NEED_RECONFIGURE variable if any of the following conditions is met: - ARCH is switched to another target architecture. - DYNLINK is switched. - BINDING is switched in the dynamic linking mode. - The config target is modified by introducing several 'ifeq' conditionals. Once NEED_RECONFIGURE is set to 1, this target directly writes the required "config" file and the build session file; otherwise, it only prints a hint message and takes no action. The DYNLINK and BINDING checks have also been enhanced to prevent invalid configurations. Eventually, the config target does not modify the "config" file or the build session file if the ARCH/DYNLINK/BINDING switches do not affect the build. The aforementioned issue in the first paragraph can also be resolved. Close sysprog21#347
If the ARCH_DEFS variable in the selected target architecture's Makefile fragment is modified after an initial build or configuration, running "make" again does not cause the config target to run again. The build system now writes a SHA-256 checksum of the content of ARCH_DEFS to a file (archdefs.sha256) and uses this file to determine whether the next run should execute the config target. If the new SHA-256 checksum does not equal to the previous checksum recorded in the file, NEED_RECONFIGURE is set to 1, allowing a reconfiguration to be performed.
Since the previous commit has improved the build logic, this commit updates the related descriptions in the README, including: - Rewriting the reference messages for running "make". - Describing the conditions and behavior for a rebuild or a reconfiguration.
The Makefile now retains the ARCH/DYNLINK/BINDING configurations via the build session file, and static builds reject a non-empty BINDING. The following changes are introduced: - The CI matrices are fixed by leaving BINDING empty instead of "lazy" when verifying static builds. This avoids passing "BINDING=lazy" to those builds and prevents them from failing. - Because the build system can keep configurations via the stored session, not every step that runs "make" needs to explicitly assign them. Some CI steps have been improved by removing the redundant variable assignments. - Outdated comments have been removed.
DrXiao
force-pushed
the
enhance-rebuild-logic
branch
from
October 25, 2026 11:30
c484ba3 to
0c21ef7
Compare
Collaborator
Author
|
2c73c41 handles configuration switches, but it can not deal with the cases where 2088fd8 is therefore introduced to handle such cases. The build system now writes a SHA-256 checksum of the content of |
Collaborator
|
Thank @DrXiao for contributing! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Running
makepreviously always triggered theconfigand thebootstraptargets to execute because the value ofTRANSLATION_DEFSdiffered on every run, causing the auto-generatedconfigfile to be updated and thebootstraptarget to run through an indirect dependency.The proposed changes primarily rewrite the Makefile logic to enable the build system to check the configuration switches (
ARCH/DYNLINK/BINDING) and to determine whether a reconfiguration or a rebuild should be performed.Now, the aforementioned variables are stored in the build session file (
BINDINGis stored only when dynamic linking is enabled) after theconfigtarget is triggered. For the nextmakerun, the build system will verify whether any of these variables has changed and whether the rerun requirements are met.Test cases:
Summary by cubic
Rerunning
makeno longer always reconfigures and rebuilds the bootstrap target. The build system now recordsARCH,DYNLINK, andBINDINGin a build session file and only reconfigures when one of these switches, printingKeep configurationsotherwise. PassingBINDINGwith static linking now aborts the build instead of silently ignoring it.configtarget writes the generatedconfigfile and session file only whenNEED_RECONFIGUREis set.BINDINGto undefined and sets it tolazyonly whenDYNLINK=1.Written for commit ef884db. Summary will update on new commits.