define stringFrom = " from ";
// This function cannot accept same pointer for source and output
+// todo: rename ReplaceSpaces to EscapeSpaceAndSpecialChars or something
void ReplaceSpaces(char * output, char * source)
{
int c, dc;
for(c = 0, dc = 0; (ch = source[c]); c++, dc++)
{
if(ch == ' ') output[dc++] = '\\';
+ if(ch == '\"') output[dc++] = '\\';
+ if(ch == '&') output[dc++] = '\\';
if(pch != '$')
{
if(ch == '(' || ch == ')') output[dc++] = '\\';
output[dc] = '\0';
}
-// This function cannot accept same pointer for source and output
-void ReplaceUnwantedMakeChars(char * output, char * source)
-{
- int c, dc;
- char ch, pch = 0;
+// chars refused for project name: windowsFileNameCharsNotAllowed + " &,."
- for(c = 0, dc = 0; (ch = source[c]); c++, dc++)
+//define gnuMakeCharsNeedEscaping = "$%";
+
+//define windowsFileNameCharsNotAllowed = "*/:<>?\\\"|";
+//define linuxFileNameCharsNotAllowed = "/";
+
+//define windowsFileNameCharsNeedEscaping = " !%&'()+,;=[]^`{}~"; // "#$-.@_" are ok
+//define linuxFileNameCharsNeedEscaping = " !\"$&'()*:;<=>?[\\`{|"; // "#%+,-.@]^_}~" are ok
+
+// NOTES: - this function should get only unescaped unix style paths
+// - paths with literal $(somestring) in them are not supported
+// my_$(messed_up)_path would likely become my__path
+void EscapeForMake(char * output, char * input, bool hideSpace, bool allowVars, bool allowDblQuote)
+{
+ char ch, *i = input, *o = output;
+ bool inVar = false;
+#ifdef _DEBUG
+ int len = strlen(input);
+ if(len && ((input[0] == '"' && input[len-1] == '"') || strchr(input, '\\') || strchr(input, 127) || (!allowDblQuote && strchr(input, '"'))))
+ PrintLn("Invalid input for EscapeForMake! -- ", input);
+#endif
+ while((ch = *i++))
{
- if(pch != '$')
+ if(ch == '(')
{
- if(ch == '(' || ch == ')') output[dc++] = '\\';
- pch = ch;
+ if(i-1 != input && *(i-2) == '$' && allowVars)
+ inVar = true;
+ else
+ *o++ = '\\';
}
else if(ch == ')')
- pch = 0;
+ {
+ if(inVar == true && allowVars)
+ inVar = false;
+ else
+ *o++ = '\\';
+ }
+ else if(ch == '$' && *i != '(')
+ *o++ = '$';
+ else if(ch == '&')
+ *o++ = '\\';
+ else if(ch == '"')
+ *o++ = '\\';
if(ch == ' ')
- output[dc] = 127;
+ {
+ if(hideSpace)
+ *o++ = 127;
+ else
+ {
+ *o++ = '\\';
+ *o++ = ch;
+ }
+ }
else
- output[dc] = ch;
+ *o++ = ch;
}
- output[dc] = '\0';
+ *o = '\0';
}
-static void OutputNoSpace(File f, char * source)
+void EscapeForMakeToFile(File output, char * input, bool hideSpace, bool allowVars, bool allowDblQuote)
{
- char * output = new char[strlen(source)+1024];
- ReplaceSpaces(output, source);
- f.Puts(output);
- delete output;
+ char * buf = new char[strlen(input)*2+1];
+ EscapeForMake(buf, input, hideSpace, allowVars, allowDblQuote);
+ output.Print(buf);
+ delete buf;
}
-enum ListOutputMethod { inPlace, newLine, lineEach };
+void EscapeForMakeToDynString(DynamicString output, char * input, bool hideSpace, bool allowVars, bool allowDblQuote)
+{
+ char * buf = new char[strlen(input)*2+1];
+ EscapeForMake(buf, input, hideSpace, allowVars, allowDblQuote);
+ output.concat(buf);
+ delete buf;
+}
int OutputFileList(File f, char * name, Array<String> list, Map<String, int> varStringLenDiffs, char * prefix)
{
f.Printf("\t$(call rmq,$(%s))\n", name);
}
-void OutputListOption(File f, char * option, Array<String> list, ListOutputMethod method, bool noSpace)
+enum LineOutputMethod { inPlace, newLine, lineEach };
+enum StringOutputMethod { asIs, escape, escapePath};
+
+enum ToolchainFlag { any, _D, _I, _isystem, _Wl, _L/*, _Wl-rpath*/ };
+String flagNames[ToolchainFlag] = { "", "-D", "-I", "-isystem ", "-Wl,", /*"-Wl,--library-path="*/"-L"/*, "-Wl,-rpath "*/ };
+void OutputFlags(File f, ToolchainFlag flag, Array<String> list, LineOutputMethod lineMethod)
{
if(list.count)
{
- if(method == newLine)
+ if(lineMethod == newLine)
f.Puts(" \\\n\t");
for(item : list)
{
- if(method == lineEach)
+ if(lineMethod == lineEach)
f.Puts(" \\\n\t");
- f.Printf(" -%s", option);
- if(noSpace)
- OutputNoSpace(f, item);
+ f.Printf(" %s", flagNames[flag]);
+ if(flag != _D && flag != _Wl && flag != any)
+ {
+ char * tmp = new char[strlen(item)*2+1];
+ EscapeForMake(tmp, item, false, true, false);
+ f.Printf("$(call quote_path,%s)", tmp);
+ delete tmp;
+ }
else
- f.Printf("%s", item);
+ EscapeForMakeToFile(f, item, false, true, true);
}
}
}
-void StringNoSpaceToDynamicString(DynamicString s, char * path)
-{
- char * output = new char[strlen(path)+1024];
- ReplaceSpaces(output, path);
- s.concat(output);
- delete output;
-}
-
static void OutputLibraries(File f, Array<String> libraries)
{
for(item : libraries)
f.Puts(" \\\n\t$(call _L,");
usedFunction = true;
}
- OutputNoSpace(f, s);
+ EscapeForMakeToFile(f, s, false, false, false);
if(usedFunction)
f.Puts(")");
}
return config ? config.name : "Common";
}
-public enum SingleFileCompileMode { normal, debugPrecompile, debugCompile, debugGenerateSymbols, cObject };
+public enum SingleFileCompileMode
+{
+ normal, debugPrecompile, debugCompile, debugGenerateSymbols, cObject;
+
+ property bool eC_ToolsDebug { get { return this == debugCompile || this == debugGenerateSymbols || this == debugPrecompile; } }
+};
class Project : struct
{
String compilerConfigsDir;
String moduleVersion;
+ String lastBuildConfigName;
+ String lastBuildCompilerName;
+
+ Map<String, Map<String, NameCollisionInfo>> configsNameCollisions { };
+
#ifndef MAKEFILE_GENERATOR
FileMonitor fileMonitor
{
if(MessageBox { type = yesNo, master = ide,
text = $"Project has been modified", contents = temp }.Modal() == yes)
{
- Project project = LoadProject(filePath, config.name);
+ Project project = LoadProject(filePath, config ? config.name : null);
if(project)
{
ProjectView projectView = ide.projectView;
delete filePath;
delete topNode;
delete name;
+ delete lastBuildConfigName;
+ delete lastBuildCompilerName;
+ for(map : configsNameCollisions)
+ map.Free();
+ configsNameCollisions.Free();
}
~Project()
topNode.info = CopyString(GetConfigName(config));
}
}
+
property char * filePath
{
set
}
}
+ ProjectConfig GetConfig(char * configName)
+ {
+ ProjectConfig result = null;
+ if(configName && configName[0] && configurations.count)
+ {
+ for(cfg : configurations; !strcmpi(cfg.name, configName))
+ {
+ result = cfg;
+ break;
+ }
+ }
+ return result;
+ }
+
+ ProjectNode FindNodeByObjectFileName(char * fileName, IntermediateFileType type, bool dotMain, ProjectConfig config)
+ {
+ ProjectNode result;
+ char * cfgName;
+ if(!config)
+ config = this.config;
+ cfgName = config ? config.name : "";
+ if(!configsNameCollisions[cfgName])
+ ProjectLoadLastBuildNamesInfo(this, config);
+ result = topNode.FindByObjectFileName(fileName, type, dotMain, configsNameCollisions[cfgName]);
+ return result;
+ }
+
TargetTypes GetTargetType(ProjectConfig config)
{
TargetTypes targetType = localTargetType;
return false;
}
-
char * GetObjDirExpression(ProjectConfig config)
{
// TODO: Support platform options
}
#endif
- // This method is only called from Debugger, should be moved to Debugger class?
-#ifndef MAKEFILE_GENERATOR
- bool GetRelativePath(char * filePath, char * relativePath)
- {
- ProjectNode node;
- char moduleName[MAX_FILENAME];
- GetLastDirectory(filePath, moduleName);
- // try with workspace dir first?
- if((node = topNode.Find(moduleName, false)))
- {
- strcpy(relativePath, strcmp(node.path, ".") ? node.path : "");
- PathCatSlash(relativePath, node.name);
- return true;
- }
- else
- {
- // Tweak for automatically resolving symbol loader modules
- char * sl = strstr(moduleName, ".main.ec");
- if(sl && (*sl = 0, !strcmpi(moduleName, name)))
- {
- char objDir[MAX_LOCATION];
- DirExpression objDirExp;
- CompilerConfig compiler = ide.debugger.currentCompiler;
- ProjectConfig config = ide.debugger.prjConfig;
- int bitDepth = ide.debugger.bitDepth;
- // This is not perfect, as multiple source files exist for the symbol loader module...
- // We try to set it in the debug config object directory.
- if(!compiler || !config)
- {
- // If we're not currently debugging, set a breakpoint in the active compiler/config
- compiler = GetCompilerConfig();
- config = this.config;
- // If the current config is not debuggable, set it in the first debuggable config found
- if(config && !config.options.debug)
- {
- for(c : configurations; c.options.debug)
- {
- config = c;
- break;
- }
- }
- }
- objDirExp = GetObjDir(compiler, config, bitDepth);
- strcpy(objDir, objDirExp.dir);
- delete objDirExp;
- ChangeCh(objDir, '\\', '/'); // TODO: this is a hack, paths should never include win32 path seperators - fix this in ProjectSettings and ProjectLoad instead
- ReplaceSpaces(relativePath, objDir);
- *sl = '.';
- PathCatSlash(relativePath, moduleName);
- return true;
- }
- }
- // WARNING: On failure, relative path is uninitialized
- return false;
- }
-#endif
-
void CatTargetFileName(char * string, CompilerConfig compiler, ProjectConfig config)
{
TargetTypes targetType = GetTargetType(config);
void ModifiedAllConfigs(bool making, bool compiling, bool linking, bool symbolGen)
{
+ Map<String, NameCollisionInfo> cfgNameCollision = configsNameCollisions[""];
+ if(cfgNameCollision)
+ {
+ cfgNameCollision.Free();
+ delete cfgNameCollision;
+ configsNameCollisions[""] = null;
+ }
for(cfg : configurations)
{
if(making)
+ {
cfg.makingModified = true;
+ cfgNameCollision = configsNameCollisions[cfg.name];
+ if(cfgNameCollision)
+ {
+ cfgNameCollision.Free();
+ delete cfgNameCollision;
+ configsNameCollisions[cfg.name] = null;
+ }
+ }
if(compiling)
cfg.compilingModified = true;
if(linking)
}
}
- void RotateActiveConfig(bool forward)
+ void RotateActiveConfig(bool forward, bool syncAllProjects)
{
if(configurations.first && configurations.last != configurations.first)
{
cfg.Prev();
}
- property::config = cfg.data;
- ide.UpdateToolBarActiveConfigs(true);
- ide.workspace.modified = true;
- ide.projectView.Update(null);
+ if(syncAllProjects)
+ ide.workspace.SelectActiveConfig(cfg.data.name);
+ else
+ {
+ property::config = cfg.data;
+ ide.UpdateToolBarActiveConfigs(true);
+ ide.workspace.modified = true;
+ ide.projectView.Update(null);
+ }
}
}
- void ProcessPipeOutputRaw(DualPipe f)
+ bool ProcessPipeOutputRaw(DualPipe f)
{
char line[65536];
- while(!f.Eof() && !ide.ShouldStopBuild())
+ while(!f.Eof() && !ide.projectView.stopBuild)
{
bool result = true;
double lastTime = GetTime();
}
//if(!result) Sleep(1.0 / PEEK_RESOLUTION);
}
- if(ide.ShouldStopBuild())
+ if(ide.projectView.stopBuild)
{
ide.outputView.buildBox.Logf($"\nBuild cancelled by user.\n", line);
f.Terminate();
}
+ return !ide.projectView.stopBuild;
}
- bool ProcessBuildPipeOutput(DualPipe f, DirExpression objDirExp, bool isARun, List<ProjectNode> onlyNodes,
+ bool ProcessBuildPipeOutput(DualPipe f, DirExpression objDirExp, BuildType buildType, List<ProjectNode> onlyNodes,
CompilerConfig compiler, ProjectConfig config, int bitDepth)
{
char line[65536];
int compilingEC = 0;
int numErrors = 0, numWarnings = 0;
bool loggedALine = false;
- char * configName = config ? config.name : "Common";
int lenMakeCommand = strlen(compiler.makeCommand);
int testLen = 0;
-
+ char * t;
+ char moduleName[MAX_FILENAME];
char * gnuToolchainPrefix = compiler.gnuToolchainPrefix ? compiler.gnuToolchainPrefix : "";
DynamicString test { };
DynamicString strip { };
DynamicString ar { };
DynamicString windres { };
+
/*
if(bitDepth == 64 && compiler.targetPlatform == win32)
gnuToolchainPrefix = "x86_64-w64-mingw32-";
testLen = Max(testLen, strip.size);
testLen = Max(testLen, ar.size);
testLen = Max(testLen, windres.size);
+ testLen = Max(testLen, strlen("mkdir "));
testLen++;
- while(!f.Eof() && !ide.ShouldStopBuild())
+ while(!f.Eof() && !ide.projectView.stopBuild)
{
bool result = true;
double lastTime = GetTime();
while(result)
{
//printf("Peeking and GetLine...\n");
- if((result = f.Peek()) && (result = f.GetLine(line, sizeof(line)-1)))
+ if((result = f.Peek()) && (result = f.GetLine(line, sizeof(line)-1)) && line[0])
{
char * message = null;
char * inFileIncludedFrom = strstr(line, stringInFileIncludedFrom);
//numErrors++;
//}
}
+ else if(strstr(test, "mkdir ") == test);
+ else if((t = strstr(line, "cd ")) && (t = strstr(line, "type ")) && (t = strstr(line, "nul ")) && (t = strstr(line, "copy ")) && (t = strstr(line, "cd ")));
else if(strstr(test, ear) == test);
else if(strstr(test, strip) == test);
else if(strstr(test, cc) == test || strstr(test, cxx) == test || strstr(test, ecp) == test || strstr(test, ecc) == test)
{
- char moduleName[MAX_FILENAME];
- byte * tokens[1];
char * module;
bool isPrecomp = false;
bool gotCC = false;
if(module)
{
+ byte * tokens[1];
if(!compiling && !isPrecomp)
{
ide.outputView.buildBox.Logf($"Compiling...\n");
precompiling = true;
}
// Changed escapeBackSlashes here to handle paths with spaces
- Tokenize(module, 1, tokens, true); // false);
+ Tokenize(module, 1, tokens, (BackSlashEscaping)true); // fix #139
GetLastDirectory(module, moduleName);
ide.outputView.buildBox.Logf("%s\n", moduleName);
}
}
else if(strstr(test, windres) == test)
{
- char moduleName[MAX_FILENAME];
char * module;
module = strstr(line, " ");
- if(module) module = strstr(module+1, " ");
+ if(module) module++;
if(module)
{
+ byte * tokens[1];
+ char * dashF = strstr(module, "-F ");
+ if(dashF)
+ {
+ dashF+= 3;
+ while(*dashF && *dashF != ' ') dashF++;
+ while(*dashF && *dashF == ' ') dashF++;
+ module = dashF;
+ }
+ Tokenize(module, 1, tokens, (BackSlashEscaping)true); // fix #139
GetLastDirectory(module, moduleName);
ide.outputView.buildBox.Logf("%s\n", moduleName);
}
{
if(linking || compiling || precompiling)
{
- char * colon = strstr(line, ":"); //, * bracket;
+ char * start = inFileIncludedFrom ? inFileIncludedFrom + strlen(stringInFileIncludedFrom) : from ? from + strlen(stringFrom) : line;
+ char * colon = strstr(start, ":"); //, * bracket;
if(colon && (colon[1] == '/' || colon[1] == '\\'))
colon = strstr(colon + 1, ":");
if(colon)
char moduleName[MAX_LOCATION], temp[MAX_LOCATION];
char * pointer;
char * error;
- char * start = inFileIncludedFrom ? inFileIncludedFrom + strlen(stringInFileIncludedFrom) : from ? from + strlen(stringFrom) : line;
int len = (int)(colon - start);
char ext[MAX_EXTENSION];
len = Min(len, MAX_LOCATION-1);
else
{
numErrors++;
- message = $"Linker Error";
+ message = $"Linker Error: ";
}
}
else if(linking && (!strcmp(ext, "") || !strcmp(ext, "exe")))
}
//if(!result) Sleep(1.0 / PEEK_RESOLUTION);
}
- if(ide.ShouldStopBuild())
+ if(ide.projectView.stopBuild)
{
ide.outputView.buildBox.Logf($"\nBuild cancelled by user.\n", line);
f.Terminate();
}
- else if(loggedALine || !isARun)
+ else if(loggedALine || buildType != run)
{
if(f.GetExitCode() && !numErrors)
{
bool result = f.GetLine(line, sizeof(line)-1);
ide.outputView.buildBox.Logf($"Fatal Error: child process terminated unexpectedly\n");
}
- else
+ else if(buildType != install)
{
if(!onlyNodes)
{
char targetFileName[MAX_LOCATION];
targetFileName[0] = '\0';
CatTargetFileName(targetFileName, compiler, config);
- ide.outputView.buildBox.Logf("\n%s (%s) - ", targetFileName, configName);
+ ide.outputView.buildBox.Logf("\n%s (%s) - ", targetFileName, lastBuildConfigName);
}
if(numErrors)
ide.outputView.buildBox.Logf("%d %s, ", numErrors, (numErrors > 1) ? $"errors" : $"error");
delete cxx;
delete strip;
delete ar;
+ delete windres;
- return numErrors == 0;
+ return numErrors == 0 && !ide.projectView.stopBuild;
}
void ProcessCleanPipeOutput(DualPipe f, CompilerConfig compiler, ProjectConfig config)
double lastTime = GetTime();
while(result)
{
- if((result = f.Peek()) && (result = f.GetLine(line, sizeof(line)-1)))
+ if((result = f.Peek()) && (result = f.GetLine(line, sizeof(line)-1)) && line[0])
{
if(strstr(line, compiler.makeCommand) == line && line[lenMakeCommand] == ':');
+ else if(strstr(line, "mkdir") == line);
else if(strstr(line, "del") == line);
else if(strstr(line, "rm") == line);
else if(strstr(line, "Could Not Find") == line);
}
}
- bool Build(bool isARun, List<ProjectNode> onlyNodes, CompilerConfig compiler, ProjectConfig config, int bitDepth, bool justPrint, SingleFileCompileMode mode)
+ bool Build(BuildType buildType, List<ProjectNode> onlyNodes, CompilerConfig compiler, ProjectConfig config, int bitDepth, bool justPrint, SingleFileCompileMode mode)
{
bool result = false;
DualPipe f;
bool crossCompiling = (compiler.targetPlatform != GetRuntimePlatform());
char * targetPlatform = crossCompiling ? (char *)compiler.targetPlatform : "";
+ bool eC_Debug = mode.eC_ToolsDebug;
+ bool singleProjectOnlyNode = onlyNodes && onlyNodes.count == 1 && onlyNodes[0].type == project;
int numJobs = compiler.numJobs;
char command[MAX_F_STRING*4];
- char * compilerName;
+ char * compilerName = CopyString(compiler.name);
+ Map<String, NameCollisionInfo> cfgNameCollisions;
+
+ delete lastBuildConfigName;
+ lastBuildConfigName = CopyString(config ? config.name : "Common");
+ delete lastBuildCompilerName;
+ lastBuildCompilerName = CopyString(compiler.name);
+ ProjectLoadLastBuildNamesInfo(this, config);
+ cfgNameCollisions = configsNameCollisions[config ? config.name : ""];
- compilerName = CopyString(compiler.name);
CamelCase(compilerName);
strcpy(configName, config ? config.name : "Common");
PathCatSlash(makeFilePath, makeFile);
// TODO: TEST ON UNIX IF \" around makeTarget is ok
- if(onlyNodes)
+ if(buildType == install)
+ makeTargets.concat(" install");
+ else if(onlyNodes)
{
if(compiler.type.isVC)
{
int len;
char pushD[MAX_LOCATION];
char cfDir[MAX_LOCATION];
- Map<String, NameCollisionInfo> namesInfo { };
GetIDECompilerConfigsDir(cfDir, true, true);
GetWorkingDir(pushD, sizeof(pushD));
ChangeWorkingDir(topNode.path);
ChangeWorkingDir(pushD);
- topNode.GenMakefileGetNameCollisionInfo(namesInfo, config);
for(node : onlyNodes)
{
if(node.GetIsExcluded(config))
ide.outputView.buildBox.Logf($"File %s is excluded from current build configuration.\n", node.name);
else
{
- if(mode == cObject || mode == normal)
- node.DeleteIntermediateFiles(compiler, config, bitDepth, namesInfo, mode == cObject ? true : false);
- node.GetTargets(config, namesInfo, objDirExp.dir, makeTargets);
+ if(!eC_Debug)
+ node.DeleteIntermediateFiles(compiler, config, bitDepth, cfgNameCollisions, mode == cObject ? true : false);
+ node.GetTargets(config, cfgNameCollisions, objDirExp.dir, makeTargets);
}
}
- namesInfo.Free();
- delete namesInfo;
}
}
sprintf(command, "%s /useenv /nologo /logcommands %s.sln %s|Win32", compiler.makeCommand, name, config.name);
if(justPrint)
ide.outputView.buildBox.Logf("%s\n", command);
- if((f = DualPipeOpen(PipeOpenMode { output = true, error = true, input = true }, command)))
+ if((f = DualPipeOpen(PipeOpenMode { output = true, error = true/*, input = true*/ }, command)))
{
ProcessPipeOutputRaw(f);
delete f;
{
char cfDir[MAX_LOCATION];
GetIDECompilerConfigsDir(cfDir, true, true);
- sprintf(command, "%s %sCF_DIR=\"%s\"%s%s%s%s%s COMPILER=%s %s-j%d %s%s%s -C \"%s\"%s -f \"%s\"",
+ sprintf(command, "%s%s %sCF_DIR=\"%s\"%s%s%s%s%s%s COMPILER=%s %s-j%d %s%s%s -C \"%s\"%s -f \"%s\"",
+#if defined(__WIN32__)
+ "",
+#else
+ buildType == install ? "pkexec --user root " : "",
+#endif
compiler.makeCommand,
mode == debugPrecompile ? "ECP_DEBUG=y " : mode == debugCompile ? "ECC_DEBUG=y " : mode == debugGenerateSymbols ? "ECS_DEBUG=y " : "",
cfDir,
targetPlatform,
bitDepth ? " ARCH=" : "",
bitDepth == 32 ? "32" : bitDepth == 64 ? "64" : "",
+ ide.workspace.useValgrind ? " DISABLED_POOLING=1" : "",
/*(bitDepth == 64 && compiler.targetPlatform == win32) ? " GCC_PREFIX=x86_64-w64-mingw32-" : (bitDepth == 32 && compiler.targetPlatform == win32) ? " GCC_PREFIX=i686-w64-mingw32-" :*/ "",
- compilerName, (mode == debugCompile || mode == debugGenerateSymbols || mode == debugPrecompile) ? "--always-make " : "", numJobs,
- compiler.ccacheEnabled ? "CCACHE=y " : "",
- compiler.distccEnabled ? "DISTCC=y " : "",
- (String)makeTargets, topNode.path, (justPrint || (mode != normal && mode != cObject)) ? " -n" : "", makeFilePath);
+ compilerName, eC_Debug ? "--always-make " : "", numJobs,
+ (compiler.ccacheEnabled && !eC_Debug) ? "CCACHE=y " : "",
+ (compiler.distccEnabled && !eC_Debug) ? "DISTCC=y " : "",
+ (String)makeTargets, topNode.path, (justPrint || eC_Debug) ? " -n" : "", makeFilePath);
if(justPrint)
ide.outputView.buildBox.Logf("%s\n", command);
{
bool found = false;
bool error = false;
- if(mode != normal && mode != cObject)
+ if(eC_Debug)
{
char line[65536];
+ if(justPrint)
+ ide.outputView.buildBox.Logf($"\nMake outputs the following list of commands to choose from:\n");
while(!f.Eof())
{
bool result = true;
while(result)
{
- if((result = f.Peek()) && (result = f.GetLine(line, sizeof(line)-1)))
+ if((result = f.Peek()) && (result = f.GetLine(line, sizeof(line)-1)) && line[0])
{
+ if(justPrint)
+ ide.outputView.buildBox.Logf("%s\n", line);
if(!error && !found && strstr(line, "echo ") == line)
{
strcpy(command, line+5);
error = true;
}
- if(!error && !found && strstr(line, "ide ") == line)
+ if(!error && (singleProjectOnlyNode || !found) && strstr(line, "ide ") == line)
{
strcpy(command, line);
found = true;
result = true;
}
else if(justPrint)
- {
- ProcessPipeOutputRaw(f);
- result = true;
- }
+ result = ProcessPipeOutputRaw(f);
else
- result = ProcessBuildPipeOutput(f, objDirExp, isARun, onlyNodes, compiler, config, bitDepth);
+ result = ProcessBuildPipeOutput(f, objDirExp, buildType, onlyNodes, compiler, config, bitDepth);
delete f;
- if(error || (justPrint && found))
+ if(error)
ide.outputView.buildBox.Logf("%s\n", command);
+ else if(justPrint && found)
+ ide.outputView.buildBox.Logf($"\nThe following command was chosen to be executed:\n%s\n", command);
else if(found)
Execute(command);
}
topNode.path, justPrint ? " -n": "", makeFilePath);
if(justPrint)
ide.outputView.buildBox.Logf("%s\n", command);
- if((f = DualPipeOpen(PipeOpenMode { output = 1, error = 1, input = 2 }, command)))
+ if((f = DualPipeOpen(PipeOpenMode { output = true, error = true, input = true }, command)))
{
- ide.outputView.buildBox.Tell($"Deleting target and object files...");
+ ide.outputView.buildBox.Tellf($"Deleting %s%s...",
+ cleanType == realClean ? $"intermediate objects directory" : $"target",
+ cleanType == clean ? $" and object files" : "");
if(justPrint)
ProcessPipeOutputRaw(f);
else
ProcessCleanPipeOutput(f, compiler, config);
+ ide.outputView.buildBox.Logf($"%s%s deleted\n",
+ cleanType == realClean ? $"Intermediate objects directory" : $"Target",
+ cleanType == clean ? $" and object files" : "");
delete f;
-
- ide.outputView.buildBox.Logf($"Target and object files deleted\n");
}
}
// Build(project, ideMain, true, null, false);
- #if defined(__WIN32__)
strcpy(target, topNode.path);
- #else
- strcpy(target, "");
- #endif
PathCatSlash(target, targetDirExp.dir);
CatTargetFileName(target, compiler, config);
sprintf(target, "%s %s", target, args);
}
else
ChangeWorkingDir(topNode.path);
- // ChangeWorkingDir(topNode.path);
SetPath(true, compiler, config, bitDepth);
if(executableLauncher)
{
- char * prefixedTarget = new char[strlen(executableLauncher) + strlen(target) + 2];
+ char * prefixedTarget = new char[strlen(executableLauncher) + strlen(target) + 8];
prefixedTarget[0] = '\0';
strcat(prefixedTarget, executableLauncher);
strcat(prefixedTarget, " ");
delete target;
}
- void Compile(List<ProjectNode> nodes, CompilerConfig compiler, ProjectConfig config, int bitDepth, bool justPrint, SingleFileCompileMode mode)
+ bool Compile(List<ProjectNode> nodes, CompilerConfig compiler, ProjectConfig config, int bitDepth, bool justPrint, SingleFileCompileMode mode)
{
- Build(false, nodes, compiler, config, bitDepth, justPrint, mode);
+ return Build(build, nodes, compiler, config, bitDepth, justPrint, mode);
}
#endif
fileName[0] = '\0';
if(targetType == staticLibrary || targetType == sharedLibrary)
strcat(fileName, "$(LP)");
- // !!! ReplaceSpaces must be done after all PathCat calls !!!
- // ReplaceSpaces(s, GetTargetFileName(config));
strcat(fileName, GetTargetFileName(config));
switch(targetType)
{
f.Printf("CXX := $(CCACHE_COMPILE)$(DISTCC_COMPILE)$(GCC_PREFIX)%s$(_SYSROOT)\n", compiler.cxxCommand);
f.Printf("ECP := $(if $(ECP_DEBUG),ide -debug-start \"$(ECERE_SDK_SRC)/compiler/ecp/ecp.epj\" -debug-work-dir \"${CURDIR}\" -@,%s)\n", compiler.ecpCommand);
f.Printf("ECC := $(if $(ECC_DEBUG),ide -debug-start \"$(ECERE_SDK_SRC)/compiler/ecc/ecc.epj\" -debug-work-dir \"${CURDIR}\" -@,%s)$(if $(CROSS_TARGET), -t $(TARGET_PLATFORM),)\n", compiler.eccCommand);
- f.Printf("ECS := $(if $(ECS_DEBUG),ide -debug-start \"$(ECERE_SDK_SRC)/compiler/ecs/ecs.epj\" -debug-work-dir \"${CURDIR}\" -@,%s)$(if $(CROSS_TARGET), -t $(TARGET_PLATFORM),)\n", compiler.ecsCommand);
+ f.Printf("ECS := $(if $(ECS_DEBUG),ide -debug-start \"$(ECERE_SDK_SRC)/compiler/ecs/ecs.epj\" -debug-work-dir \"${CURDIR}\" -@,%s)$(if $(CROSS_TARGET), -t $(TARGET_PLATFORM),)$(if $(OUTPUT_POT), -outputpot,)$(if $(DISABLED_POOLING), -disabled-pooling,)\n", compiler.ecsCommand);
f.Printf("EAR := %s\n", compiler.earCommand);
f.Puts("AS := $(GCC_PREFIX)as\n");
f.Puts("LD := $(GCC_PREFIX)ld\n");
f.Puts("AR := $(GCC_PREFIX)ar\n");
f.Puts("STRIP := $(GCC_PREFIX)strip\n");
+ f.Puts("ifdef WINDOWS_TARGET\n");
+ f.Puts("WINDRES := $(GCC_PREFIX)windres\n");
+ f.Puts(" ifdef ARCH\n");
+ f.Puts(" ifeq \"$(ARCH)\" \"x32\"\n");
+ f.Puts("WINDRES_FLAGS := -F pe-i386\n");
+ f.Puts(" else\n");
+ f.Puts(" ifeq \"$(ARCH)\" \"x64\"\n");
+ f.Puts("WINDRES_FLAGS := -F pe-x86-64\n");
+ f.Puts(" endif\n");
+ f.Puts(" endif\n");
+ f.Puts(" endif\n");
+ f.Puts("endif\n");
f.Puts("UPX := upx\n");
f.Puts("\n");
if(compiler.includeDirs && compiler.includeDirs.count)
{
f.Puts("\nCFLAGS +=");
- OutputListOption(f, gccCompiler ? "isystem " : "I", compiler.includeDirs, lineEach, true);
+ OutputFlags(f, gccCompiler ? _isystem : _I, compiler.includeDirs, lineEach);
f.Puts("\n");
}
if(compiler.prepDirectives && compiler.prepDirectives.count)
{
f.Puts("\nCFLAGS +=");
- OutputListOption(f, "D", compiler.prepDirectives, inPlace, true);
+ OutputFlags(f, _D, compiler.prepDirectives, inPlace);
f.Puts("\n");
}
if(compiler.libraryDirs && compiler.libraryDirs.count)
{
f.Puts("\nLDFLAGS +=");
- OutputListOption(f, "L", compiler.libraryDirs, lineEach, true);
+ OutputFlags(f, _L, compiler.libraryDirs, lineEach);
// We would need a bool option to know whether we want to add to rpath as well...
- // OutputListOption(f, "Wl,-rpath ", compiler.libraryDirs, lineEach, true);
+ // OutputFlags(f, _Wl-rpath, compiler.libraryDirs, lineEach);
f.Puts("\n");
}
if(compiler.excludeLibs && compiler.excludeLibs.count)
if(compiler.compilerFlags && compiler.compilerFlags.count)
{
f.Puts("\nCFLAGS +=");
- OutputListOption(f, "", compiler.compilerFlags, inPlace, true);
+ OutputFlags(f, any, compiler.compilerFlags, inPlace);
f.Puts("\n");
}
if(compiler.linkerFlags && compiler.linkerFlags.count)
{
f.Puts("\nLDFLAGS +=");
- OutputListOption(f, "Wl,", compiler.linkerFlags, inPlace, true);
+ OutputFlags(f, _Wl, compiler.linkerFlags, inPlace);
f.Puts("\n");
}
f.Puts("\n");
char fixedModuleName[MAX_FILENAME];
char fixedConfigName[MAX_FILENAME];
int c, len;
+ int lenObjDirExpNoSpaces, lenTargetDirExpNoSpaces;
// Non-zero if we're building eC code
// We'll have to be careful with this when merging configs where eC files can be excluded in some configs and included in others
int numCObjects = 0;
int numObjects = 0;
int numRCObjects = 0;
bool containsCXX = false; // True if the project contains a C++ file
- bool sameObjTargetDirs;
+ bool relObjDir, sameOrRelObjTargetDirs;
String objDirExp = GetObjDirExpression(config);
TargetTypes targetType = GetTargetType(config);
ReplaceSpaces(fixedConfigName, GetConfigName(config));
CamelCase(fixedConfigName);
- sameObjTargetDirs = !fstrcmp(objDirExpNoSpaces, targetDirExpNoSpaces);
+ lenObjDirExpNoSpaces = strlen(objDirExpNoSpaces);
+ relObjDir = lenObjDirExpNoSpaces == 0 ||
+ (objDirExpNoSpaces[0] == '.' && (lenObjDirExpNoSpaces == 1 || objDirExpNoSpaces[1] == '.'));
+ lenTargetDirExpNoSpaces = strlen(targetDirExpNoSpaces);
+ sameOrRelObjTargetDirs = lenTargetDirExpNoSpaces == 0 ||
+ (targetDirExpNoSpaces[0] == '.' && (lenTargetDirExpNoSpaces == 1 || targetDirExpNoSpaces[1] == '.')) ||
+ !fstrcmp(objDirExpNoSpaces, targetDirExpNoSpaces);
- f.Printf(".PHONY: all objdir%s cleantarget clean realclean distclean\n\n", sameObjTargetDirs ? "" : " targetdir");
+ f.Printf(".PHONY: all objdir%s cleantarget clean realclean distclean\n\n", sameOrRelObjTargetDirs ? "" : " targetdir");
f.Puts("# CORE VARIABLES\n\n");
{
f.Puts(" \\\n\t ");
for(s : projectPlatformOptions.options.compilerOptions)
- {
f.Printf(" %s", s);
- }
}
if(configPlatformOptions && configPlatformOptions.options.compilerOptions && configPlatformOptions.options.compilerOptions.count)
{
f.Puts(" \\\n\t ");
for(s : configPlatformOptions.options.compilerOptions)
- {
f.Printf(" %s", s);
- }
}
f.Puts("\n");
f.Puts("\n");
{
f.Puts("OFLAGS +=");
if(configPlatformOptions && configPlatformOptions.options.libraryDirs)
- OutputListOption(f, "L", configPlatformOptions.options.libraryDirs, lineEach, true);
+ OutputFlags(f, _L, configPlatformOptions.options.libraryDirs, lineEach);
if(projectPlatformOptions && projectPlatformOptions.options.libraryDirs)
- OutputListOption(f, "L", projectPlatformOptions.options.libraryDirs, lineEach, true);
+ OutputFlags(f, _L, projectPlatformOptions.options.libraryDirs, lineEach);
f.Puts("\n");
}
- if((configPlatformOptions && configPlatformOptions.options.libraries))
+ if(configPlatformOptions && configPlatformOptions.options.libraries)
{
if(configPlatformOptions.options.libraries.count)
{
f.Puts("\n");
}
+ if((config && config.options && config.options.compilerOptions && config.options.compilerOptions.count) ||
+ (options && options.compilerOptions && options.compilerOptions.count))
+ {
+ f.Puts("CFLAGS +=");
+ f.Puts(" \\\n\t");
+
+ if(config && config.options && config.options.compilerOptions && config.options.compilerOptions.count)
+ {
+ for(s : config.options.compilerOptions)
+ f.Printf(" %s", s);
+ }
+ if(options && options.compilerOptions && options.compilerOptions.count)
+ {
+ for(s : options.compilerOptions)
+ f.Printf(" %s", s);
+ }
+ f.Puts("\n");
+ f.Puts("\n");
+ }
+
if((config && config.options && config.options.linkerOptions && config.options.linkerOptions.count) ||
(options && options.linkerOptions && options.linkerOptions.count))
{
f.Printf(",%s", s);
}
}
+ f.Puts("\n");
+ f.Puts("\n");
}
- f.Puts("\n");
- f.Puts("\n");
f.Puts("CECFLAGS += -cpp $(_CPP)");
f.Puts("\n");
f.Puts("ifndef STATIC_LIBRARY_TARGET\n");
f.Puts("OFLAGS +=");
if(config && config.options && config.options.libraryDirs)
- OutputListOption(f, "L", config.options.libraryDirs, lineEach, true);
+ OutputFlags(f, _L, config.options.libraryDirs, lineEach);
if(options && options.libraryDirs)
- OutputListOption(f, "L", options.libraryDirs, lineEach, true);
+ OutputFlags(f, _L, options.libraryDirs, lineEach);
f.Puts("\n");
f.Puts("endif\n");
f.Puts("\n");
f.Puts("# TARGETS\n");
f.Puts("\n");
- f.Printf("all: objdir%s $(TARGET)\n", sameObjTargetDirs ? "" : " targetdir");
+ f.Printf("all: objdir%s $(TARGET)\n", sameOrRelObjTargetDirs ? "" : " targetdir");
f.Puts("\n");
f.Puts("objdir:\n");
+ if(!relObjDir)
f.Puts("\t$(if $(wildcard $(OBJ)),,$(call mkdirq,$(OBJ)))\n");
- f.Puts("\t$(if $(ECERE_SDK_SRC),$(if $(wildcard $(call escspace,$(ECERE_SDK_SRC)/crossplatform.mk)),,@$(call echo,Ecere SDK Source Warning: The value of ECERE_SDK_SRC is pointing to an incorrect ($(ECERE_SDK_SRC)/crossplatform.mk) location.)),)\n");
- f.Puts("\t$(if $(ECERE_SDK_SRC),,$(if $(ECP_DEBUG),@$(call echo,ECC Debug Warning: Please define ECERE_SDK_SRC before using ECP_DEBUG),))\n");
- f.Puts("\t$(if $(ECERE_SDK_SRC),,$(if $(ECC_DEBUG),@$(call echo,ECC Debug Warning: Please define ECERE_SDK_SRC before using ECC_DEBUG),))\n");
- f.Puts("\t$(if $(ECERE_SDK_SRC),,$(if $(ECS_DEBUG),@$(call echo,ECC Debug Warning: Please define ECERE_SDK_SRC before using ECS_DEBUG),))\n");
+
+ f.Puts("\t$(if $(ECERE_SDK_SRC),$(if $(wildcard $(call escspace,$(ECERE_SDK_SRC)/crossplatform.mk)),,@$(call echo,Ecere SDK Source Warning: The value of ECERE_SDK_SRC is pointing to an incorrect ($(ECERE_SDK_SRC)) location.)),)\n");
+ f.Puts("\t$(if $(ECERE_SDK_SRC),,$(if $(ECP_DEBUG)$(ECC_DEBUG)$(ECS_DEBUG),@$(call echo,ECC Debug Warning: Please define ECERE_SDK_SRC before using ECP_DEBUG, ECC_DEBUG or ECS_DEBUG),))\n");
//f.Puts("# PRE-BUILD COMMANDS\n");
if(options && options.prebuildCommands)
{
}
f.Puts("\n");
- if(!sameObjTargetDirs)
+ if(!sameOrRelObjTargetDirs)
{
f.Puts("targetdir:\n");
f.Printf("\t$(if $(wildcard %s),,$(call mkdirq,%s))\n", targetDirExpNoSpaces, targetDirExpNoSpaces);
// Main Module (Linking) for ECERE C modules
f.Puts("$(OBJ)$(MODULE).main.ec: $(SYMBOLS) $(COBJECTS)\n");
// use of objDirExpNoSpaces used instead of $(OBJ) to prevent problematic joining of arguments in ecs
- f.Printf("\t$(ECS)%s $(ARCH_FLAGS) $(ECSLIBOPT) $(SYMBOLS) $(IMPORTS) -symbols %s -o $@\n",
+ f.Printf("\t$(ECS)%s $(ARCH_FLAGS) $(ECSLIBOPT) $(SYMBOLS) $(IMPORTS) -symbols %s -o $(call escspace,$@)\n",
GetConsole(config) ? " -console" : "", objDirExpNoSpaces);
f.Puts("\n");
// Main Module (Linking) for ECERE C modules
f.Puts("\t$(ECP) $(CFLAGS) $(CECFLAGS) $(ECFLAGS) $(PRJ_CFLAGS)"
" -c $(OBJ)$(MODULE).main.ec -o $(OBJ)$(MODULE).main.sym -symbols $(OBJ)\n");
f.Puts("\t$(ECC) $(CFLAGS) $(CECFLAGS) $(ECFLAGS) $(PRJ_CFLAGS) $(FVISIBILITY)"
- " -c $(OBJ)$(MODULE).main.ec -o $@ -symbols $(OBJ)\n");
+ " -c $(OBJ)$(MODULE).main.ec -o $(call escspace,$@) -symbols $(OBJ)\n");
f.Puts("\n");
}
// *** Target ***
// This would not rebuild the target on updated objects
- // f.Printf("$(TARGET): $(SOURCES) $(RESOURCES) | objdir $(SYMBOLS) $(OBJECTS)%s\n", sameObjTargetDirs ? "" : " targetdir");
+ // f.Printf("$(TARGET): $(SOURCES) $(RESOURCES) | objdir $(SYMBOLS) $(OBJECTS)%s\n", sameOrRelObjTargetDirs ? "" : " targetdir");
// This should fix it for good!
f.Puts("$(SYMBOLS): | objdir\n");
// This alone was breaking the tarball, object directory does not get created first (order-only rules happen last it seems!)
f.Printf("$(TARGET): $(SOURCES)%s $(RESOURCES) $(SYMBOLS) $(OBJECTS) | objdir%s\n",
- rcSourcesParts ? " $(RCSOURCES)" : "", sameObjTargetDirs ? "" : " targetdir");
+ rcSourcesParts ? " $(RCSOURCES)" : "", sameOrRelObjTargetDirs ? "" : " targetdir");
f.Printf("\t@$(call rmq,$(OBJ)linkobjects.lst)\n");
f.Printf("\t@$(call touch,$(OBJ)linkobjects.lst)\n");
f.Puts("\t$(UPX) $(UPXFLAGS) $(TARGET)\n");
f.Puts("endif\n");
f.Puts("else\n");
+ f.Puts("ifneq \"$(TARGET_ARCH)\" \"x86_64\"\n");
f.Puts("\t$(UPX) $(UPXFLAGS) $(TARGET)\n");
f.Puts("endif\n");
+ f.Puts("endif\n");
}
}
if(resNode.files && resNode.files.count && !noResources)
}
f.Puts("\n");
+ test = false;
+ if(platforms || (config && config.platforms))
+ {
+ for(platform = (Platform)1; platform < Platform::enumSize; platform++)
+ {
+ PlatformOptions projectPOs, configPOs;
+ MatchProjectAndConfigPlatformOptions(config, platform, &projectPOs, &configPOs);
+
+ if((projectPOs && projectPOs.options.installCommands && projectPOs.options.installCommands.count) ||
+ (configPOs && configPOs.options.installCommands && configPOs.options.installCommands.count))
+ {
+ test = true;
+ break;
+ }
+ }
+ }
+ if(test || (options && options.installCommands) ||
+ (config && config.options && config.options.installCommands))
+ {
+ f.Puts("install:\n");
+ if(options && options.installCommands)
+ {
+ for(s : options.installCommands)
+ if(s && s[0]) f.Printf("\t%s\n", s);
+ }
+ if(config && config.options && config.options.installCommands)
+ {
+ for(s : config.options.installCommands)
+ if(s && s[0]) f.Printf("\t%s\n", s);
+ }
+ if(platforms || (config && config.platforms))
+ {
+ ifCount = 0;
+ for(platform = (Platform)1; platform < Platform::enumSize; platform++)
+ {
+ PlatformOptions projectPOs, configPOs;
+ MatchProjectAndConfigPlatformOptions(config, platform, &projectPOs, &configPOs);
+
+ if((projectPOs && projectPOs.options.installCommands && projectPOs.options.installCommands.count) ||
+ (configPOs && configPOs.options.installCommands && configPOs.options.installCommands.count))
+ {
+ if(ifCount)
+ f.Puts("else\n");
+ ifCount++;
+ f.Printf("ifdef %s\n", PlatformToMakefileTargetVariable(platform));
+
+ if(projectPOs && projectPOs.options.installCommands && projectPOs.options.installCommands.count)
+ {
+ for(s : projectPOs.options.installCommands)
+ if(s && s[0]) f.Printf("\t%s\n", s);
+ }
+ if(configPOs && configPOs.options.installCommands && configPOs.options.installCommands.count)
+ {
+ for(s : configPOs.options.installCommands)
+ if(s && s[0]) f.Printf("\t%s\n", s);
+ }
+ }
+ }
+ if(ifCount)
+ {
+ int c;
+ for(c = 0; c < ifCount; c++)
+ f.Puts("endif\n");
+ }
+ }
+ f.Puts("\n");
+ }
+
f.Puts("# SYMBOL RULES\n");
f.Puts("\n");
if(numCObjects)
GenMakefilePrintMainObjectRule(f, config);
- f.Printf("cleantarget: objdir%s\n", sameObjTargetDirs ? "" : " targetdir");
+ f.Printf("cleantarget: objdir%s\n", sameOrRelObjTargetDirs ? "" : " targetdir");
f.Puts("\t$(call rmq,$(TARGET))\n");
+ if(numCObjects)
+ f.Printf("\t$(call rmq,%s)\n", "$(OBJ)$(MODULE).main.o $(OBJ)$(MODULE).main.c $(OBJ)$(MODULE).main.ec $(OBJ)$(MODULE).main$(I) $(OBJ)$(MODULE).main$(S)");
f.Puts("ifdef SHARED_LIBRARY_TARGET\n");
f.Puts("ifdef LINUX_TARGET\n");
f.Puts("ifdef LINUX_HOST\n");
}
if(numCObjects)
{
- f.Printf("\t$(call rmq,%s)\n", "$(OBJ)$(MODULE).main.o $(OBJ)$(MODULE).main.c $(OBJ)$(MODULE).main.ec $(OBJ)$(MODULE).main$(I) $(OBJ)$(MODULE).main$(S)");
OutputCleanActions(f, "ECOBJECTS", eCsourcesParts);
OutputCleanActions(f, "COBJECTS", eCsourcesParts);
OutputCleanActions(f, "BOWLS", eCsourcesParts);
f.Puts("realclean: cleantarget\n");
f.Puts("\t$(call rmrq,$(OBJ))\n");
- if(!sameObjTargetDirs)
+ if(!sameOrRelObjTargetDirs)
f.Printf("\t$(call rmdirq,%s)\n", targetDirExpNoSpaces);
f.Puts("\n");
f.Puts("distclean: cleantarget\n");
- if(!sameObjTargetDirs)
+ if(!sameOrRelObjTargetDirs)
f.Printf("\t$(call rmdirq,%s)\n", targetDirExpNoSpaces);
- f.Puts("\t$(call rmrq,obj/)\n");
+ if(!relObjDir)
+ f.Puts("\t$(call rmrq,obj/)\n");
delete f;
}
// Execute it
- if((dep = DualPipeOpen(PipeOpenMode { output = 1, error = 1, input = 2 }, command)))
+ if((dep = DualPipeOpen(PipeOpenMode { output = true, error = true/*, input = true*/ }, command)))
{
char line[1024];
bool result = true;
{
#endif
f.Puts("$(OBJ)$(MODULE).main$(O): $(OBJ)$(MODULE).main.c\n");
- f.Printf("\t$(CC) $(CFLAGS) $(PRJ_CFLAGS) $(FVISIBILITY) -c $(OBJ)$(MODULE).main.%s -o $@\n", extension);
+ f.Printf("\t$(CC) $(CFLAGS) $(PRJ_CFLAGS) $(FVISIBILITY) -c $(OBJ)$(MODULE).main.%s -o $(call escspace,$@)\n", extension);
f.Puts("\n");
#if 0
}
else
f.Printf("CUSTOM%d_%s =", v-1, variableName);
f.Puts(&v ? &v : "");
- f.Puts("\n");
- f.Puts("\n");
+ f.Puts("\n\n");
break;
}
}
}
- f.Puts("\n");
}
void MatchProjectAndConfigPlatformOptions(ProjectConfig config, Platform platform,
}
}
+static inline void ProjectLoadLastBuildNamesInfo(Project prj, ProjectConfig cfg)
+{
+ char * cfgName = cfg ? cfg.name : "";
+ Map<String, NameCollisionInfo> cfgNameCollisions = prj.configsNameCollisions[cfgName];
+ if(cfgNameCollisions)
+ {
+ cfgNameCollisions.Free();
+ delete cfgNameCollisions;
+ }
+ prj.configsNameCollisions[cfgName] = cfgNameCollisions = { };
+ prj.topNode.GenMakefileGetNameCollisionInfo(cfgNameCollisions, cfg);
+}
+
Project LegacyBinaryLoadProject(File f, char * filePath)
{
Project project = null;
delete project.topNode.files;
if(!project.files) project.files = { };
project.topNode.files = project.files;
+
+ {
+ char topNodePath[MAX_LOCATION];
+ GetWorkingDir(topNodePath, sizeof(topNodePath)-1);
+ MakeSlashPath(topNodePath);
+ PathCatSlash(topNodePath, filePath);
+ project.filePath = topNodePath;//filePath;
+ }
+
+ project.topNode.FixupNode(insidePath);
+
project.resNode = project.topNode.Add(project, "Resources", project.topNode.files.last, resources, archiveFile, false);
delete project.resNode.path;
project.resNode.path = project.resourcesPath;
project.resources = null;
if(!project.configurations) project.configurations = { };
- {
- char topNodePath[MAX_LOCATION];
- GetWorkingDir(topNodePath, sizeof(topNodePath)-1);
- MakeSlashPath(topNodePath);
- PathCatSlash(topNodePath, filePath);
- project.filePath = topNodePath;//filePath;
- }
-
- project.topNode.FixupNode(insidePath);
+ project.resNode.FixupNode(insidePath);
}
delete parser;
}
{
if(!project.options) project.options = { };
if(activeConfigName && activeConfigName[0] && project.configurations)
- {
- for(cfg : project.configurations)
- {
- if(!strcmpi(cfg.name, activeConfigName))
- {
- project.config = cfg;
- break;
- }
- }
- }
+ project.config = project.GetConfig(activeConfigName);
if(!project.config && project.configurations)
project.config = project.configurations.firstIterator.data;