From eb0904698ff426c24c423c1179f6f4274371cca1 Mon Sep 17 00:00:00 2001 From: Jason Perkins Date: Mon, 8 Dec 2014 12:44:51 -0500 Subject: [PATCH] Fix escaping of multiple build rule inputs --- src/actions/make/make_cpp.lua | 21 ++++++++++++--------- tests/actions/make/cpp/test_file_rules.lua | 9 +++++---- 2 files changed, 17 insertions(+), 13 deletions(-) diff --git a/src/actions/make/make_cpp.lua b/src/actions/make/make_cpp.lua index 4b5ec9f6..8774c18e 100644 --- a/src/actions/make/make_cpp.lua +++ b/src/actions/make/make_cpp.lua @@ -1,15 +1,18 @@ -- -- make_cpp.lua -- Generate a C/C++ project makefile. --- Copyright (c) 2002-2013 Jason Perkins and the Premake project +-- Copyright (c) 2002-2014 Jason Perkins and the Premake project -- - premake.make.cpp = {} - local make = premake.make - local cpp = premake.make.cpp - local project = premake.project - local config = premake.config - local fileconfig = premake.fileconfig + local p = premake + + p.make.cpp = {} + + local make = p.make + local cpp = p.make.cpp + local project = p.project + local config = p.config + local fileconfig = p.fileconfig --- @@ -157,9 +160,9 @@ local dependencies = filecfg.relpath if filecfg.buildinputs and #filecfg.buildinputs > 0 then local inputs = project.getrelative(prj, filecfg.buildinputs) - dependencies = dependencies .. " " .. table.concat(inputs, " ") + dependencies = dependencies .. " " .. table.concat(p.esc(inputs), " ") end - _x('%s: %s', output, dependencies) + _p('%s: %s', output, dependencies) _p('\t@echo "%s"', filecfg.buildmessage or ("Building " .. filecfg.relpath)) local cmds = os.translateCommands(filecfg.buildcommands) diff --git a/tests/actions/make/cpp/test_file_rules.lua b/tests/actions/make/cpp/test_file_rules.lua index b35431c4..afb716ad 100644 --- a/tests/actions/make/cpp/test_file_rules.lua +++ b/tests/actions/make/cpp/test_file_rules.lua @@ -16,6 +16,7 @@ local sln, prj function suite.setup() + premake.escaper(make.esc) sln = test.createsolution() end @@ -35,10 +36,10 @@ test.capture [[ $(OBJDIR)/hello.o: src/greetings/hello.cpp @echo $(notdir $<) - $(SILENT) $(CXX) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF $(@:%.o=%.d) -c "$<" + $(SILENT) $(CXX) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" $(OBJDIR)/hello1.o: src/hello.cpp @echo $(notdir $<) - $(SILENT) $(CXX) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF $(@:%.o=%.d) -c "$<" + $(SILENT) $(CXX) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" ]] end @@ -54,10 +55,10 @@ $(OBJDIR)/hello1.o: src/hello.cpp test.capture [[ $(OBJDIR)/hello.o: src/hello.c @echo $(notdir $<) - $(SILENT) $(CC) $(ALL_CFLAGS) $(FORCE_INCLUDE) -o "$@" -MF $(@:%.o=%.d) -c "$<" + $(SILENT) $(CC) $(ALL_CFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" $(OBJDIR)/test.o: src/test.cpp @echo $(notdir $<) - $(SILENT) $(CXX) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF $(@:%.o=%.d) -c "$<" + $(SILENT) $(CXX) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" ]] end