Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/windirstat/premake-4.x-stable.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorstarkos <none@none>2009-05-29 21:45:37 +0400
committerstarkos <none@none>2009-05-29 21:45:37 +0400
commit9a64d401a70a5475e825bcf7ced15ec8a8dbdcb4 (patch)
treed92ec5956c587ccaf866a00260fc7e40e5756cb5
parent250f21057fb6a2158fecbb820e6e03dc76469dd9 (diff)
Enable parenthesis in file paths
-rw-r--r--CHANGES.txt1
-rw-r--r--samples/project/CppConsoleApp/premake4.lua6
-rw-r--r--src/actions/make/_make.lua34
-rw-r--r--src/actions/make/make_cpp.lua22
-rw-r--r--src/actions/make/make_csharp.lua59
5 files changed, 63 insertions, 59 deletions
diff --git a/CHANGES.txt b/CHANGES.txt
index 951a829..76fdf96 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -17,6 +17,7 @@
- Patch 2609028: verbose linking in makefile (kaidokert)
- Bug 2564404: FatalWarnings has no effect with gmake target
- Bug 2550759: pchheader option has wrong type
+- Bug 1900333: Parentheses in build path
-----
diff --git a/samples/project/CppConsoleApp/premake4.lua b/samples/project/CppConsoleApp/premake4.lua
index 62dae97..d4e799f 100644
--- a/samples/project/CppConsoleApp/premake4.lua
+++ b/samples/project/CppConsoleApp/premake4.lua
@@ -13,3 +13,9 @@ project "CppConsoleApp"
links { "CppSharedLib" }
pchheader "CppConsoleApp.h"
+
+ configuration "Debug"
+ targetdir "../bin/debug (x64)"
+
+ configuration "Release"
+ targetdir "../bin/release (x64)" \ No newline at end of file
diff --git a/src/actions/make/_make.lua b/src/actions/make/_make.lua
index a449f6d..f163211 100644
--- a/src/actions/make/_make.lua
+++ b/src/actions/make/_make.lua
@@ -20,8 +20,10 @@
return result
else
local result
- result = value:gsub(" ", "\\ ")
- result = result:gsub("\\", "\\\\")
+ result = value:gsub("\\", "\\\\")
+ result = result:gsub(" ", "\\ ")
+ result = result:gsub("%(", "\\%(")
+ result = result:gsub("%)", "\\%)")
return result
end
end
@@ -29,6 +31,34 @@
--
+-- Rules for file ops based on the shell type. Can't use defines and $@ because
+-- it screws up the escaping of spaces and parethesis (anyone know a solution?)
+--
+
+ function premake.make_copyrule(source, target)
+ _p('%s: %s', target, source)
+ _p('\t@echo Copying $(notdir %s)', target)
+ _p('ifeq (posix,$(SHELLTYPE))')
+ _p('\t$(SILENT) cp -fR %s %s', source, target)
+ _p('else')
+ _p('\t$(SILENT) copy /Y $(subst /,\\\\,%s) $(subst /,\\\\,%s)', source, target)
+ _p('endif')
+ _p('')
+ end
+
+ function premake.make_mkdirrule(var)
+ _p('\t@echo Creating %s', var)
+ _p('ifeq (posix,$(SHELLTYPE))')
+ _p('\t$(SILENT) mkdir -p %s', var)
+ _p('else')
+ _p('\t$(SILENT) mkdir $(subst /,\\\\,%s)', var)
+ _p('endif')
+ _p('')
+ end
+
+
+
+--
-- Get the makefile file name for a solution or a project. If this object is the
-- only one writing to a location then I can use "Makefile". If more than one object
-- writes to the same location I use name + ".make" to keep it unique.
diff --git a/src/actions/make/make_cpp.lua b/src/actions/make/make_cpp.lua
index 608f27e..d01d66b 100644
--- a/src/actions/make/make_cpp.lua
+++ b/src/actions/make/make_cpp.lua
@@ -36,7 +36,7 @@
end
_p('')
- -- set up support commands like mkdir, rmdir, etc. based on the shell
+ -- identify the shell type
_p('SHELLTYPE := msdos')
_p('ifeq (,$(ComSpec)$(COMSPEC))')
_p(' SHELLTYPE := posix')
@@ -44,17 +44,6 @@
_p('ifeq (/bin,$(findstring /bin,$(SHELL)))')
_p(' SHELLTYPE := posix')
_p('endif')
- _p('ifeq (posix,$(SHELLTYPE))')
- _p(' define MKDIR_RULE')
- _p('\t@echo Creating $@')
- _p('\t$(SILENT) mkdir -p $@')
- _p(' endef')
- _p('else')
- _p(' define MKDIR_RULE')
- _p('\t@echo Creating $@')
- _p('\t$(SILENT) mkdir $(subst /,\\\\,$@)')
- _p(' endef')
- _p('endif')
_p('')
-- main build rule(s)
@@ -75,14 +64,13 @@
_p('\t$(POSTBUILDCMDS)')
_p('')
- -- create destination directories
+ -- Create destination directories. Can't use $@ for this because it loses the
+ -- escaping, causing issues with spaces and parenthesis
_p('$(TARGETDIR):')
- _p('\t$(MKDIR_RULE)')
- _p('')
+ premake.make_mkdirrule("$(TARGETDIR)")
_p('$(OBJDIR):')
- _p('\t$(MKDIR_RULE)')
- _p('')
+ premake.make_mkdirrule("$(OBJDIR)")
-- Mac OS X specific targets
if os.is("MacOSX") and prj.kind == "WindowedApp" then
diff --git a/src/actions/make/make_csharp.lua b/src/actions/make/make_csharp.lua
index cd5a1c3..7f1557c 100644
--- a/src/actions/make/make_csharp.lua
+++ b/src/actions/make/make_csharp.lua
@@ -16,13 +16,14 @@
if dir ~= "." then
name = name .. path.translate(dir, ".") .. "."
end
- return "$(OBJDIR)/" .. name .. path.getbasename(fname) .. ".resources"
+ return "$(OBJDIR)/" .. _MAKE.esc(name .. path.getbasename(fname)) .. ".resources"
else
return fname
end
end
+
--
-- Main function
--
@@ -42,7 +43,7 @@
cfgpairs[cfg] = { }
for _, fname in ipairs(cfglibs[cfg]) do
if path.getdirectory(fname) ~= cfg.buildtarget.directory then
- cfgpairs[cfg]["$(TARGETDIR)/"..path.getname(fname)] = fname
+ cfgpairs[cfg]["$(TARGETDIR)/" .. _MAKE.esc(path.getname(fname))] = _MAKE.esc(fname)
end
end
end
@@ -59,9 +60,9 @@
elseif action == "EmbeddedResource" then
table.insert(embedded, fcfg.name)
elseif action == "Content" then
- copypairs["$(TARGETDIR)/"..path.getname(fcfg.name)] = fcfg.name
+ copypairs["$(TARGETDIR)/" .. _MAKE.esc(path.getname(fcfg.name))] = _MAKE.esc(fcfg.name)
elseif path.getname(fcfg.name):lower() == "app.config" then
- copypairs["$(TARGET).config"] = fcfg.name
+ copypairs["$(TARGET).config"] = _MAKE.esc(fcfg.name)
end
end
@@ -72,9 +73,9 @@
for _, libname in ipairs(premake.getlinks(prj, "system", "fullpath")) do
local libdir = os.pathsearch(libname..".dll", unpack(paths))
if (libdir) then
- local target = "$(TARGETDIR)/"..path.getname(libname)
+ local target = "$(TARGETDIR)/" .. _MAKE.esc(path.getname(libname))
local source = path.getrelative(prj.basedir, path.join(libdir, libname))..".dll"
- copypairs[target] = source
+ copypairs[target] = _MAKE.esc(source)
end
end
@@ -161,20 +162,20 @@
_p('EMBEDFILES := \\')
for _, fname in ipairs(embedded) do
- _p('\t%s \\', _MAKE.esc(getresourcefilename(prj, fname)))
+ _p('\t%s \\', getresourcefilename(prj, fname))
end
_p('')
_p('COPYFILES += \\')
for target, source in pairs(cfgpairs[anycfg]) do
- _p('\t%s \\', _MAKE.esc(target))
+ _p('\t%s \\', target)
end
for target, source in pairs(copypairs) do
- _p('\t%s \\', _MAKE.esc(target))
+ _p('\t%s \\', target)
end
_p('')
- -- set up support commands like mkdir, rmdir, etc. based on the shell
+ -- identify the shell type
_p('SHELLTYPE := msdos')
_p('ifeq (,$(ComSpec)$(COMSPEC))')
_p(' SHELLTYPE := posix')
@@ -182,25 +183,7 @@
_p('ifeq (/bin,$(findstring /bin,$(SHELL)))')
_p(' SHELLTYPE := posix')
_p('endif')
- _p('ifeq (posix,$(SHELLTYPE))')
- _p(' define MKDIR_RULE')
- _p('\t@echo Creating $@')
- _p('\t$(SILENT) mkdir -p $@')
- _p(' endef')
- _p(' define COPY_RULE')
- _p('\t@echo Copying $(notdir $@)')
- _p('\t$(SILENT) cp -fR $^ $@')
- _p(' endef')
- _p('else')
- _p(' define MKDIR_RULE')
- _p('\t@echo Creating $@')
- _p('\t$(SILENT) mkdir $(subst /,\\\\,$@)')
- _p(' endef')
- _p(' define COPY_RULE')
- _p('\t@echo Copying $(notdir $@)')
- _p('\t$(SILENT) copy /Y $(subst /,\\\\,$^) $(subst /,\\\\,$@)')
- _p(' endef')
- _p('endif')
+ _p('')
-- main build rule(s)
_p('.PHONY: clean prebuild prelink')
@@ -214,14 +197,13 @@
_p('\t$(POSTBUILDCMDS)')
_p('')
- -- create destination directories
+ -- Create destination directories. Can't use $@ for this because it loses the
+ -- escaping, causing issues with spaces and parenthesis
_p('$(TARGETDIR):')
- _p('\t$(MKDIR_RULE)')
- _p('')
+ premake.make_mkdirrule("$(TARGETDIR)")
_p('$(OBJDIR):')
- _p('\t$(MKDIR_RULE)')
- _p('')
+ premake.make_mkdirrule("$(OBJDIR)")
-- clean target
_p('clean:')
@@ -255,8 +237,7 @@
for cfg in premake.eachconfig(prj) do
_p('ifneq (,$(findstring %s,$(config)))', _MAKE.esc(cfg.name:lower()))
for target, source in pairs(cfgpairs[cfg]) do
- _p('%s: %s', _MAKE.esc(target), _MAKE.esc(source))
- _p('\t$(COPY_RULE)')
+ premake.make_copyrule(source, target)
end
_p('endif')
end
@@ -264,15 +245,13 @@
_p('# Copied file rules')
for target, source in pairs(copypairs) do
- _p('%s: %s', _MAKE.esc(target), _MAKE.esc(source))
- _p('\t$(COPY_RULE)')
- _p('')
+ premake.make_copyrule(source, target)
end
_p('# Embedded file rules')
for _, fname in ipairs(embedded) do
if path.getextension(fname) == ".resx" then
- _p('%s: %s', _MAKE.esc(getresourcefilename(prj, fname)), _MAKE.esc(fname))
+ _p('%s: %s', getresourcefilename(prj, fname), _MAKE.esc(fname))
_p('\t$(SILENT) $(RESGEN) $^ $@')
end
_p('')