Pass target as an actual Make goal to 'make -pq' - #9
Merged
Conversation
colluca
force-pushed
the
pass-target-to-make-pq
branch
from
July 27, 2026 13:20
d195f52 to
4e97dc2
Compare
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.
_parse_makefilepreviously ran a baremake -pqwith no goal, soMAKECMDGOALSwas always empty inside that invocation. Any Makefile logic conditioned on the requested goal — e.g. an-includegated behind$(if $(filter ...,$(MAKECMDGOALS)),...), used to lazily include anauto-generated dependency file only when it's actually relevant to what's being
built — was never triggered, silently hiding whatever prerequisites that logic
would otherwise have surfaced.
This came up because
snitch_cluster'syosystarget relies on exactly thispattern to expand into its full list of RTL source files (generated via a
Verilator preprocessing pass into a
.dfile), andlist-make-prerequisites yosys --recursivewas silently missing every one of them.Fix
Pass
targetas an actual positional goal to the underlyingmake -pqcall, soit behaves the same way a real
make <target>invocation would forMAKECMDGOALS-conditional logic — including letting Make regenerate a missing auto-generated dependency file via its normal rule, if there is one.
Verification
Tested against a real checkout of
snitch_cluster'syosystarget (with itsdependency file already generated from a prior local build):
Also reran the existing CLI checks against this repo's own
test/fixtures toconfirm no regression there.
Testing
Added a regression test (
test/test_cli.py::test_list_prerequisites_with_makecmdgoals_conditional_prerequisite) that reproduces the exact pattern behind this bug: aconditionaltarget intest/Makefilewhose full prerequisite list only appears once a generatedgendep.mkis-included, gated on$(filter conditional,$(MAKECMDGOALS))— mirroringsnitch_cluster'ssn_include_deps/auto-generated.d-file mechanism.Verified it actually catches the regression: reinstalling the pre-fix
common.pymakes this test fail (hiddenprereqsilently missing, onlystandaloneprereqreturned), while the fix makes it pass.