#ifndef MAKEFILE_GENERATOR
globalSettingsDialog.ideSettings = settings;
ide.UpdateRecentMenus();
+ ide.UpdateCompilerConfigs(true);
#endif
}
};
define ProjectExtension = "epj";
define stringInFileIncludedFrom = "In file included from ";
+define stringFrom = " from ";
+// This function cannot accept same pointer for source and output
void ReplaceSpaces(char * output, char * source)
{
int c, dc;
output[dc] = '\0';
}
+// This function cannot accept same pointer for source and output
void ReplaceUnwantedMakeChars(char * output, char * source)
{
int c, dc;
return numOfBreaks;
}
+void OutputLinkObjectActions(File f, char * name, int parts)
+{
+ if(parts > 1)
+ {
+ int c;
+ for(c=0; c<parts; c++)
+ f.Printf("\t@$(call echo,$(%s%d)) >> $(OBJ)linkobjects.lst\n", name, c+1);
+ } else if(parts) {
+ f.Printf("\t@$(call echo,$(%s)) >> $(OBJ)linkobjects.lst\n", name);
+ }
+}
+
void OutputCleanActions(File f, char * name, int parts)
{
if(parts > 1)
return config ? config.name : "Common";
}
-public enum SingleFileCompileMode { normal, debugPrecompile, debugCompile, debugGenerateSymbols };
+public enum SingleFileCompileMode { normal, debugPrecompile, debugCompile, debugGenerateSymbols, cObject };
class Project : struct
{
float version;
String moduleName;
+ property char * moduleVersion
+ {
+ set { delete moduleVersion; if(value && value[0]) moduleVersion = CopyString(value); } // TODO: use CopyString function that filters chars
+ get { return moduleVersion ? moduleVersion : ""; } // version number should only use digits and dots
+ isset { return moduleVersion != null && moduleVersion[0]; } // add leading/trailing 0 if value start/ends with dot(s)
+ }
+
+ property char * description
+ {
+ set { delete description; if(value && value[0]) description = CopyString(value); }
+ get { return description ? description : ""; }
+ isset { return description != null && description[0]; }
+ }
+
+ property char * license
+ {
+ set { delete license; if(value && value[0]) license = CopyString(value); }
+ get { return license ? license : ""; }
+ isset { return license != null && license[0]; }
+ }
+
+ property char * compilerConfigsDir
+ {
+ set { delete compilerConfigsDir; if(value && value[0]) compilerConfigsDir = CopyString(value); }
+ get { return compilerConfigsDir ? compilerConfigsDir : ""; }
+ isset { return compilerConfigsDir && compilerConfigsDir[0]; }
+ }
+
property ProjectOptions options { get { return options; } set { options = value; } isset { return options && !options.isEmpty; } }
property Array<PlatformOptions> platforms
{
String resourcesPath;
LinkList<ProjectNode> resources;
- property char * description
- {
- set { delete description; if(value && value[0]) description = CopyString(value); }
- get { return description ? description : ""; }
- isset { return description != null && description[0]; }
- }
-
- property char * license
- {
- set { delete license; if(value && value[0]) license = CopyString(value); }
- get { return license ? license : ""; }
- isset { return license != null && license[0]; }
- }
-
- property char * compilerConfigsDir
- {
- set { delete compilerConfigsDir; if(value && value[0]) compilerConfigsDir = CopyString(value); }
- get { return compilerConfigsDir ? compilerConfigsDir : ""; }
- isset { return compilerConfigsDir && compilerConfigsDir[0]; }
- }
-
private:
// topNode.name holds the file name (.epj)
ProjectOptions options;
String description;
String license;
String compilerConfigsDir;
+ String moduleVersion;
+
#ifndef MAKEFILE_GENERATOR
FileMonitor fileMonitor
{
ProjectView projectView = ide.projectView;
DataRow prev = topNode.row ? topNode.row.previous : null;
FileMonitor fm = fileMonitor;
-
- if(projectView) projectView.DeleteNode(topNode);
-
- *this = *project;
- delete fileMonitor;
- fileMonitor = fm;
- topNode.project = this;
+ bool confirmation = true;
if(projectView)
{
- CompilerConfig compiler = ideSettings.GetCompilerConfig(projectView.workspace.compiler);
- projectView.AddNode(topNode, null);
- topNode.row.Move(prev);
+ if(projectView.projectSettingsDialog)
+ {
+ confirmation = projectView.projectSettingsDialog.CloseConfirmation(true);
+ if(confirmation)
+ projectView.projectSettingsDialog.Destroy(0);
+ }
+ if(confirmation)
+ projectView.DeleteNode(topNode);
+ }
+ if(confirmation)
+ {
+ *this = *project;
+ delete fileMonitor;
+ fileMonitor = fm;
+ topNode.project = this;
- projectView.ShowOutputBuildLog(true);
- projectView.DisplayCompiler(compiler, false);
- projectView.ProjectUpdateMakefileForAllConfigs(this);
- delete compiler;
+ if(projectView)
+ {
+ CompilerConfig compiler = ideSettings.GetCompilerConfig(projectView.workspace.compiler);
+ projectView.AddNode(topNode, null);
+ topNode.row.Move(prev);
+
+ projectView.ShowOutputBuildLog(true);
+ projectView.DisplayCompiler(compiler, false);
+ projectView.ProjectUpdateMakefileForAllConfigs(this);
+ delete compiler;
+ }
+ eSystem_Delete(project);
}
- eSystem_Delete(project);
+ else
+ delete project;
}
return true;
}
delete license;
delete compilerConfigsDir;
delete moduleName;
+ delete moduleVersion;
delete filePath;
delete topNode;
delete name;
return expression;
}
- DirExpression GetObjDir(CompilerConfig compiler, ProjectConfig config)
+ DirExpression GetObjDir(CompilerConfig compiler, ProjectConfig config, int bitDepth)
{
char * expression = GetObjDirExpression(config);
DirExpression objDir { type = intermediateObjectsDir };
- objDir.Evaluate(expression, this, compiler, config);
+ objDir.Evaluate(expression, this, compiler, config, bitDepth);
return objDir;
}
return expression;
}
- DirExpression GetTargetDir(CompilerConfig compiler, ProjectConfig config)
+ DirExpression GetTargetDir(CompilerConfig compiler, ProjectConfig config, int bitDepth)
{
char * expression = GetTargetDirExpression(config);
DirExpression targetDir { type = DirExpressionType::targetDir /*intermediateObjectsDir*/};
- targetDir.Evaluate(expression, this, compiler, config);
+ targetDir.Evaluate(expression, this, compiler, config, bitDepth);
return targetDir;
}
#endif
}
- void SetPath(bool projectsDirs, CompilerConfig compiler, ProjectConfig config)
+ void SetPath(bool projectsDirs, CompilerConfig compiler, ProjectConfig config, int bitDepth)
{
#ifndef MAKEFILE_GENERATOR
- ide.SetPath(projectsDirs, compiler, config);
+ ide.SetPath(projectsDirs, compiler, config, bitDepth);
#endif
}
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)
}
}
}
- objDirExp = GetObjDir(compiler, config);
+ 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(objDir, objDir);
- strcpy(relativePath, objDir);
+ ReplaceSpaces(relativePath, objDir);
*sl = '.';
PathCatSlash(relativePath, moduleName);
return true;
strcat(string, ".dylib");
else
strcat(string, ".so");
+ if(compiler.targetPlatform == tux && GetRuntimePlatform() == tux && moduleVersion && moduleVersion[0])
+ {
+ strcat(string, ".");
+ strcat(string, moduleVersion);
+ }
break;
case staticLibrary:
strcat(string, ".a");
if(c && ((c.options && cfg.options && cfg.options.console != c.options.console) ||
(!c.options || !cfg.options)))
cfg.symbolGenModified = true;
+ if(c && ((c.options && cfg.options &&
+ ( (cfg.options.libraries && c.options.libraries && cfg.options.libraries.OnCompare(c.options.libraries)) || (!cfg.options.libraries || !c.options.libraries)) )
+ || (!c.options || !cfg.options)))
+ cfg.linkingModified = true;
cfg.makingModified = true;
}
}
bool ProcessBuildPipeOutput(DualPipe f, DirExpression objDirExp, bool isARun, List<ProjectNode> onlyNodes,
- CompilerConfig compiler, ProjectConfig config)
+ CompilerConfig compiler, ProjectConfig config, int bitDepth)
{
char line[65536];
bool compiling = false, linking = false, precompiling = false;
int lenMakeCommand = strlen(compiler.makeCommand);
int testLen = 0;
- char * gccPrefix = compiler.gccPrefix ? compiler.gccPrefix : "";
+ char * gnuToolchainPrefix = compiler.gnuToolchainPrefix ? compiler.gnuToolchainPrefix : "";
DynamicString test { };
DynamicString ecp { };
DynamicString cxx { };
DynamicString strip { };
DynamicString ar { };
-
+ /*
+ if(bitDepth == 64 && compiler.targetPlatform == win32)
+ gnuToolchainPrefix = "x86_64-w64-mingw32-";
+ else if(bitDepth == 32 && compiler.targetPlatform == win32)
+ gnuToolchainPrefix = "i686-w64-mingw32-";
+ */
ecp.concatx(compiler.ecpCommand, " ");
ecc.concatx(compiler.eccCommand, " ");
ecs.concatx(compiler.ecsCommand, " ");
prefix.concatx(
compiler.ccacheEnabled ? "ccache " : "",
compiler.distccEnabled ? "distcc " : "",
- gccPrefix);
+ gnuToolchainPrefix);
cpp.concatx((String)prefix, compiler.cppCommand, " ");
cc.concatx((String)prefix, compiler.ccCommand, " ");
cxx.concatx((String)prefix, compiler.cxxCommand, " ");
- strip.concatx(gccPrefix, "strip ");
- ar.concatx(gccPrefix, "ar rcs");
+ strip.concatx(gnuToolchainPrefix, "strip ");
+ ar.concatx(gnuToolchainPrefix, "ar rcs");
testLen = Max(testLen, ecp.size);
testLen = Max(testLen, ecc.size);
//printf("Peeking and GetLine...\n");
if((result = f.Peek()) && (result = f.GetLine(line, sizeof(line)-1)))
{
+ char * message = null;
char * inFileIncludedFrom = strstr(line, stringInFileIncludedFrom);
+ char * from = strstr(line, stringFrom);
test.copyLenSingleBlankReplTrim(line, ' ', true, testLen);
if(strstr(line, compiler.makeCommand) == line && line[lenMakeCommand] == ':')
{
byte * tokens[1];
char * module;
bool isPrecomp = false;
+ bool gotCC = false;
if(strstr(test, cc) == test || strstr(test, cxx) == test)
{
module = strstr(line, " -c ");
if(module) module += 4;
+ gotCC = true;
}
else if(strstr(test, ecc) == test)
{
//module = line + 3;
// Don't show GCC warnings about generated C code because it does not compile clean yet...
compilingEC = 3;//2;
+ gotCC = true;
}
else if(strstr(test, ecp) == test)
{
if(module) module += 4;
isPrecomp = true;
compilingEC = 0;
+ gotCC = true;
}
loggedALine = true;
else
{
ide.outputView.buildBox.Logf("%s\n", line);
- numErrors++;
+ if(strstr(line, "warning:") || strstr(line, "note:"))
+ numWarnings++;
+ else if(!gotCC && !strstr(line, "At top level") && !strstr(line, "In file included from") && !strstr(line, stringFrom))
+ numErrors++;
}
if(compilingEC) compilingEC--;
colon = strstr(colon + 1, ":");
if(colon)
{
+ char * sayError = "";
char moduleName[MAX_LOCATION], temp[MAX_LOCATION];
char * pointer;
char * error;
- char * start = inFileIncludedFrom ? line + strlen(stringInFileIncludedFrom) : line;
+ 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);
// Don't be mistaken by the drive letter colon
// Cut module name
//if(bracket) *bracket = '\0';
GetLastDirectory(moduleName, temp);
+ GetExtension(temp, ext);
+
+ if(linking && (!strcmp(ext, "o") || !strcmp(ext, "a") || !strcmp(ext, "lib")))
+ {
+ char * cColon = strstr(colon+1, ":");
+ if(cColon && (cColon[1] == '/' || cColon[1] == '\\'))
+ cColon = strstr(cColon + 1, ":");
+ if(cColon)
+ {
+ int len = (int)(cColon - (colon+1));
+ char mName[MAX_LOCATION];
+ len = Min(len, MAX_LOCATION-1);
+ strncpy(mName, colon+1, len);
+ mName[len] = '\0';
+ GetLastDirectory(mName, temp);
+ GetExtension(temp, ext);
+ if(!strcmp(ext, "c") || !strcmp(ext, "cpp") || !strcmp(ext, "cxx") || !strcmp(ext, "ec"))
+ {
+ colon = cColon;
+ strcpy(moduleName, mName);
+ }
+ }
+ }
if(linking && (!strcmp(temp, "ld") || !strcmp(temp, "ld.exe")))
{
- numErrors++;
- strcpy(moduleName, $"Linker Error");
+ moduleName[0] = 0;
+ if(strstr(colon, "skipping incompatible") || strstr(colon, "Recognised but unhandled"))
+ {
+ message = $"Linker Message: ";
+ colon = line;
+ }
+ else
+ {
+ numErrors++;
+ message = $"Linker Error";
+ }
+ }
+ else if(linking && (!strcmp(ext, "") || !strcmp(ext, "exe")))
+ {
+ moduleName[0] = 0;
+ colon = line;
+ if(!strstr(line, "error:"))
+ {
+ message = $"Linker Error: ";
+ numErrors++;
+ }
}
else
{
PathCatSlash(temp, moduleName);
MakePathRelative(temp, topNode.path, moduleName);
}
- if(strstr(line, "error:"))
- numErrors ++;
+ error = strstr(line, "error:");
+ if(!message && error && error > colon)
+ numErrors++;
else
{
- // Silence warnings for compiled EC
+ // Silence warnings for compiled eC
char * objDir = strstr(moduleName, objDirExp.dir);
if(linking)
{
if((pointer = strstr(line, "undefined")) ||
+ (pointer = strstr(line, "multiple definition")) ||
(pointer = strstr(line, "No such file")) ||
(pointer = strstr(line, "token")))
{
strncat(moduleName, colon, pointer - colon);
- strcat(moduleName, "error: ");
+ sayError = "error: ";
colon = pointer;
- numErrors ++;
+ numErrors++;
}
}
else if((pointer = strstr(line, "No such file")))
{
strncat(moduleName, colon, pointer - colon);
- strcat(moduleName, "error: ");
+ sayError = "error: ";
colon = pointer;
- numErrors ++;
+ numErrors++;
}
else if(compilingEC == 1 || (objDir && objDir == moduleName))
continue;
numWarnings++;
}
}
- if(this == ide.workspace.projects.firstIterator.data)
- ide.outputView.buildBox.Logf(" %s%s\n", moduleName, colon);
+ if(message)
+ ide.outputView.buildBox.Logf(" %s%s\n", message, colon);
+ /*else if(this == ide.workspace.projects.firstIterator.data)
+ ide.outputView.buildBox.Logf(" %s%s%s\n", moduleName, sayError, colon);*/
else
{
char fullModuleName[MAX_LOCATION];
- strcpy(fullModuleName, topNode.path);
- PathCat(fullModuleName, moduleName);
- MakePathRelative(fullModuleName, ide.workspace.projects.firstIterator.data.topNode.path, fullModuleName);
- MakeSystemPath(fullModuleName);
- ide.outputView.buildBox.Logf(" %s%s%s\n", inFileIncludedFrom ? stringInFileIncludedFrom : "", fullModuleName, colon);
+ FileAttribs found = 0;
+ Project foundProject = this;
+ if(moduleName[0])
+ {
+ char * loc = strstr(moduleName, ":");
+ if(loc) *loc = 0;
+ strcpy(fullModuleName, topNode.path);
+ PathCat(fullModuleName, moduleName);
+ found = FileExists(fullModuleName);
+ if(!found && !strcmp(ext, "c"))
+ {
+ char ecName[MAX_LOCATION];
+ ChangeExtension(fullModuleName, "ec", ecName);
+ found = FileExists(ecName);
+ }
+ if(!found)
+ {
+ char path[MAX_LOCATION];
+ if(ide && ide.workspace)
+ {
+ for(prj : ide.workspace.projects)
+ {
+ ProjectNode node;
+ MakePathRelative(fullModuleName, prj.topNode.path, path);
+
+ if((node = prj.topNode.FindWithPath(path, false)))
+ {
+ strcpy(fullModuleName, prj.topNode.path);
+ PathCatSlash(fullModuleName, node.path);
+ PathCatSlash(fullModuleName, node.name);
+ found = FileExists(fullModuleName);
+ if(found)
+ {
+ foundProject = prj;
+ break;
+ }
+ }
+ }
+ if(!found && !strchr(moduleName, '/') && !strchr(moduleName, '\\'))
+ {
+ for(prj : ide.workspace.projects)
+ {
+ ProjectNode node;
+ if((node = prj.topNode.Find(moduleName, false)))
+ {
+ strcpy(fullModuleName, prj.topNode.path);
+ PathCatSlash(fullModuleName, node.path);
+ PathCatSlash(fullModuleName, node.name);
+ found = FileExists(fullModuleName);
+ if(found)
+ {
+ foundProject = prj;
+ break;
+ }
+ }
+ }
+ }
+ }
+ }
+ if(found)
+ {
+ MakePathRelative(fullModuleName, ide.workspace.projects.firstIterator.data.topNode.path, fullModuleName);
+ MakeSystemPath(fullModuleName);
+ }
+ else
+ strcpy(fullModuleName, moduleName);
+ if(loc)
+ {
+ strcat(fullModuleName, ":");
+ strcat(fullModuleName, loc + 1);
+ }
+ }
+ else
+ fullModuleName[0] = 0;
+ ide.outputView.buildBox.Logf(" %s%s%s%s\n", inFileIncludedFrom ? stringInFileIncludedFrom : from ? stringFrom : "", fullModuleName, sayError, colon);
}
}
else
else
{
if(!onlyNodes)
- ide.outputView.buildBox.Logf("\n%s (%s) - ", GetTargetFileName(config), configName);
+ {
+ char targetFileName[MAX_LOCATION];
+ targetFileName[0] = '\0';
+ CatTargetFileName(targetFileName, compiler, config);
+ ide.outputView.buildBox.Logf("\n%s (%s) - ", targetFileName, configName);
+ }
if(numErrors)
ide.outputView.buildBox.Logf("%d %s, ", numErrors, (numErrors > 1) ? $"errors" : $"error");
else
}
}
- bool Build(bool isARun, List<ProjectNode> onlyNodes, CompilerConfig compiler, ProjectConfig config, bool justPrint, SingleFileCompileMode mode)
+ bool Build(bool isARun, List<ProjectNode> onlyNodes, CompilerConfig compiler, ProjectConfig config, int bitDepth, bool justPrint, SingleFileCompileMode mode)
{
bool result = false;
DualPipe f;
char makeFile[MAX_LOCATION];
char makeFilePath[MAX_LOCATION];
char configName[MAX_LOCATION];
- DirExpression objDirExp = GetObjDir(compiler, config);
+ DirExpression objDirExp = GetObjDir(compiler, config, bitDepth);
PathBackup pathBackup { };
bool crossCompiling = (compiler.targetPlatform != GetRuntimePlatform());
char * targetPlatform = crossCompiling ? (char *)compiler.targetPlatform : "";
strcpy(configName, config ? config.name : "Common");
- SetPath(false, compiler, config); //true
+ SetPath(false, compiler, config, bitDepth); //true
CatTargetFileName(targetFileName, compiler, config);
strcpy(makeFilePath, topNode.path);
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);
// Create object dir if it does not exist already
if(!FileExists(objDirExp.dir).isDirectory)
{
- sprintf(command, "%s CF_DIR=\"%s\"%s%s COMPILER=%s objdir -C \"%s\"%s -f \"%s\"",
+ sprintf(command, "%s CF_DIR=\"%s\"%s%s%s%s COMPILER=%s objdir -C \"%s\"%s -f \"%s\"",
compiler.makeCommand, cfDir,
- crossCompiling ? " TARGET_PLATFORM=" : "", targetPlatform,
+ crossCompiling ? " TARGET_PLATFORM=" : "",
+ targetPlatform,
+ bitDepth ? " ARCH=" : "", bitDepth == 32 ? "32" : bitDepth == 64 ? "64" : "",
+ /*(bitDepth == 64 && compiler.targetPlatform == win32) ? " GCC_PREFIX=x86_64-w64-mingw32-" : (bitDepth == 32 && compiler.targetPlatform == win32) ? " GCC_PREFIX=i686-w64-mingw32-" : */"",
+
compilerName, topNode.path, justPrint ? " -n" : "", makeFilePath);
if(justPrint)
ide.outputView.buildBox.Logf("%s\n", command);
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
{
- node.DeleteIntermediateFiles(compiler, config);
- node.GetTargets(config, objDirExp.dir, makeTargets);
+ node.DeleteIntermediateFiles(compiler, config, bitDepth, namesInfo, mode == cObject ? true : false);
+ node.GetTargets(config, namesInfo, objDirExp.dir, makeTargets);
}
}
+ namesInfo.Free();
+ delete namesInfo;
}
}
{
char cfDir[MAX_LOCATION];
GetIDECompilerConfigsDir(cfDir, true, true);
- sprintf(command, "%s %sCF_DIR=\"%s\"%s%s COMPILER=%s -j%d %s%s%s -C \"%s\"%s -f \"%s\"",
+ sprintf(command, "%s %sCF_DIR=\"%s\"%s%s%s%s%s COMPILER=%s -j%d %s%s%s -C \"%s\"%s -f \"%s\"",
compiler.makeCommand,
- mode == normal ? "" : (mode == debugPrecompile ? "ECP_DEBUG=y " : mode == debugCompile ? "ECC_DEBUG=y " : mode == debugGenerateSymbols ? "ECS_DEBUG=y " : ""),
+ mode == debugPrecompile ? "ECP_DEBUG=y " : mode == debugCompile ? "ECC_DEBUG=y " : mode == debugGenerateSymbols ? "ECS_DEBUG=y " : "",
cfDir,
- crossCompiling ? " TARGET_PLATFORM=" : "", targetPlatform,
+ crossCompiling ? " TARGET_PLATFORM=" : "",
+ targetPlatform,
+ bitDepth ? " ARCH=" : "",
+ bitDepth == 32 ? "32" : bitDepth == 64 ? "64" : "",
+ /*(bitDepth == 64 && compiler.targetPlatform == win32) ? " GCC_PREFIX=x86_64-w64-mingw32-" : (bitDepth == 32 && compiler.targetPlatform == win32) ? " GCC_PREFIX=i686-w64-mingw32-" :*/ "",
compilerName, numJobs,
compiler.ccacheEnabled ? "CCACHE=y " : "",
compiler.distccEnabled ? "DISTCC=y " : "",
- (String)makeTargets, topNode.path, (justPrint || mode != normal) ? " -n" : "", makeFilePath);
+ (String)makeTargets, topNode.path, (justPrint || (mode != normal && mode != cObject)) ? " -n" : "", makeFilePath);
if(justPrint)
ide.outputView.buildBox.Logf("%s\n", command);
+
if((f = DualPipeOpen(PipeOpenMode { output = true, error = true, input = true }, command)))
{
bool found = false;
ProcessPipeOutputRaw(f);
result = true;
}
- else if(mode != normal)
+ else if(mode != normal && mode != cObject)
{
char line[65536];
while(!f.Eof())
}
}
else
- result = ProcessBuildPipeOutput(f, objDirExp, isARun, onlyNodes, compiler, config);
+ result = ProcessBuildPipeOutput(f, objDirExp, isARun, onlyNodes, compiler, config, bitDepth);
delete f;
if(found)
Execute(command);
return result;
}
- void Clean(CompilerConfig compiler, ProjectConfig config, bool realclean, bool justPrint)
+ void Clean(CompilerConfig compiler, ProjectConfig config, int bitDepth, CleanType cleanType, bool justPrint)
{
char makeFile[MAX_LOCATION];
char makeFilePath[MAX_LOCATION];
compilerName = CopyString(compiler.name);
CamelCase(compilerName);
- SetPath(false, compiler, config);
+ SetPath(false, compiler, config, bitDepth);
strcpy(makeFilePath, topNode.path);
CatMakeFileName(makeFile, config);
{
char cfDir[MAX_LOCATION];
GetIDECompilerConfigsDir(cfDir, true, true);
- sprintf(command, "%s CF_DIR=\"%s\"%s%s COMPILER=%s %sclean -C \"%s\"%s -f \"%s\"",
+ sprintf(command, "%s CF_DIR=\"%s\"%s%s%s%s COMPILER=%s %sclean%s -C \"%s\"%s -f \"%s\"",
compiler.makeCommand, cfDir,
crossCompiling ? " TARGET_PLATFORM=" : "", targetPlatform,
- compilerName, realclean ? "real" : "", topNode.path, justPrint ? " -n": "", makeFilePath);
+ bitDepth ? " ARCH=" : "", bitDepth == 32 ? "32" : bitDepth == 64 ? "64" : "",
+ compilerName,
+ cleanType == realClean ? "real" : "", cleanType == cleanTarget ? "target" : "",
+ 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)))
delete compilerName;
}
- void Run(char * args, CompilerConfig compiler, ProjectConfig config)
+ void Run(char * args, CompilerConfig compiler, ProjectConfig config, int bitDepth)
{
String target = new char[maxPathLen];
char oldDirectory[MAX_LOCATION];
- DirExpression targetDirExp = GetTargetDir(compiler, config);
+ char * executableLauncher = compiler.executableLauncher;
+ DirExpression targetDirExp = GetTargetDir(compiler, config, bitDepth);
PathBackup pathBackup { };
// Build(project, ideMain, true, null, false);
else
ChangeWorkingDir(topNode.path);
// ChangeWorkingDir(topNode.path);
- SetPath(true, compiler, config);
- if(compiler.execPrefixCommand)
+ SetPath(true, compiler, config, bitDepth);
+ if(executableLauncher)
{
- char * prefixedTarget = new char[strlen(compiler.execPrefixCommand) + strlen(target) + 2];
+ char * prefixedTarget = new char[strlen(executableLauncher) + strlen(target) + 2];
prefixedTarget[0] = '\0';
- strcat(prefixedTarget, compiler.execPrefixCommand);
+ strcat(prefixedTarget, executableLauncher);
strcat(prefixedTarget, " ");
strcat(prefixedTarget, target);
Execute(prefixedTarget);
delete target;
}
- void Compile(List<ProjectNode> nodes, CompilerConfig compiler, ProjectConfig config, bool justPrint, SingleFileCompileMode mode)
+ void Compile(List<ProjectNode> nodes, CompilerConfig compiler, ProjectConfig config, int bitDepth, bool justPrint, SingleFileCompileMode mode)
{
- Build(false, nodes, compiler, config, justPrint, mode);
+ Build(false, nodes, compiler, config, bitDepth, justPrint, mode);
}
#endif
strcat(fileName, "$(E)");
break;
case sharedLibrary:
- strcat(fileName, "$(SO)");
+ strcat(fileName, "$(SO)$(VER)");
break;
case staticLibrary:
strcat(fileName, "$(A)");
}
}
- bool GenerateCrossPlatformMk()
+ bool GenerateCrossPlatformMk(File altCrossPlatformMk)
{
bool result = false;
char path[MAX_LOCATION];
if(FileExists(path))
DeleteFile(path);
{
- File include = FileOpen(":crossplatform.mk", read);
+ File include = altCrossPlatformMk ? altCrossPlatformMk : FileOpen(":crossplatform.mk", read);
if(include)
{
File f = FileOpen(path, write);
if(f)
{
+ include.Seek(0, start);
for(; !include.Eof(); )
{
char buffer[4096];
result = true;
}
- delete include;
+ if(!altCrossPlatformMk)
+ delete include;
}
}
return result;
char * name;
char * compilerName;
bool gccCompiler = compiler.ccCommand && (strstr(compiler.ccCommand, "gcc") != null || strstr(compiler.ccCommand, "g++") != null);
+ char * gnuToolchainPrefix = compiler.gnuToolchainPrefix ? compiler.gnuToolchainPrefix : "";
Platform platform = compiler.targetPlatform;
compilerName = CopyString(compiler.name);
{
f.Printf("export %s := %s\n", e.name, e.string);
}
+ f.Puts("\n");
}
f.Puts("# TOOLCHAIN\n");
f.Puts("\n");
- if(compiler.gccPrefix && compiler.gccPrefix[0])
+ if(gnuToolchainPrefix && gnuToolchainPrefix[0])
{
- f.Printf("GCC_PREFIX := %s\n", compiler.gccPrefix);
+ f.Printf("GCC_PREFIX := %s\n", gnuToolchainPrefix);
f.Puts("\n");
}
if(compiler.sysroot && compiler.sysroot[0])
f.Puts("EARFLAGS = \n");
f.Puts("\n");
+ f.Puts("ifndef ARCH\n");
+ f.Puts("TARGET_ARCH :=$(shell $(CC) -dumpmachine)\n");
+ f.Puts(" ifdef WINDOWS_HOST\n");
+ f.Puts(" ifneq ($(filter x86_64%,$(TARGET_ARCH)),)\n");
+ f.Puts(" TARGET_ARCH := x86_64\n");
+ f.Puts(" else\n");
+ f.Puts(" TARGET_ARCH := i386\n");
+ f.Puts(" endif\n");
+ f.Puts(" endif\n");
+ f.Puts("endif\n\n");
+
f.Puts("# HARD CODED TARGET_PLATFORM-SPECIFIC OPTIONS\n");
f.Printf("LDFLAGS +=$(if $(%s), -Wl$(comma)--no-undefined,)\n", PlatformToMakefileTargetVariable(tux));
f.Puts("\n");
OutputListOption(f, "Wl,", compiler.linkerFlags, inPlace, true);
f.Puts("\n");
}
- f.Printf("\nFORCE_64_BIT := %s", compiler.supportsBitDepth ? "-m64" : "");
- f.Printf("\nFORCE_32_BIT := %s", compiler.supportsBitDepth ? "-m32" : "");
f.Puts("\n");
f.Puts("\nOFLAGS += $(LDFLAGS)");
f.Puts("\n");
+ f.Puts("ifdef ARCH_FLAGS\n");
+ f.Puts("CFLAGS += $(ARCH_FLAGS)\n");
+ f.Puts("OFLAGS += $(ARCH_FLAGS)\n");
+ f.Puts("endif\n");
delete f;
Array<String> listItems { };
Map<String, int> varStringLenDiffs { };
Map<String, NameCollisionInfo> namesInfo { };
- bool forceBitDepth = false;
Map<String, int> cflagsVariations { };
Map<intptr, int> nodeCFlagsMapping { };
strcpy(objDirExpNoSpaces, GetObjDirExpression(config));
ChangeCh(objDirExpNoSpaces, '\\', '/'); // TODO: this is a hack, paths should never include win32 path seperators - fix this in ProjectSettings and ProjectLoad instead
- ReplaceSpaces(objDirExpNoSpaces, objDirExpNoSpaces);
+ {
+ char temp[MAX_LOCATION];
+ ReplaceSpaces(temp, objDirExpNoSpaces);
+ strcpy(objDirExpNoSpaces, temp);
+ }
ReplaceSpaces(resDirNoSpaces, resNode.path ? resNode.path : "");
ReplaceSpaces(fixedModuleName, moduleName);
ReplaceSpaces(fixedConfigName, GetConfigName(config));
f.Puts("# CORE VARIABLES\n\n");
f.Printf("MODULE := %s\n", fixedModuleName);
- //f.Printf("VERSION = %s\n", version);
+ f.Printf("VERSION := %s\n", property::moduleVersion);
f.Printf("CONFIG := %s\n", fixedConfigName);
f.Puts("ifndef COMPILER\n" "COMPILER := default\n" "endif\n");
f.Puts("\n");
// test = GetTargetTypeIsSetByPlatform(config);
{
char target[MAX_LOCATION];
- char targetNoSpaces[MAX_LOCATION];
+ char temp[MAX_LOCATION];
if(test)
{
TargetTypes type;
f.Printf("ifeq \"$(TARGET_TYPE)\" \"%s\"\n", TargetTypeToMakefileVariable(type));
GetMakefileTargetFileName(type, target, config);
- strcpy(targetNoSpaces, targetDir);
- PathCatSlash(targetNoSpaces, target);
- ReplaceSpaces(targetNoSpaces, targetNoSpaces);
- f.Printf("TARGET = %s\n", targetNoSpaces);
+ strcpy(temp, targetDir);
+ PathCatSlash(temp, target);
+ ReplaceSpaces(target, temp);
+ f.Printf("TARGET = %s\n", target);
}
}
f.Puts("else\n");
}
GetMakefileTargetFileName(targetType, target, config);
- strcpy(targetNoSpaces, targetDir);
- PathCatSlash(targetNoSpaces, target);
- ReplaceSpaces(targetNoSpaces, targetNoSpaces);
- f.Printf("TARGET = %s\n", targetNoSpaces);
+ strcpy(temp, targetDir);
+ PathCatSlash(temp, target);
+ ReplaceSpaces(target, temp);
+ f.Printf("TARGET = %s\n", target);
if(test)
{
f.Puts("\n");
f.Puts("\n");
- forceBitDepth = (options && options.buildBitDepth) || numCObjects;
- if(forceBitDepth || GetProfile(config))
- {
- f.Puts("OFLAGS +=");
- if(forceBitDepth)
- f.Puts((!options || !options.buildBitDepth || options.buildBitDepth == bits32) ? " $(FORCE_32_BIT)" : " $(FORCE_64_BIT)");
- if(GetProfile(config))
- f.Puts(" -pg");
- f.Puts("\n");
- f.Puts("\n");
- }
+ if(GetProfile(config))
+ f.Puts("OFLAGS += -pg\n\n");
if((config && config.options && config.options.libraryDirs) || (options && options.libraryDirs))
{
// 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 $(FORCE_32_BIT) $(ECSLIBOPT) $(SYMBOLS) $(IMPORTS) -symbols %s -o $(OBJ)$(MODULE).main.ec\n",
+ f.Printf("\t$(ECS)%s $(ARCH_FLAGS) $(ECSLIBOPT) $(SYMBOLS) $(IMPORTS) -symbols %s -o $(OBJ)$(MODULE).main.ec\n",
GetConsole(config) ? " -console" : "", objDirExpNoSpaces);
f.Puts("\n");
// Main Module (Linking) for ECERE C modules
// This alone was breaking the tarball, object directory does not get created first (order-only rules happen last it seems!)
f.Printf("$(TARGET): $(SOURCES) $(RESOURCES) $(SYMBOLS) $(OBJECTS) | objdir%s\n", sameObjTargetDirs ? "" : " targetdir");
+ f.Printf("\t@$(call rmq,$(OBJ)linkobjects.lst)\n");
+ f.Printf("\t@$(call touch,$(OBJ)linkobjects.lst)\n");
+ OutputLinkObjectActions(f, "_OBJECTS", objectsParts);
+ if(numCObjects)
+ {
+ f.Printf("\t@$(call echo,$(OBJ)$(MODULE).main$(O)) >> $(OBJ)linkobjects.lst\n");
+ OutputLinkObjectActions(f, "ECOBJECTS", eCsourcesParts);
+ }
+
f.Puts("ifndef STATIC_LIBRARY_TARGET\n");
- f.Printf("\t$(%s) $(OFLAGS) $(OBJECTS) $(LIBS) %s-o $(TARGET) $(INSTALLNAME)\n", containsCXX ? "CXX" : "CC", containsCXX ? "-lstdc++ " : "");
+
+ f.Printf("\t$(%s) $(OFLAGS) @$(OBJ)linkobjects.lst $(LIBS) %s-o $(TARGET) $(INSTALLNAME)\n", containsCXX ? "CXX" : "CC", containsCXX ? "-lstdc++ " : "");
if(!GetDebug(config))
{
f.Puts("ifndef NOSTRIP\n");
if(resNode.files && resNode.files.count && !noResources)
resNode.GenMakefileAddResources(f, resNode.path, config);
f.Puts("else\n");
- f.Puts("\t$(AR) rcs $(TARGET) $(OBJECTS) $(LIBS)\n");
+ f.Puts("\t$(AR) rcs $(TARGET) @$(OBJ)linkobjects.lst $(LIBS)\n");
+ f.Puts("endif\n");
+ f.Puts("ifdef SHARED_LIBRARY_TARGET\n");
+ f.Puts("ifdef LINUX_TARGET\n");
+ f.Puts("ifdef LINUX_HOST\n");
+ // TODO?: support symlinks for longer version numbers
+ f.Puts("\t$(if $(basename $(VER)),ln -sf $(LP)$(MODULE)$(SO)$(VER) $(OBJ)$(LP)$(MODULE)$(SO)$(basename $(VER)),)\n");
+ f.Puts("\t$(if $(VER),ln -sf $(LP)$(MODULE)$(SO)$(VER) $(OBJ)$(LP)$(MODULE)$(SO),)\n");
+ f.Puts("endif\n");
+ f.Puts("endif\n");
f.Puts("endif\n");
//f.Puts("# POST-BUILD COMMANDS\n");
f.Printf("cleantarget: objdir%s\n", sameObjTargetDirs ? "" : " targetdir");
f.Puts("\t$(call rmq,$(TARGET))\n");
+ f.Puts("ifdef SHARED_LIBRARY_TARGET\n");
+ f.Puts("ifdef LINUX_TARGET\n");
+ f.Puts("ifdef LINUX_HOST\n");
+ // TODO?: support symlinks for longer version numbers
+ f.Puts("\t$(call rmq,$(OBJ)$(LP)$(MODULE)$(SO)$(basename $(VER)))\n");
+ f.Puts("\t$(call rmq,$(OBJ)$(LP)$(MODULE)$(SO))\n");
+ f.Puts("endif\n");
+ f.Puts("endif\n");
+ f.Puts("endif\n");
f.Puts("\n");
f.Puts("clean: cleantarget\n");
+ f.Printf("\t$(call rmq,$(OBJ)linkobjects.lst)\n");
OutputCleanActions(f, "_OBJECTS", objectsParts);
if(numCObjects)
{