premake / premake/premake-core

Should gmake2 actually escape spaces?

Open
#1,941 13 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

question
Dominant language
C
Stars
3.6k
Forks
654
Avg merge
1d 1h
Merged PRs (30d)
13

Description

What's your question?
Currently, gmake2 escapes spaces in arguments to buildcommands. For an example, look at test_gmake2_file_rules.lua:

	function suite.propertydefinitionSeparator()

		rules { "TestRule" }

		files { "test.rule", "test2.rule", "test3.rule", "test4.rule" }

		filter "files:test.rule"
			testRuleVars {
				TestListProperty = { "testValue1", "testValue2" }
			}

		filter "files:test2.rule"
			testRuleVars {
				TestListPropertyWithSwitch = { "testValue1", "testValue2" }
			}
...

		prepare()
		test.capture [[
# File Rules
# #############################################

test.obj: test.rule
	@echo Rule-ing test.rule
	$(SILENT) dorule   testValue1\ testValue2     "test.rule"
test2.obj: test2.rule
	@echo Rule-ing test2.rule
	$(SILENT) dorule    -StestValue1\ -StestValue2    "test2.rule"
...
		]]
	end

This makes it so lists/strings, if contain spaces, are escaped, and -StestValue1\ -StestValue2 becomes a single argument: -S"testValue1 -StestValue2". Is this intended? Perhaps, it should not be like that? Or, shouldnt it be atleast customizable? So i.e. if you dont want it to be escaped, you just place a flag in the property definition.

Consider a case:
You have a property definition for compiler defines that needs to be split into individual arguments:
-D define1 value1 -D define2 value2
I would personally create a list of definitions, something like { "define1 value1", "define2 value2" },
but that would not work, because it would translate into something like -D define1\ value1\ -D define2\ value2.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with test_gmake2_file_rules.lua and trace how gmake2 turns list and string properties into build command arguments. Determine whether spaces should remain escaped or whether property definitions need an opt-out, then update the captured expectations and related tests to document the agreed behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
lua
Domain
build-system
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.