Skip to content

Make: evaluate MAKECMDGOALS and text functions whose arguments are known - #369

Merged
lefticus merged 1 commit into
cpp-best-practices:mainfrom
leftibot:make-functions
Nov 24, 2026
Merged

lefticus merged 1 commit into
cpp-best-practices:mainfrom
leftibot:make-functions

Conversation

@leftibot

Copy link
Copy Markdown
Collaborator

Part of #361 (its "related, smaller" item: evaluating Make's $(filter …) and MAKECMDGOALS)

uutils/coreutils builds in release only for make install:

ifneq (,$(filter install, $(MAKECMDGOALS)))
 PROFILE?=release
endif
PROFILE ?= debug

MAKECMDGOALS was unset and filter was never evaluated, so that branch was held as possible, and make build jobs listed Release as well as debug.

  • MAKECMDGOALS is now the goals the command names (empty when it names none), settled the way the command line's variables are.
  • filter and filter-out (with % patterns), findstring and strip are evaluated once their arguments hold no reference. One that still holds a reference stays as written.

Verified:

  • All local gates pass.
  • Both new tests failed first.
  • Corpus: 1 of 235 projects differs. coreutils' make build jobs no longer list Release.

🤖 Generated with Claude Code

https://claude.ai/code/session_01ByTXNqDWdM7HzezrFtEvQt

uutils/coreutils builds in release only for `make install`: `ifneq (,$(filter install, $(MAKECMDGOALS)))` sets
PROFILE?=release. MAKECMDGOALS was unset and `filter` was never evaluated, so the branch was held as possible and
`make build` listed Release too.

MAKECMDGOALS is now the goals the command names (none when it names none), settled as the command line's
variables are. `filter`, `filter-out` (with `%` patterns), `findstring` and `strip` are evaluated once their
arguments hold no reference left; one that still does stays as written.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01ByTXNqDWdM7HzezrFtEvQt
@codecov

codecov Bot commented Nov 24, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
⚠️ Please upload report for BASE (main@8d90b79). Learn more about missing BASE report.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #369   +/-   ##
=======================================
  Coverage        ?   99.72%           
=======================================
  Files           ?      313           
  Lines           ?    20005           
  Branches        ?     2341           
=======================================
  Hits            ?    19950           
  Misses          ?       55           
  Partials        ?        0           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@lefticus
lefticus merged commit 11769c8 into cpp-best-practices:main Nov 24, 2026
26 checks passed
@lefticus
lefticus deleted the make-functions branch November 24, 2026 03:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants