playing with em/pnacl platforms
[sdk] / ide / src / project / Project.ec
index fb1e8fc..3c4ec44 100644 (file)
@@ -680,7 +680,7 @@ CompilerConfig GetCompilerConfig()
 #ifndef MAKEFILE_GENERATOR
    CompilerConfig compiler = null;
    if(ide && ide.workspace)
-      compiler = ideSettings.GetCompilerConfig(ide.workspace.compiler);
+      compiler = ideSettings.GetCompilerConfig(ide.workspace.activeCompiler);
    return compiler;
 #else
    incref defaultCompiler;
@@ -750,10 +750,12 @@ define platformTargetType =
 
 const char * PlatformToMakefileTargetVariable(Platform platform)
 {
-   return platform == win32 ? "WINDOWS_TARGET" :
-          platform == tux   ? "LINUX_TARGET"   :
-          platform == apple ? "OSX_TARGET"     :
-                              "ERROR_BAD_TARGET";
+   return platform == win32      ? "WINDOWS_TARGET" :
+          platform == tux        ? "LINUX_TARGET" :
+          platform == apple      ? "OSX_TARGET" :
+          platform == emscripten ? "EMSCRIPTEN_TARGET" :
+          platform == pnacl      ? "PNACL_TARGET" :
+                                   "ERROR_BAD_TARGET";
 }
 
 const char * TargetTypeToMakefileVariable(TargetTypes targetType)
@@ -934,7 +936,7 @@ private:
 
                if(projectView)
                {
-                  CompilerConfig compiler = ideSettings.GetCompilerConfig(projectView.workspace.compiler);
+                  CompilerConfig compiler = ideSettings.GetCompilerConfig(projectView.workspace.activeCompiler);
                   projectView.AddNode(topNode, null);
                   topNode.row.Move(prev);
 
@@ -1208,9 +1210,6 @@ private:
    bool Save(const char * fileName)
    {
       File f;
-      /*char output[MAX_LOCATION];
-       ChangeExtension(fileName, "json", output);
-      f = FileOpen(output, write);*/
       f = FileOpen(fileName, write);
       if(f)
       {
@@ -2098,7 +2097,7 @@ private:
 
       bool eC_Debug = mode.eC_ToolsDebug;
       bool singleProjectOnlyNode = onlyNodes && onlyNodes.count == 1 && onlyNodes[0].type == project;
-      int numJobs = compiler.numJobs;
+      int numJobs = ide.toolBar.forceSingleJob.checked == true ? 1 : compiler.numJobs;
       char command[MAX_F_STRING*4];
       char * compilerName = CopyString(compiler.name);
       Map<String, NameCollisionInfo> cfgNameCollisions;
@@ -2147,8 +2146,9 @@ private:
                      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);
+                     compilerName,
+                     objFileExt ? " O=." : "", objFileExt ? objFileExt : "",
+                     topNode.path, justPrint ? " -n" : "", makeFilePath);
                if(justPrint || raw)
                   ide.outputView.buildBox.Logf("%s\n", command);
                Execute(command);
@@ -2374,7 +2374,7 @@ private:
       sprintf(target, "%s %s", target, args);
       GetWorkingDir(oldDirectory, MAX_LOCATION);
 
-      if(strlen(ide.workspace.debugDir))
+      if(ide.workspace.debugDir && strlen(ide.workspace.debugDir))
       {
          char temp[MAX_LOCATION];
          strcpy(temp, topNode.path);
@@ -2561,10 +2561,10 @@ private:
             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("  ifeq ($(ARCH),x32)\n");
             f.Puts("WINDRES_FLAGS := -F pe-i386\n");
             f.Puts("  else\n");
-            f.Puts("   ifeq \"$(ARCH)\" \"x64\"\n");
+            f.Puts("   ifeq ($(ARCH),x64)\n");
             f.Puts("WINDRES_FLAGS := -F pe-x86-64\n");
             f.Puts("   endif\n");
             f.Puts("  endif\n");
@@ -2808,7 +2808,9 @@ private:
 
          // Important: We cannot use this ifdef anymore, EXECUTABLE_TARGET is not yet defined. It's embedded in the crossplatform.mk EXECUTABLE
          //f.Puts("ifdef EXECUTABLE_TARGET\n");
+         f.Puts("ifneq ($(COMPILER),pnacl)\n");
          f.Printf("CONSOLE = %s\n", GetConsole(config) ? "-mconsole" : "-mwindows");
+         f.Puts("endif\n");
          //f.Puts("endif\n");
          f.Puts("\n");
 
@@ -2858,7 +2860,7 @@ private:
                      if(ifCount)
                         f.Puts("else\n");
                      ifCount++;
-                     f.Printf("ifeq \"$(TARGET_TYPE)\" \"%s\"\n", TargetTypeToMakefileVariable(type));
+                     f.Printf("ifeq ($(TARGET_TYPE),%s)\n", TargetTypeToMakefileVariable(type));
 
                      GetMakefileTargetFileName(type, target, config);
                      strcpy(temp, targetDir);
@@ -3383,7 +3385,7 @@ private:
                   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("ifneq ($(TARGET_ARCH),x86_64)\n");
                   f.Puts("\t$(UPX) $(UPXFLAGS) $(TARGET)\n");
                //f.Puts("endif\n");
                f.Puts("endif\n");