diff options
author | Oliver Schneider <oliver@assarbad.net> | 2015-11-09 01:03:49 +0300 |
---|---|---|
committer | Oliver Schneider <oliver@assarbad.net> | 2015-11-09 01:03:49 +0300 |
commit | 35861301093da54e4b7f5112c0660a678467c92f (patch) | |
tree | 507760552cf2bf3f60be42f674130c07779328d2 | |
parent | 8f7c5ef2c61da06038f4d8314af64b4b548757b5 (diff) | |
parent | c04a1a0f6c98c119febb3e1ac479dfe38dcaa279 (diff) |
Merge with upstream
--HG--
branch : WDS-build
-rw-r--r-- | .gitignore | 3 | ||||
-rw-r--r-- | .hgignore | 6 | ||||
-rw-r--r-- | Premake4.vs8.sln | 10 | ||||
-rw-r--r-- | Premake4.vs8.vcproj | 37 | ||||
-rw-r--r-- | src/actions/make/make_cpp.lua | 6 | ||||
-rw-r--r-- | src/base/os.lua | 11 | ||||
-rw-r--r-- | src/base/path.lua | 182 | ||||
-rw-r--r-- | src/host/os_getcwd.c | 34 | ||||
-rw-r--r-- | src/host/path_getabsolute.c | 102 | ||||
-rw-r--r-- | src/host/path_getrelative.c | 80 | ||||
-rw-r--r-- | src/host/path_isabsolute.c | 25 | ||||
-rw-r--r-- | src/host/path_join.c | 58 | ||||
-rw-r--r-- | src/host/path_normalize.c | 77 | ||||
-rw-r--r-- | src/host/path_translate.c | 61 | ||||
-rwxr-xr-x | src/host/premake.c | 38 | ||||
-rwxr-xr-x | src/host/premake.h | 10 | ||||
-rw-r--r-- | tests/actions/make/test_make_pch.lua | 4 | ||||
-rw-r--r-- | tests/actions/make/test_wiidev.lua | 2 | ||||
-rw-r--r-- | tests/actions/vstudio/cs2005/buildevents.lua | 53 | ||||
-rw-r--r-- | tests/actions/vstudio/test_vs2010_vcxproj.lua | 11 | ||||
-rw-r--r-- | tests/base/test_os.lua | 39 | ||||
-rw-r--r-- | tests/base/test_path.lua | 56 | ||||
-rw-r--r-- | tests/premake4.lua | 1 | ||||
-rw-r--r-- | tests/test_gmake_cpp.lua | 14 |
24 files changed, 653 insertions, 267 deletions
@@ -2,6 +2,7 @@ syntax: glob .DS_Store +*.bak *.orig *~ @@ -11,6 +12,8 @@ obj release ipch src/host/scripts.c +**.lnt +**.vlstatus Makefile *.make @@ -2,12 +2,18 @@ syntax: glob .DS_Store +*.bak +*.orig +*~ + build bin obj release ipch src/host/scripts.c +**.lnt +**.vlstatus Makefile *.make diff --git a/Premake4.vs8.sln b/Premake4.vs8.sln index c4b2b6f..b76fa95 100644 --- a/Premake4.vs8.sln +++ b/Premake4.vs8.sln @@ -1,7 +1,7 @@
Microsoft Visual Studio Solution File, Format Version 9.00
# Visual Studio 2005
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Premake4", "Premake4.vs8.vcproj", "{7F000221-EACC-2F4F-A07F-6A5D34AF10D0}"
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Premake4", "Premake4.vs8.vcproj", "{64EE433E-8C53-C641-BAB8-F3505BBA6F24}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
@@ -9,10 +9,10 @@ Global Debug|Win32 = Debug|Win32
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
- {7F000221-EACC-2F4F-A07F-6A5D34AF10D0}.Release|Win32.ActiveCfg = Release|Win32
- {7F000221-EACC-2F4F-A07F-6A5D34AF10D0}.Release|Win32.Build.0 = Release|Win32
- {7F000221-EACC-2F4F-A07F-6A5D34AF10D0}.Debug|Win32.ActiveCfg = Debug|Win32
- {7F000221-EACC-2F4F-A07F-6A5D34AF10D0}.Debug|Win32.Build.0 = Debug|Win32
+ {64EE433E-8C53-C641-BAB8-F3505BBA6F24}.Release|Win32.ActiveCfg = Release|Win32
+ {64EE433E-8C53-C641-BAB8-F3505BBA6F24}.Release|Win32.Build.0 = Release|Win32
+ {64EE433E-8C53-C641-BAB8-F3505BBA6F24}.Debug|Win32.ActiveCfg = Debug|Win32
+ {64EE433E-8C53-C641-BAB8-F3505BBA6F24}.Debug|Win32.Build.0 = Debug|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
diff --git a/Premake4.vs8.vcproj b/Premake4.vs8.vcproj index 1ef69a0..d82fe26 100644 --- a/Premake4.vs8.vcproj +++ b/Premake4.vs8.vcproj @@ -3,7 +3,7 @@ ProjectType="Visual C++"
Version="8.00"
Name="Premake4"
- ProjectGUID="{7F000221-EACC-2F4F-A07F-6A5D34AF10D0}"
+ ProjectGUID="{64EE433E-8C53-C641-BAB8-F3505BBA6F24}"
RootNamespace="Premake4"
Keyword="Win32Proj"
>
@@ -99,7 +99,7 @@ />
<Tool
Name="VCPostBuildEventTool"
- CommandLine="signtool.exe sign /v /a /ph /d "premake4" /du "https://bitbucket.org/windirstat/premake-stable" /tr http://www.startssl.com/timestamp "$(TargetPath)""
+ CommandLine="ollisign.cmd "$(TargetPath)" "https://bitbucket.org/windirstat/premake-stable" "premake4""
/>
</Configuration>
<Configuration
@@ -288,6 +288,15 @@ RelativePath="scripts\embed.lua"
>
</File>
+ <Filter
+ Name="luasrcdiet"
+ Filter=""
+ >
+ <File
+ RelativePath="scripts\luasrcdiet\LuaSrcDiet.lua"
+ >
+ </File>
+ </Filter>
<File
RelativePath="scripts\release.lua"
>
@@ -825,10 +834,30 @@ >
</File>
<File
+ RelativePath="src\host\path_getabsolute.c"
+ >
+ </File>
+ <File
+ RelativePath="src\host\path_getrelative.c"
+ >
+ </File>
+ <File
RelativePath="src\host\path_isabsolute.c"
>
</File>
<File
+ RelativePath="src\host\path_join.c"
+ >
+ </File>
+ <File
+ RelativePath="src\host\path_normalize.c"
+ >
+ </File>
+ <File
+ RelativePath="src\host\path_translate.c"
+ >
+ </File>
+ <File
RelativePath="src\host\premake.c"
>
</File>
@@ -960,6 +989,10 @@ Filter=""
>
<File
+ RelativePath="tests\actions\vstudio\cs2005\buildevents.lua"
+ >
+ </File>
+ <File
RelativePath="tests\actions\vstudio\cs2005\projectelement.lua"
>
</File>
diff --git a/src/actions/make/make_cpp.lua b/src/actions/make/make_cpp.lua index 4caf055..2761810 100644 --- a/src/actions/make/make_cpp.lua +++ b/src/actions/make/make_cpp.lua @@ -239,7 +239,7 @@ _p(' ALL_CPPFLAGS += $(CPPFLAGS) %s $(DEFINES) $(INCLUDES)', table.concat(cc.getcppflags(cfg), " ")) - _p(' ALL_CFLAGS += $(CFLAGS) $(ALL_CPPFLAGS) $(ARCH)%s', make.list(table.join(cc.getcflags(cfg), cfg.buildoptions))) + _p(' ALL_CFLAGS += $(CFLAGS) $(ALL_CPPFLAGS)%s', make.list(table.join(cc.getcflags(cfg), cfg.buildoptions))) _p(' ALL_CXXFLAGS += $(CXXFLAGS) $(ALL_CFLAGS)%s', make.list(cc.getcxxflags(cfg))) _p(' ALL_RESFLAGS += $(RESFLAGS) $(DEFINES) $(INCLUDES)%s', @@ -274,7 +274,7 @@ -- $(LIBS) moved to end (http://sourceforge.net/p/premake/bugs/279/) local tool = iif(cfg.language == "C", "CC", "CXX") - _p(' LINKCMD = $(%s) -o $(TARGET) $(OBJECTS) $(RESOURCES) $(ARCH) $(ALL_LDFLAGS) $(LIBS)', tool) + _p(' LINKCMD = $(%s) -o $(TARGET) $(OBJECTS) $(RESOURCES) $(ALL_LDFLAGS) $(LIBS)', tool) end end @@ -358,5 +358,5 @@ function cpp.buildcommand(iscfile, objext) local flags = iif(iscfile, '$(CC) $(ALL_CFLAGS)', '$(CXX) $(ALL_CXXFLAGS)') - _p('\t$(SILENT) %s $(FORCE_INCLUDE) -o "$@" -MF $(@:%%.%s=%%.d) -c "$<"', flags, objext) + _p('\t$(SILENT) %s $(FORCE_INCLUDE) -o "$@" -MF "$(@:%%.%s=%%.d)" -c "$<"', flags, objext) end diff --git a/src/base/os.lua b/src/base/os.lua index deff1d0..9332072 100644 --- a/src/base/os.lua +++ b/src/base/os.lua @@ -192,9 +192,10 @@ while (os.matchnext(m)) do
local isfile = os.matchisfile(m)
if ((wantfiles and isfile) or (not wantfiles and not isfile)) then
- local fname = path.join(basedir, os.matchname(m))
- if fname:match(mask) == fname then
- table.insert(result, fname)
+ local basename = os.matchname(m)
+ local fullname = path.join(basedir, basename)
+ if basename ~= ".." and fullname:match(mask) == fullname then
+ table.insert(result, fullname)
end
end
end
@@ -206,7 +207,9 @@ while (os.matchnext(m)) do
if not os.matchisfile(m) then
local dirname = os.matchname(m)
- matchwalker(path.join(basedir, dirname))
+ if (not dirname:startswith(".")) then
+ matchwalker(path.join(basedir, dirname))
+ end
end
end
os.matchdone(m)
diff --git a/src/base/path.lua b/src/base/path.lua index 14d00f6..508e8be 100644 --- a/src/base/path.lua +++ b/src/base/path.lua @@ -6,43 +6,6 @@ -- --- Get the absolute file path from a relative path. The requested --- file path doesn't actually need to exist. --- - - function path.getabsolute(p) - -- normalize the target path - p = path.translate(p, "/") - if (p == "") then p = "." end - - -- if the directory is already absolute I don't need to do anything - local result = iif (path.isabsolute(p), nil, os.getcwd()) - - -- split up the supplied relative path and tackle it bit by bit - for n, part in ipairs(p:explode("/", true)) do - if (part == "" and n == 1) then - result = "/" - elseif (part == "..") then - result = path.getdirectory(result) - elseif (part ~= ".") then - -- Environment variables embedded in the path need to be treated - -- as relative paths; path.join() makes them absolute - if (part:startswith("$") and n > 1) then - result = result .. "/" .. part - else - result = path.join(result, part) - end - end - end - - -- if I end up with a trailing slash remove it - result = iif(result:endswith("/"), result:sub(1, -2), result) - - return result - end - - --- -- Retrieve the filename portion of a path, without any extension. -- @@ -55,10 +18,10 @@ return name end end - - + + -- --- Retrieve the directory portion of a path, or an empty string if +-- Retrieve the directory portion of a path, or an empty string if -- the path does not include a directory. -- @@ -99,9 +62,9 @@ return "" end end - - - + + + -- -- Retrieve the filename portion of a path. -- @@ -114,71 +77,7 @@ return p end end - - --- --- Returns the relative path from src to dest. --- - - function path.getrelative(src, dst) - -- normalize the two paths - src = path.getabsolute(src) - dst = path.getabsolute(dst) - - -- same directory? - if (src == dst) then - return "." - end - - -- dollar macro? Can't tell what the real path is; use absolute - -- This enables paths like $(SDK_ROOT)/include to work correctly. - if dst:startswith("$") then - return dst - end - - src = src .. "/" - dst = dst .. "/" - - -- find the common leading directories - local idx = 0 - while (true) do - local tst = src:find("/", idx + 1, true) - if tst then - if src:sub(1,tst) == dst:sub(1,tst) then - idx = tst - else - break - end - else - break - end - end - - -- if they have nothing in common return absolute path - local first = src:find("/", 0, true) - if idx <= first then - return dst:sub(1, -2) - end - - -- trim off the common directories from the front - src = src:sub(idx + 1) - dst = dst:sub(idx + 1) - - -- back up from dst to get to this common parent - local result = "" - idx = src:find("/") - while (idx) do - result = result .. "../" - idx = src:find("/", idx + 1) - end - - -- tack on the path down to the dst from here - result = result .. dst - -- remove the trailing slash - return result:sub(1, -2) - end - -- -- Returns true if the filename represents a C/C++ source code file. This check @@ -191,13 +90,13 @@ local ext = path.getextension(fname):lower() return table.contains(extensions, ext) end - + function path.iscppfile(fname) local extensions = { ".cc", ".cpp", ".cxx", ".c", ".s", ".m", ".mm" } local ext = path.getextension(fname):lower() return table.contains(extensions, ext) end - + function path.iscppheader(fname) local extensions = { ".h", ".hh", ".hpp", ".hxx" } local ext = path.getextension(fname):lower() @@ -217,40 +116,6 @@ return table.contains(extensions, ext) end - --- --- Join one or more pieces of a path together into a single path. --- --- @param ... --- One or more path strings. --- @return --- The joined path. --- - - function path.join(...) - local numargs = select("#", ...) - if numargs == 0 then - return ""; - end - - local allparts = {} - for i = numargs, 1, -1 do - local part = select(i, ...) - if part and #part > 0 and part ~= "." then - -- trim off trailing slashes - while part:endswith("/") do - part = part:sub(1, -2) - end - - table.insert(allparts, 1, part) - if path.isabsolute(part) then - break - end - end - end - - return table.concat(allparts, "/") - end -- @@ -263,31 +128,24 @@ p = path.getrelative(newbase, p) return p end - - + + -- -- Convert the separators in a path from one form to another. If `sep` -- is nil, then a platform-specific separator is used. -- + local builtin_translate = path.translate + function path.translate(p, sep) - if (type(p) == "table") then - local result = { } - for _, value in ipairs(p) do - table.insert(result, path.translate(value)) - end - return result - else - if (not sep) then - if (os.is("windows")) then - sep = "\\" - else - sep = "/" - end + if not sep then + if os.is("windows") then + sep = "\\" + else + sep = "/" end - local result = p:gsub("[/\\]", sep) - return result end + return builtin_translate(p, sep) end @@ -309,10 +167,10 @@ -- have competing star replacements to worry about pattern = pattern:gsub("%*%*", "\001") pattern = pattern:gsub("%*", "\002") - + -- Replace the placeholders with their Lua patterns pattern = pattern:gsub("\001", ".*") pattern = pattern:gsub("\002", "[^/]*") - + return pattern end diff --git a/src/host/os_getcwd.c b/src/host/os_getcwd.c index 06c91a2..de8bfbd 100644 --- a/src/host/os_getcwd.c +++ b/src/host/os_getcwd.c @@ -9,26 +9,28 @@ int os_getcwd(lua_State* L) { char buffer[0x4000]; - char* ch; + if (do_getcwd(buffer, 0x4000)) { + lua_pushstring(L, buffer); + return 1; + } + else { + return 0; + } +} + + +int do_getcwd(char* buffer, size_t size) +{ int result; #if PLATFORM_WINDOWS - result = (GetCurrentDirectory(0x4000, buffer) != 0); + result = (GetCurrentDirectory(size, buffer) != 0); + if (result) { + do_translate(buffer, '/'); + } #else - result = (getcwd(buffer, 0x4000) != 0); + result = (getcwd(buffer, size) != 0); #endif - if (!result) - return 0; - - /* convert to platform-neutral directory separators */ - for (ch = buffer; *ch != '\0'; ++ch) - { - if (*ch == '\\') *ch = '/'; - } - - lua_pushstring(L, buffer); - return 1; + return result; } - - diff --git a/src/host/path_getabsolute.c b/src/host/path_getabsolute.c new file mode 100644 index 0000000..36b1c3a --- /dev/null +++ b/src/host/path_getabsolute.c @@ -0,0 +1,102 @@ +/** + * \file path_getabsolute.c + * \brief Returns an absolute version of a relative path. + * \author Copyright (c) 2002-2013 Jason Perkins and the Premake project + */ + +#include "premake.h" +#include <string.h> + + +void do_getabsolute(char* result, const char* value, const char* relative_to) +{ + int i; + char* ch; + char* prev; + char buffer[0x4000] = { '\0' }; + + /* if the path is not already absolute, base it on working dir */ + if (!do_isabsolute(value)) { + if (relative_to) { + strcpy(buffer, relative_to); + } + else { + do_getcwd(buffer, 0x4000); + } + strcat(buffer, "/"); + } + + /* normalize the path */ + strcat(buffer, value); + do_translate(buffer, '/'); + + /* process it part by part */ + result[0] = '\0'; + if (buffer[0] == '/') { + strcat(result, "/"); + } + + prev = NULL; + ch = strtok(buffer, "/"); + while (ch) { + /* remove ".." where I can */ + if (strcmp(ch, "..") == 0 && (prev == NULL || (prev[0] != '$' && strcmp(prev, "..") != 0))) { + i = strlen(result) - 2; + while (i >= 0 && result[i] != '/') { + --i; + } + if (i >= 0) { + result[i + 1] = '\0'; + } + ch = NULL; + } + + /* allow everything except "." */ + else if (strcmp(ch, ".") != 0) { + strcat(result, ch); + strcat(result, "/"); + } + + prev = ch; + ch = strtok(NULL, "/"); + } + + /* remove trailing slash */ + i = strlen(result) - 1; + if (result[i] == '/') { + result[i] = '\0'; + } +} + + +int path_getabsolute(lua_State* L) +{ + const char* relative_to; + char buffer[0x4000]; + + relative_to = NULL; + if (lua_gettop(L) > 1 && !lua_isnil(L,2)) { + relative_to = luaL_checkstring(L, 2); + } + + if (lua_istable(L, 1)) { + int i = 0; + lua_newtable(L); + lua_pushnil(L); + while (lua_next(L, 1)) { + const char* value = luaL_checkstring(L, -1); + do_getabsolute(buffer, value, relative_to); + lua_pop(L, 1); + + lua_pushstring(L, buffer); + lua_rawseti(L, -3, ++i); + } + return 1; + } + else { + const char* value = luaL_checkstring(L, 1); + do_getabsolute(buffer, value, relative_to); + lua_pushstring(L, buffer); + return 1; + } +} diff --git a/src/host/path_getrelative.c b/src/host/path_getrelative.c new file mode 100644 index 0000000..dc6629b --- /dev/null +++ b/src/host/path_getrelative.c @@ -0,0 +1,80 @@ +/** + * \file path_getrelative.c + * \brief Returns a path relative to another. + * \author Copyright (c) 2002-2013 Jason Perkins and the Premake project + */ + +#include "premake.h" +#include <string.h> + + +int path_getrelative(lua_State* L) +{ + int i, last, count; + char src[0x4000]; + char dst[0x4000]; + + const char* p1 = luaL_checkstring(L, 1); + const char* p2 = luaL_checkstring(L, 2); + + /* normalize the paths */ + do_getabsolute(src, p1, NULL); + do_getabsolute(dst, p2, NULL); + + /* same directory? */ + if (strcmp(src, dst) == 0) { + lua_pushstring(L, "."); + return 1; + } + + /* dollar macro? Can't tell what the real path might be, so treat + * as absolute. This enables paths like $(SDK_ROOT)/include to + * work as expected. */ + if (dst[0] == '$') { + lua_pushstring(L, dst); + return 1; + } + + /* find the common leading directories */ + strcat(src, "/"); + strcat(dst, "/"); + + last = -1; + i = 0; + while (src[i] && dst[i] && src[i] == dst[i]) { + if (src[i] == '/') { + last = i; + } + ++i; + } + + /* if I end up with just the root of the filesystem, either a single + * slash (/) or a drive letter (c:) then return the absolute path. */ + if (last <= 0 || (last == 2 && src[1] == ':')) { + dst[strlen(dst) - 1] = '\0'; + lua_pushstring(L, dst); + return 1; + } + + /* count remaining levels in src */ + count = 0; + for (i = last + 1; src[i] != '\0'; ++i) { + if (src[i] == '/') { + ++count; + } + } + + /* start my result by backing out that many levels */ + src[0] = '\0'; + for (i = 0; i < count; ++i) { + strcat(src, "../"); + } + + /* append what's left */ + strcat(src, dst + last + 1); + + /* remove trailing slash and done */ + src[strlen(src) - 1] = '\0'; + lua_pushstring(L, src); + return 1; +} diff --git a/src/host/path_isabsolute.c b/src/host/path_isabsolute.c index 961ed77..7412935 100644 --- a/src/host/path_isabsolute.c +++ b/src/host/path_isabsolute.c @@ -1,7 +1,7 @@ /** * \file path_isabsolute.c * \brief Determines if a path is absolute or relative. - * \author Copyright (c) 2002-2009 Jason Perkins and the Premake project + * \author Copyright (c) 2002-2013 Jason Perkins and the Premake project */ #include "premake.h" @@ -10,13 +10,18 @@ int path_isabsolute(lua_State* L) { const char* path = luaL_checkstring(L, -1); - if (path[0] == '/' || path[0] == '\\' || path[0] == '$' || (path[0] != '\0' && path[1] == ':')) - { - lua_pushboolean(L, 1); - return 1; - } - else - { - return 0; - } + lua_pushboolean(L, do_isabsolute(path)); + return 1; +} + + +int do_isabsolute(const char* path) +{ + return ( + path[0] == '/' || + path[0] == '\\' || + path[0] == '$' || + (path[0] == '"' && path[1] == '$') || + (path[0] != '\0' && path[1] == ':') + ); } diff --git a/src/host/path_join.c b/src/host/path_join.c new file mode 100644 index 0000000..7d80104 --- /dev/null +++ b/src/host/path_join.c @@ -0,0 +1,58 @@ +/** + * \file path_join.c + * \brief Join two or more pieces of a file system path. + * \author Copyright (c) 2002-2013 Jason Perkins and the Premake project + */ + +#include "premake.h" +#include <string.h> + + +int path_join(lua_State* L) +{ + int i, len; + const char* part; + char buffer[0x4000]; + char* ptr = buffer; + + /* for each argument... */ + int argc = lua_gettop(L); + for (i = 1; i <= argc; ++i) { + /* if next argument is nil, skip it */ + if (lua_isnil(L, i)) { + continue; + } + + /* grab the next argument */ + part = luaL_checkstring(L, i); + len = strlen(part); + + /* remove trailing slashes */ + while (len > 1 && part[len - 1] == '/') { + --len; + } + + /* ignore empty segments and "." */ + if (len == 0 || (len == 1 && part[0] == '.')) { + continue; + } + + /* if I encounter an absolute path, restart my result */ + if (do_isabsolute(part)) { + ptr = buffer; + } + + /* if the path is already started, split parts */ + if (ptr != buffer && *(ptr - 1) != '/') { + *(ptr++) = '/'; + } + + /* append new part */ + strcpy(ptr, part); + ptr += len; + } + + *ptr = '\0'; + lua_pushstring(L, buffer); + return 1; +} diff --git a/src/host/path_normalize.c b/src/host/path_normalize.c new file mode 100644 index 0000000..64c5cf2 --- /dev/null +++ b/src/host/path_normalize.c @@ -0,0 +1,77 @@ +/** + * \file path_normalize.c + * \brief Removes any weirdness from a file system path string. + * \author Copyright (c) 2013 Jason Perkins and the Premake project + */ + +#include "premake.h" +#include <string.h> + + +int path_normalize(lua_State* L) +{ + char buffer[0x4000]; + char* src; + char* dst; + char last; + + const char* path = luaL_checkstring(L, 1); + strcpy(buffer, path); + + src = buffer; + dst = buffer; + last = '\0'; + + while (*src != '\0') { + char ch = (*src); + + /* make sure we're using '/' for all separators */ + if (ch == '\\') { + ch = '/'; + } + + /* add to the result, filtering out duplicate slashes */ + if (ch != '/' || last != '/') { + *(dst++) = ch; + } + + /* ...except at the start of a string, for UNC paths */ + if (src != buffer) { + last = (*src); + } + + ++src; + } + + /* remove any trailing slashes */ + for (--src; src > buffer && *src == '/'; --src) { + *src = '\0'; + } + + /* remove any leading "./" sequences */ + src = buffer; + while (strncmp(src, "./", 2) == 0) { + src += 2; + } + + *dst = '\0'; + lua_pushstring(L, src); + return 1; +} + + +/* Call the scripted path.normalize(), to allow for overrides */ +void do_normalize(lua_State* L, char* buffer, const char* path) +{ + int top = lua_gettop(L); + + lua_getglobal(L, "path"); + lua_getfield(L, -1, "normalize"); + lua_pushstring(L, path); + lua_call(L, 1, 1); + + path = luaL_checkstring(L, -1); + strcpy(buffer, path); + + lua_settop(L, top); +} diff --git a/src/host/path_translate.c b/src/host/path_translate.c new file mode 100644 index 0000000..8996b37 --- /dev/null +++ b/src/host/path_translate.c @@ -0,0 +1,61 @@ +/** + * \file path_translate.c + * \brief Translates between path separators. + * \author Copyright (c) 2002-2013 Jason Perkins and the Premake project + */ + +#include "premake.h" +#include <string.h> + + +void do_translate(char* value, const char sep) +{ + char* ch; + for (ch = value; *ch != '\0'; ++ch) { + if (*ch == '/' || *ch == '\\') { + *ch = sep; + } + } +} + + +static void translate(char* result, const char* value, const char sep) +{ + strcpy(result, value); + do_translate(result, sep); +} + + +int path_translate(lua_State* L) +{ + const char* sep; + char buffer[0x4000]; + + if (lua_gettop(L) == 1) { + sep = "\\"; + } + else { + sep = luaL_checkstring(L, 2); + } + + if (lua_istable(L, 1)) { + int i = 0; + lua_newtable(L); + lua_pushnil(L); + while (lua_next(L, 1)) { + const char* value = luaL_checkstring(L, 4); + translate(buffer, value, sep[0]); + lua_pop(L, 1); + + lua_pushstring(L, buffer); + lua_rawseti(L, -3, ++i); + } + return 1; + } + else { + const char* value = luaL_checkstring(L, 1); + translate(buffer, value, sep[0]); + lua_pushstring(L, buffer); + return 1; + } +} diff --git a/src/host/premake.c b/src/host/premake.c index ac27566..9e30d50 100755 --- a/src/host/premake.c +++ b/src/host/premake.c @@ -20,6 +20,7 @@ static int process_arguments(lua_State* L, int argc, const char** argv); static int process_option(lua_State* L, const char* arg); +static int load_file_scripts(lua_State* L); static int load_builtin_scripts(lua_State* L); int premake_locate(lua_State* L, const char* argv0); @@ -35,7 +36,12 @@ extern const char* builtin_scripts[]; /* Built-in functions */ static const luaL_Reg path_functions[] = { + { "getabsolute", path_getabsolute }, + { "getrelative", path_getrelative }, { "isabsolute", path_isabsolute }, + { "join", path_join }, + { "normalize", path_normalize }, + { "translate", path_translate }, { NULL, NULL } }; @@ -99,8 +105,22 @@ int premake_execute(lua_State* L, int argc, const char** argv) int z = process_arguments(L, argc, argv); /* Run the built-in Premake scripts */ - if (z == OKAY) z = load_builtin_scripts(L); - + if (z == OKAY) + { +#if !defined(NDEBUG) + z = load_file_scripts(L); +#else + if (scripts_path) + { + z = load_file_scripts(L); + } + else + { + z = load_builtin_scripts(L); + } +#endif + } + return z; } @@ -200,7 +220,7 @@ int premake_locate(lua_State* L, const char* argv0) * but I need the value of the /scripts option to find them. * \returns OKAY if successful. */ -int process_arguments(lua_State* L, int argc, const char** argv) +static int process_arguments(lua_State* L, int argc, const char** argv) { int i; @@ -247,7 +267,7 @@ int process_arguments(lua_State* L, int argc, const char** argv) * Parse an individual command-line option. * \returns OKAY if successful. */ -int process_option(lua_State* L, const char* arg) +static int process_option(lua_State* L, const char* arg) { char key[512]; const char* value; @@ -276,6 +296,7 @@ int process_option(lua_State* L, const char* arg) if (strcmp(key, "scripts") == 0 && strlen(value) > 0) { scripts_path = value; + printf("Scripts path: %s\n", value); } return OKAY; @@ -283,13 +304,12 @@ int process_option(lua_State* L, const char* arg) -#if !defined(NDEBUG) /** * When running in debug mode, the scripts are loaded from the disk. The path to * the scripts must be provided via either the /scripts command line option or * the PREMAKE_PATH environment variable. */ -int load_builtin_scripts(lua_State* L) +static int load_file_scripts(lua_State* L) { const char* filename; @@ -335,16 +355,14 @@ int load_builtin_scripts(lua_State* L) return (int)lua_tonumber(L, -1); } } -#endif -#if defined(NDEBUG) /** * When running in release mode, the scripts are loaded from a static data * buffer, where they were stored by a preprocess. To update these embedded * scripts, run `premake4 embed` then rebuild. */ -int load_builtin_scripts(lua_State* L) +static int load_builtin_scripts(lua_State* L) { int i; for (i = 0; builtin_scripts[i]; ++i) @@ -368,4 +386,4 @@ int load_builtin_scripts(lua_State* L) return (int)lua_tonumber(L, -1); } } -#endif + diff --git a/src/host/premake.h b/src/host/premake.h index 1e69a89..ef7d3fc 100755 --- a/src/host/premake.h +++ b/src/host/premake.h @@ -47,11 +47,21 @@ /* Bootstrapping helper functions */ +void do_getabsolute(char* result, const char* value, const char* relative_to); +int do_getcwd(char* buffer, size_t size); +int do_isabsolute(const char* path); int do_isfile(const char* filename); +void do_normalize(lua_State* L, char* buffer, const char* path); +void do_translate(char* value, const char sep); /* Built-in functions */ +int path_getabsolute(lua_State* L); +int path_getrelative(lua_State* L); int path_isabsolute(lua_State* L); +int path_join(lua_State* L); +int path_normalize(lua_State* L); +int path_translate(lua_State* L); int os_chdir(lua_State* L); int os_copyfile(lua_State* L); int os_getcwd(lua_State* L); diff --git a/tests/actions/make/test_make_pch.lua b/tests/actions/make/test_make_pch.lua index 18e6026..6d30ef1 100644 --- a/tests/actions/make/test_make_pch.lua +++ b/tests/actions/make/test_make_pch.lua @@ -66,6 +66,7 @@ _.pchrules(prj) test.capture [[ ifneq (,$(PCH)) +.NOTPARALLEL: $(GCH) $(PCH) $(GCH): $(PCH) @echo $(notdir $<) $(SILENT) $(CXX) -x c++-header $(ALL_CXXFLAGS) -MMD -MP $(DEFINES) $(INCLUDES) -o "$@" -MF "$(@:%.gch=%.d)" -c "$<" @@ -79,6 +80,7 @@ $(GCH): $(PCH) _.pchrules(prj) test.capture [[ ifneq (,$(PCH)) +.NOTPARALLEL: $(GCH) $(PCH) $(GCH): $(PCH) @echo $(notdir $<) $(SILENT) $(CC) -x c-header $(ALL_CFLAGS) -MMD -MP $(DEFINES) $(INCLUDES) -o "$@" -MF "$(@:%.gch=%.d)" -c "$<" @@ -98,7 +100,7 @@ $(GCH): $(PCH) test.capture [[ $(OBJDIR)/main.o: main.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 diff --git a/tests/actions/make/test_wiidev.lua b/tests/actions/make/test_wiidev.lua index f3787a0..d766097 100644 --- a/tests/actions/make/test_wiidev.lua +++ b/tests/actions/make/test_wiidev.lua @@ -33,7 +33,7 @@ cpp.flags(cfg, premake.gcc) test.capture [[ ALL_CPPFLAGS += $(CPPFLAGS) -MMD -MP -I$(LIBOGC_INC) $(MACHDEP) -MP $(DEFINES) $(INCLUDES) - ALL_CFLAGS += $(CFLAGS) $(ALL_CPPFLAGS) $(ARCH) + ALL_CFLAGS += $(CFLAGS) $(ALL_CPPFLAGS) ALL_CXXFLAGS += $(CXXFLAGS) $(ALL_CFLAGS) ALL_RESFLAGS += $(RESFLAGS) $(DEFINES) $(INCLUDES) ]] diff --git a/tests/actions/vstudio/cs2005/buildevents.lua b/tests/actions/vstudio/cs2005/buildevents.lua new file mode 100644 index 0000000..213de1b --- /dev/null +++ b/tests/actions/vstudio/cs2005/buildevents.lua @@ -0,0 +1,53 @@ +--
+-- tests/actions/vstudio/cs2005/buildevents.lua
+-- Validate the build events in Visual Studio 2005+ .csproj
+-- Copyright (c) 2009-2014 Jason Perkins and the Premake project
+--
+
+ T.vstudio_cs2005_buildevents = { }
+ local suite = T.vstudio_cs2005_buildevents
+ local cs2005 = premake.vstudio.cs2005
+
+--
+-- Setup
+--
+
+ local sln, prj
+
+ function suite.setup()
+ sln = test.createsolution()
+ end
+
+ local function prepare()
+ premake.bake.buildconfigs()
+ prj = premake.solution.getproject(sln, 1)
+ cs2005.buildevents(prj)
+ end
+
+--
+-- Prebuild events
+--
+
+ function suite.prebuildEvents()
+ prebuildcommands { "pre" }
+ prepare()
+ test.capture [[
+ <PropertyGroup>
+ <PreBuildEvent>pre</PreBuildEvent>
+ </PropertyGroup>
+ ]]
+ end
+
+--
+-- Postbuild events
+--
+
+ function suite.postbuildEvents()
+ postbuildcommands { "post" }
+ prepare()
+ test.capture [[
+ <PropertyGroup>
+ <PostBuildEvent>post</PostBuildEvent>
+ </PropertyGroup>
+ ]]
+ end
diff --git a/tests/actions/vstudio/test_vs2010_vcxproj.lua b/tests/actions/vstudio/test_vs2010_vcxproj.lua index c5b3401..c11ec9e 100644 --- a/tests/actions/vstudio/test_vs2010_vcxproj.lua +++ b/tests/actions/vstudio/test_vs2010_vcxproj.lua @@ -2,6 +2,7 @@ local vs10_vcxproj = T.vs2010_vcxproj local include_directory = "bar/foo" local include_directory2 = "baz/foo" + local include_directory_vs_macros = "$(Macro1)/foo/bar/$(Macro2)/baz" local debug_define = "I_AM_ALIVE_NUMBER_FIVE" local vc2010 = premake.vstudio.vc2010 @@ -25,7 +26,8 @@ includedirs { include_directory, - include_directory2 + include_directory2, + include_directory_vs_macros } files { @@ -168,6 +170,13 @@ test.string_contains(buffer,cl_compile_string('Debug').. '.*<AdditionalIncludeDirectories>.*'.. path.translate(include_directory2, '\\') ..';.*</AdditionalIncludeDirectories>') end + function vs10_vcxproj.includeDirectories_debugEntryContains_include_directory_vs_macros() + local buffer = get_buffer() + -- visual studio macros use $ as a prefix, which is a special regex character, so we need to replace them. + local search_string = string.gsub(include_directory_vs_macros, "%$", "%$%") + test.string_contains(buffer,cl_compile_string('Debug').. '.*<AdditionalIncludeDirectories>.*'.. path.translate(search_string, '\\') ..'.*</AdditionalIncludeDirectories>') + end + function vs10_vcxproj.debugContainsPreprossorBlock() local buffer = get_buffer() test.string_contains(buffer,cl_compile_string('Debug').. '.*<PreprocessorDefinitions>.*</PreprocessorDefinitions>') diff --git a/tests/base/test_os.lua b/tests/base/test_os.lua index fb720c9..db49547 100644 --- a/tests/base/test_os.lua +++ b/tests/base/test_os.lua @@ -8,7 +8,7 @@ T.os = { }
local suite = T.os
-
+
--
-- os.findlib() tests
--
@@ -17,17 +17,17 @@ if os.is("windows") then
test.istrue(os.findlib("user32"))
elseif os.is("haiku") then
- test.istrue(os.findlib("root"))
+ test.istrue(os.findlib("root"))
else
- test.istrue(os.findlib("m"))
+ test.istrue(os.findlib("m"))
end
end
-
+
function suite.findlib_FailsOnBadLibName()
test.isfalse(os.findlib("NoSuchLibraryAsThisOneHere"))
end
-
-
+
+
--
-- os.isfile() tests
--
@@ -49,7 +49,7 @@ function suite.matchfiles_OnNonRecursive()
local result = os.matchfiles("*.lua")
test.istrue(table.contains(result, "testfx.lua"))
- test.isfalse(table.contains(result, "folder/ok.lua"))
+ test.isfalse(table.contains(result, "folder/ok.lua"))
end
function suite.matchfiles_Recursive()
@@ -61,31 +61,36 @@ local result = os.matchfiles("**.lua")
test.isfalse(table.contains(result, ".svn/text-base/testfx.lua.svn-base"))
end
-
+
function suite.matchfiles_OnSubfolderMatch()
local result = os.matchfiles("**/xcode/*")
test.istrue(table.contains(result, "actions/xcode/test_xcode_project.lua"))
test.isfalse(table.contains(result, "premake4.lua"))
end
-
+
function suite.matchfiles_OnDotSlashPrefix()
local result = os.matchfiles("./**.lua")
test.istrue(table.contains(result, "folder/ok.lua"))
end
-
+
function suite.matchfiles_OnImplicitEndOfString()
local result = os.matchfiles("folder/*.lua")
test.istrue(table.contains(result, "folder/ok.lua"))
test.isfalse(table.contains(result, "folder/ok.lua.2"))
end
-
+
function suite.matchfiles_OnLeadingDotSlashWithPath()
local result = os.matchfiles("./folder/*.lua")
test.istrue(table.contains(result, "folder/ok.lua"))
end
+ function suite.matchfiles_OnDottedFile()
+ local result = os.matchfiles("../.*")
+ test.istrue(table.contains(result, "../.hgignore"))
+ end
+
+
-
--
-- os.pathsearch() tests
--
@@ -93,20 +98,20 @@ function suite.pathsearch_ReturnsNil_OnNotFound()
test.istrue( os.pathsearch("nosuchfile", "aaa;bbb;ccc") == nil )
end
-
+
function suite.pathsearch_ReturnsPath_OnFound()
test.isequal(os.getcwd(), os.pathsearch("premake4.lua", os.getcwd()))
end
-
+
function suite.pathsearch_FindsFile_OnComplexPath()
test.isequal(os.getcwd(), os.pathsearch("premake4.lua", "aaa;"..os.getcwd()..";bbb"))
end
-
+
function suite.pathsearch_NilPathsAllowed()
test.isequal(os.getcwd(), os.pathsearch("premake4.lua", nil, os.getcwd(), nil))
end
-
+
--
-- os.uuid() tests
--
@@ -123,4 +128,4 @@ test.isequal("-", g:sub(19,19))
test.isequal("-", g:sub(24,24))
end
-
+
diff --git a/tests/base/test_path.lua b/tests/base/test_path.lua index 2332dce..46e3181 100644 --- a/tests/base/test_path.lua +++ b/tests/base/test_path.lua @@ -24,26 +24,26 @@ function suite.getabsolute_RemovesDotDots_OnPosixAbsolute() test.isequal("/ProjectB/bin", path.getabsolute("/ProjectA/../ProjectB/bin")) end - + function suite.getabsolute_OnTrailingSlash() local expected = path.translate(os.getcwd(), "/") .. "/a/b/c" test.isequal(expected, path.getabsolute("a/b/c/")) end - + function suite.getabsolute_OnLeadingEnvVar() test.isequal("$(HOME)/user", path.getabsolute("$(HOME)/user")) end - - function suite.getabsolute_OnMultipleEnvVar() + + function suite.getabsolute_OnMultipleEnvVar() test.isequal("$(HOME)/$(USER)", path.getabsolute("$(HOME)/$(USER)")) end - + function suite.getabsolute_OnTrailingEnvVar() local expected = path.translate(os.getcwd(), "/") .. "/home/$(USER)" test.isequal(expected, path.getabsolute("home/$(USER)")) end - - + + -- -- path.getbasename() tests -- @@ -60,11 +60,11 @@ function suite.getdirectory_ReturnsEmptyString_OnNoDirectory() test.isequal(".", path.getdirectory("filename.ext")) end - + function suite.getdirectory_ReturnsDirectory_OnSingleLevelPath() test.isequal("dir0", path.getdirectory("dir0/filename.ext")) end - + function suite.getdirectory_ReturnsDirectory_OnMultiLeveLPath() test.isequal("dir0/dir1/dir2", path.getdirectory("dir0/dir1/dir2/filename.ext")) end @@ -72,7 +72,7 @@ function suite.getdirectory_ReturnsRootPath_OnRootPathOnly() test.isequal("/", path.getdirectory("/filename.ext")) end - + -- @@ -82,13 +82,13 @@ function suite.getdrive_ReturnsNil_OnNotWindows() test.isnil(path.getdrive("/hello")) end - + function suite.getdrive_ReturnsLetter_OnWindowsAbsolute() test.isequal("x", path.getdrive("x:/hello")) end - - - + + + -- -- path.getextension() tests -- @@ -100,19 +100,19 @@ function suite.getextension_ReturnsExtension() test.isequal(".txt", path.getextension("filename.txt")) end - + function suite.getextension_OnMultipleDots() test.isequal(".txt", path.getextension("filename.mod.txt")) end - + function suite.getextension_OnLeadingNumeric() test.isequal(".7z", path.getextension("filename.7z")) end - + function suite.getextension_OnUnderscore() test.isequal(".a_c", path.getextension("filename.a_c")) end - + function suite.getextension_OnHyphen() test.isequal(".a-c", path.getextension("filename.a-c")) end @@ -130,7 +130,7 @@ function suite.getrelative_ReturnsDoubleDot_OnChildToParent() test.isequal("..", path.getrelative("/a/b/c", "/a/b")) end - + function suite.getrelative_ReturnsDoubleDot_OnSiblingToSibling() test.isequal("../d", path.getrelative("/a/b/c", "/a/b/d")) end @@ -142,19 +142,19 @@ function suite.getrelative_ReturnsChildPath_OnWindowsAbsolute() test.isequal("obj/debug", path.getrelative("C:/Code/Premake4", "C:/Code/Premake4/obj/debug")) end - + function suite.getrelative_ReturnsAbsPath_OnDifferentDriveLetters() test.isequal("D:/Files", path.getrelative("C:/Code/Premake4", "D:/Files")) end - + function suite.getrelative_ReturnsAbsPath_OnDollarMacro() test.isequal("$(SDK_HOME)/include", path.getrelative("C:/Code/Premake4", "$(SDK_HOME)/include")) end - + function suite.getrelative_ReturnsAbsPath_OnRootedPath() test.isequal("/opt/include", path.getrelative("/home/me/src/project", "/opt/include")) end - + -- -- path.isabsolute() tests @@ -171,7 +171,7 @@ function suite.isabsolute_ReturnsFalse_OnRelativePath() test.isfalse(path.isabsolute("a/b/c")) end - + function suite.isabsolute_ReturnsTrue_OnDollarSign() test.istrue(path.isabsolute("$(SDK_HOME)/include")) end @@ -184,11 +184,11 @@ function suite.join_OnValidParts() test.isequal("p1/p2", path.join("p1", "p2")) end - + function suite.join_OnAbsoluteUnixPath() test.isequal("/p2", path.join("p1", "/p2")) end - + function suite.join_OnAbsoluteWindowsPath() test.isequal("C:/p2", path.join("p1", "C:/p2")) end @@ -196,11 +196,11 @@ function suite.join_OnCurrentDirectory() test.isequal("p2", path.join(".", "p2")) end - + function suite.join_OnNilSecondPart() test.isequal("p1", path.join("p1", nil)) end - + function suite.join_onMoreThanTwoParts() test.isequal("p1/p2/p3", path.join("p1", "p2", "p3")) end diff --git a/tests/premake4.lua b/tests/premake4.lua index b0ebde9..6c149e3 100644 --- a/tests/premake4.lua +++ b/tests/premake4.lua @@ -86,6 +86,7 @@ dofile("actions/vstudio/cs2005/projectelement.lua") dofile("actions/vstudio/cs2005/projectsettings.lua") dofile("actions/vstudio/cs2005/propertygroup.lua") + dofile("actions/vstudio/cs2005/buildevents.lua") -- Visual Studio 2005-2010 solutions dofile("actions/vstudio/sln2005/dependencies.lua") diff --git a/tests/test_gmake_cpp.lua b/tests/test_gmake_cpp.lua index 7ce0279..b0bd4cf 100644 --- a/tests/test_gmake_cpp.lua +++ b/tests/test_gmake_cpp.lua @@ -79,13 +79,13 @@ ifeq ($(config),debug) DEFINES += INCLUDES += ALL_CPPFLAGS += $(CPPFLAGS) -MMD -MP $(DEFINES) $(INCLUDES) - ALL_CFLAGS += $(CFLAGS) $(ALL_CPPFLAGS) $(ARCH) + ALL_CFLAGS += $(CFLAGS) $(ALL_CPPFLAGS) ALL_CXXFLAGS += $(CXXFLAGS) $(ALL_CFLAGS) ALL_RESFLAGS += $(RESFLAGS) $(DEFINES) $(INCLUDES) ALL_LDFLAGS += $(LDFLAGS) -s LDDEPS += LIBS += $(LDDEPS) - LINKCMD = $(CXX) -o $(TARGET) $(OBJECTS) $(RESOURCES) $(ARCH) $(ALL_LDFLAGS) $(LIBS) + LINKCMD = $(CXX) -o $(TARGET) $(OBJECTS) $(RESOURCES) $(ALL_LDFLAGS) $(LIBS) define PREBUILDCMDS endef define PRELINKCMDS @@ -113,13 +113,13 @@ ifeq ($(config),debugps3) DEFINES += INCLUDES += ALL_CPPFLAGS += $(CPPFLAGS) -MMD -MP $(DEFINES) $(INCLUDES) - ALL_CFLAGS += $(CFLAGS) $(ALL_CPPFLAGS) $(ARCH) + ALL_CFLAGS += $(CFLAGS) $(ALL_CPPFLAGS) ALL_CXXFLAGS += $(CXXFLAGS) $(ALL_CFLAGS) ALL_RESFLAGS += $(RESFLAGS) $(DEFINES) $(INCLUDES) ALL_LDFLAGS += $(LDFLAGS) -s LDDEPS += LIBS += $(LDDEPS) - LINKCMD = $(CXX) -o $(TARGET) $(OBJECTS) $(RESOURCES) $(ARCH) $(ALL_LDFLAGS) $(LIBS) + LINKCMD = $(CXX) -o $(TARGET) $(OBJECTS) $(RESOURCES) $(ALL_LDFLAGS) $(LIBS) define PREBUILDCMDS endef define PRELINKCMDS @@ -144,13 +144,13 @@ ifeq ($(config),debug64) DEFINES += INCLUDES += ALL_CPPFLAGS += $(CPPFLAGS) -MMD -MP $(DEFINES) $(INCLUDES) - ALL_CFLAGS += $(CFLAGS) $(ALL_CPPFLAGS) $(ARCH) -m64 + ALL_CFLAGS += $(CFLAGS) $(ALL_CPPFLAGS) -m64 ALL_CXXFLAGS += $(CXXFLAGS) $(ALL_CFLAGS) ALL_RESFLAGS += $(RESFLAGS) $(DEFINES) $(INCLUDES) ALL_LDFLAGS += $(LDFLAGS) -s -m64 -L/usr/lib64 LDDEPS += LIBS += $(LDDEPS) - LINKCMD = $(CXX) -o $(TARGET) $(OBJECTS) $(RESOURCES) $(ARCH) $(ALL_LDFLAGS) $(LIBS) + LINKCMD = $(CXX) -o $(TARGET) $(OBJECTS) $(RESOURCES) $(ALL_LDFLAGS) $(LIBS) define PREBUILDCMDS endef define PRELINKCMDS @@ -176,7 +176,7 @@ ifeq ($(config),debuguniv32) DEFINES += INCLUDES += ALL_CPPFLAGS += $(CPPFLAGS) $(DEFINES) $(INCLUDES) - ALL_CFLAGS += $(CFLAGS) $(ALL_CPPFLAGS) $(ARCH) -arch i386 -arch ppc + ALL_CFLAGS += $(CFLAGS) $(ALL_CPPFLAGS) -arch i386 -arch ppc ALL_CXXFLAGS += $(CXXFLAGS) $(ALL_CFLAGS) ALL_RESFLAGS += $(RESFLAGS) $(DEFINES) $(INCLUDES) ALL_LDFLAGS += $(LDFLAGS) -s -arch i386 -arch ppc |