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- | 	MINGW = i686-w64-mingw32- | ||||||
| 	CC = $(MINGW)gcc | 	CC = $(MINGW)gcc | ||||||
| 	CXX = $(MINGW)g++ -std=c++20 | 	CXX = $(MINGW)g++ -std=c++20 | ||||||
| 	CFLAGS += -g -O3 | 	CFLAGS += -g -O3 \ | ||||||
|  | 		-Wno-unknown-warning-option | ||||||
| 	CXXFLAGS += \ | 	CXXFLAGS += \ | ||||||
| 		-fext-numeric-literals \ | 		-fext-numeric-literals \ | ||||||
| 		-Wno-deprecated-enum-float-conversion \ | 		-Wno-deprecated-enum-float-conversion \ | ||||||
| @@ -26,7 +27,8 @@ ifeq ($(BUILDTYPE),windows) | |||||||
| else | else | ||||||
| 	CC = gcc | 	CC = gcc | ||||||
| 	CXX = g++ -std=c++20 | 	CXX = g++ -std=c++20 | ||||||
| 	CFLAGS = -g -O3 | 	CFLAGS = -g -O3 \ | ||||||
|  | 		-Wno-unknown-warning-option | ||||||
| 	CXXFLAGS += \ | 	CXXFLAGS += \ | ||||||
| 		-Wno-deprecated-enum-float-conversion \ | 		-Wno-deprecated-enum-float-conversion \ | ||||||
| 		-Wno-deprecated-enum-enum-conversion | 		-Wno-deprecated-enum-enum-conversion | ||||||
|   | |||||||
| @@ -115,5 +115,4 @@ $(OBJ)/build.ninja $(OBJ)/build.targets &: | |||||||
| include $(OBJ)/build.targets | include $(OBJ)/build.targets | ||||||
| .PHONY: $(ninja-targets) | .PHONY: $(ninja-targets) | ||||||
| $(ninja-targets) &: $(OBJ)/build.ninja | $(ninja-targets) &: $(OBJ)/build.ninja | ||||||
| 	@echo "NINJA" |  | ||||||
| 	+$(hide) $(NINJA) -f $(OBJ)/build.ninja $@ | 	+$(hide) $(NINJA) -f $(OBJ)/build.ninja $@ | ||||||
|   | |||||||
| @@ -150,7 +150,7 @@ class GlobalFormatter(string.Formatter): | |||||||
|             m = re.search(f"(?:[^$]|^)()\\$\\(([^)]*)\\)()", format_string) |             m = re.search(f"(?:[^$]|^)()\\$\\(([^)]*)\\)()", format_string) | ||||||
|             if not m: |             if not m: | ||||||
|                 yield ( |                 yield ( | ||||||
|                     _undo_escaped_dollar(format_string, "("), |                     format_string, | ||||||
|                     None, |                     None, | ||||||
|                     None, |                     None, | ||||||
|                     None, |                     None, | ||||||
| @@ -161,7 +161,7 @@ class GlobalFormatter(string.Formatter): | |||||||
|             format_string = format_string[m.end(3) :] |             format_string = format_string[m.end(3) :] | ||||||
|  |  | ||||||
|             yield ( |             yield ( | ||||||
|                 _undo_escaped_dollar(left, "(") if left else None, |                 left if left else None, | ||||||
|                 var, |                 var, | ||||||
|                 None, |                 None, | ||||||
|                 None, |                 None, | ||||||
| @@ -187,7 +187,7 @@ def substituteGlobalVariables(value): | |||||||
|         oldValue = value |         oldValue = value | ||||||
|         value = globalFormatter.format(value) |         value = globalFormatter.format(value) | ||||||
|         if value == oldValue: |         if value == oldValue: | ||||||
|             return value |             return _undo_escaped_dollar( value, "(") | ||||||
|  |  | ||||||
|  |  | ||||||
| def Rule(func): | def Rule(func): | ||||||
| @@ -583,7 +583,7 @@ def emit_rule(self, ins, outs, cmds=[], label=None): | |||||||
|             emit(" command=sh", rulef) |             emit(" command=sh", rulef) | ||||||
|         else: |         else: | ||||||
|             emit("build", *fouts, ":rule", *fins) |             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: |         if label: | ||||||
|             emit(" description=", label) |             emit(" description=", label) | ||||||
|         emit("build", name, ":phony", *fouts) |         emit("build", name, ":phony", *fouts) | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user