mirror of
https://github.com/davidgiven/fluxengine.git
synced 2025-10-24 11:11:02 -07:00
Fix escaping of $$ strings; then escape them again before passing to ninja!
This commit is contained in:
6
Makefile
6
Makefile
@@ -12,7 +12,8 @@ ifeq ($(BUILDTYPE),windows)
|
||||
MINGW = i686-w64-mingw32-
|
||||
CC = $(MINGW)gcc
|
||||
CXX = $(MINGW)g++ -std=c++20
|
||||
CFLAGS += -g -O3
|
||||
CFLAGS += -g -O3 \
|
||||
-Wno-unknown-warning-option
|
||||
CXXFLAGS += \
|
||||
-fext-numeric-literals \
|
||||
-Wno-deprecated-enum-float-conversion \
|
||||
@@ -26,7 +27,8 @@ ifeq ($(BUILDTYPE),windows)
|
||||
else
|
||||
CC = gcc
|
||||
CXX = g++ -std=c++20
|
||||
CFLAGS = -g -O3
|
||||
CFLAGS = -g -O3 \
|
||||
-Wno-unknown-warning-option
|
||||
CXXFLAGS += \
|
||||
-Wno-deprecated-enum-float-conversion \
|
||||
-Wno-deprecated-enum-enum-conversion
|
||||
|
||||
@@ -115,5 +115,4 @@ $(OBJ)/build.ninja $(OBJ)/build.targets &:
|
||||
include $(OBJ)/build.targets
|
||||
.PHONY: $(ninja-targets)
|
||||
$(ninja-targets) &: $(OBJ)/build.ninja
|
||||
@echo "NINJA"
|
||||
+$(hide) $(NINJA) -f $(OBJ)/build.ninja $@
|
||||
|
||||
@@ -150,7 +150,7 @@ class GlobalFormatter(string.Formatter):
|
||||
m = re.search(f"(?:[^$]|^)()\\$\\(([^)]*)\\)()", format_string)
|
||||
if not m:
|
||||
yield (
|
||||
_undo_escaped_dollar(format_string, "("),
|
||||
format_string,
|
||||
None,
|
||||
None,
|
||||
None,
|
||||
@@ -161,7 +161,7 @@ class GlobalFormatter(string.Formatter):
|
||||
format_string = format_string[m.end(3) :]
|
||||
|
||||
yield (
|
||||
_undo_escaped_dollar(left, "(") if left else None,
|
||||
left if left else None,
|
||||
var,
|
||||
None,
|
||||
None,
|
||||
@@ -187,7 +187,7 @@ def substituteGlobalVariables(value):
|
||||
oldValue = value
|
||||
value = globalFormatter.format(value)
|
||||
if value == oldValue:
|
||||
return value
|
||||
return _undo_escaped_dollar( value, "(")
|
||||
|
||||
|
||||
def Rule(func):
|
||||
@@ -583,7 +583,7 @@ def emit_rule(self, ins, outs, cmds=[], label=None):
|
||||
emit(" command=sh", rulef)
|
||||
else:
|
||||
emit("build", *fouts, ":rule", *fins)
|
||||
emit(" command=", "&&".join([s.strip() for s in rule]))
|
||||
emit(" command=", "&&".join([s.strip() for s in rule]).replace("$", "$$"))
|
||||
if label:
|
||||
emit(" description=", label)
|
||||
emit("build", name, ":phony", *fouts)
|
||||
|
||||
Reference in New Issue
Block a user