Skip to content

🐛 Use lazy evaluation for shell calls in Makefile#3154

Merged
k8s-ci-robot merged 1 commit intokubernetes-sigs:mainfrom
shiftstack:faster-makefile
May 5, 2026
Merged

🐛 Use lazy evaluation for shell calls in Makefile#3154
k8s-ci-robot merged 1 commit intokubernetes-sigs:mainfrom
shiftstack:faster-makefile

Conversation

@stephenfin
Copy link
Copy Markdown
Contributor

What this PR does / why we need it:

Variables assigned using := (simply expanded variable assignment) are expanded once, immediately when the line is read. This can be problematic when the shell function is used, since that is expanded when make reads the line. Combined, this means any $(shell ...) invocations on a := line run at parse time rather than execution time.

Avoid this by assigning these variables using using = (recursively expanded variable assignment), which causes them to be evaluated lazily. This allows us to tab-complete targets without a 2-3 second delay.

Which issue(s) this PR fixes (optional, in fixes #<issue number>(, fixes #<issue_number>, ...) format, will close the issue(s) when PR gets merged):

n/a

Special notes for your reviewer:

None.

  • squashed commits
  • if necessary:
    • includes documentation
    • adds unit tests

/hold

Variables assigned using `:=` (simply expanded variable assignment [1])
are expanded once, immediately when the line is read. This can be
problematic when the shell function is used, since that is expanded when
make reads the line [2]. Combined, this means any `$(shell ...)`
invocations on a `:=` line run at parse time rather than execution time.

Avoid this by assigning these variables using using `=` (recursively
expanded variable assignment [3]), which causes them to be evaluated
lazily. This allows us to tab-complete targets without a 2-3 second
delay.

[1] https://www.gnu.org/software/make/manual/html_node/Simple-Assignment.html
[2] https://www.gnu.org/software/make/manual/make.html#Shell-Function
[3] https://www.gnu.org/software/make/manual/html_node/Recursive-Assignment.html

Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
@k8s-ci-robot k8s-ci-robot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Apr 30, 2026
@netlify
Copy link
Copy Markdown

netlify Bot commented Apr 30, 2026

Deploy Preview for kubernetes-sigs-cluster-api-openstack ready!

Name Link
🔨 Latest commit a558fcf
🔍 Latest deploy log https://app.netlify.com/projects/kubernetes-sigs-cluster-api-openstack/deploys/69f33e97b432610008071b53
😎 Deploy Preview https://deploy-preview-3154--kubernetes-sigs-cluster-api-openstack.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@k8s-ci-robot k8s-ci-robot added size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. labels Apr 30, 2026
Copy link
Copy Markdown
Contributor

@lentzi90 lentzi90 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/approve

@k8s-ci-robot
Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: lentzi90

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label May 4, 2026
Copy link
Copy Markdown
Contributor

@smoshiur1237 smoshiur1237 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label May 4, 2026
@stephenfin
Copy link
Copy Markdown
Contributor Author

/remove-hold

@k8s-ci-robot k8s-ci-robot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label May 5, 2026
@k8s-ci-robot k8s-ci-robot merged commit 31504b1 into kubernetes-sigs:main May 5, 2026
14 checks passed
@github-project-automation github-project-automation Bot moved this from Inbox to Done in CAPO Roadmap May 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", indicates that a PR is ready to be merged. size/XS Denotes a PR that changes 0-9 lines, ignoring generated files.

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

4 participants