Skip to content

use gmake file function for response files - #593

Open
pmackinlay wants to merge 2 commits into
bkaradzic:masterfrom
pmackinlay:long_cmd_line
Open

use gmake file function for response files#593
pmackinlay wants to merge 2 commits into
bkaradzic:masterfrom
pmackinlay:long_cmd_line

Conversation

@pmackinlay

Copy link
Copy Markdown

Current implementation relies on external echo command, which suffers from the same command line length limits the response files are designed to work around. The file function avoids this problem and theoretically performs better.

Current implementation relies on external echo command, which suffers from the same command line length limits the response files are designed to work around. The file function avoids this problem and theoretically performs better.
@bkaradzic

Copy link
Copy Markdown
Owner

What about $(SILENT) part?

Right now it's possible to do make SILENT= and see what's called...

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

This PR updates the GNU make (“gmake”) C/C++ project generator to emit response files using GNU make’s built-in $(file ...) function instead of invoking an external echo, aiming to avoid shell command-line length limits when generating @response files.

Changes:

  • Replace echo $^ > $@ response-file generation with $(file >$@,$^) for object response files.
  • Replace echo $^ > $@ response-file generation with $(file >$@,$^) for linker dependency response files.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/actions/make/make_cpp.lua
Comment thread src/actions/make/make_cpp.lua
Comment thread src/actions/make/make_cpp.lua
Comment thread src/actions/make/make_cpp.lua
Comment thread src/actions/make/make_cpp.lua
@pmackinlay

Copy link
Copy Markdown
Author

What about $(SILENT) part?

Right now it's possible to do make SILENT= and see what's called...

There is no built-in ability in gmake to "echo" built-in functions to my knowledge. The previous _p('\t$(SILENT) echo $^') part could be reproduced using a $(info ...) function which would avoid the issue with echo and long command lines, but unsure how you'd like to see the function call itself output?

- display response files (as before, but avoiding echo)
- guard file function output against dry-run option
@bkaradzic

Copy link
Copy Markdown
Owner

$(SILENT) is something I use all the time to diagnose issues with builds. So unless you have solution how to preserve this functionality, I won't accept this PR.

@pmackinlay

Copy link
Copy Markdown
Author

$(SILENT) is something I use all the time to diagnose issues with builds. So unless you have solution how to preserve this functionality, I won't accept this PR.

If you can tell me how you'd like the output to appear, I can implement something to produce it, but it's going to be an additional function call and logic to achieve that, the statements from which will not themselves show up when using SILENT=.

Do you want it to output something like: $(file >response_file,file1 file2 file3), i.e. the function call with its arguments expanded?

@bkaradzic

Copy link
Copy Markdown
Owner

Just run make normally on generated makefile, and add SILENT= to command, and you'll see what's outputting.

@pmackinlay

Copy link
Copy Markdown
Author

Just run make normally on generated makefile, and add SILENT= to command, and you'll see what's outputting.

I understand perfectly the role of the SILENT variable, and the @ (i.e., default value of SILENT) effect of suppressing what make outputs when it executes a step in a rule. In this case however, the step consists of a call to a built-in function $(file ...), which doesn't output anything regardless of the absence/presence of @, the same way control flow statements like ifeq etc. don't output anything.

Because there's no default output or interpretation that can be used to show what the step is doing, some representation has to be programmatically generated if required, in this case probably using another built-in function such as $(info ...). The exact format of what should be output is up to the implementer to decide, hence the question.

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.

3 participants