ecere/OS X: Tweaks to get the SDK building for OS X again
[sdk] / ide / src / project / Project.ec
index 8151db7..b0083f1 100755 (executable)
@@ -1373,21 +1373,18 @@ private:
       char * cxx = compiler.cxxCommand;
       char * cpp = compiler.cppCommand;
       char * strip = compiler.cppCommand;
-      sprintf(cppCommand, "%s%s%s%s%s ",
+      sprintf(cppCommand, "%s%s%s%s ",
             compiler.ccacheEnabled ? "ccache " : "",
-            compiler.ccacheEnabled && !compiler.distccEnabled ? " " : "",
             compiler.distccEnabled ? "distcc " : "",
             compiler.gccPrefix ? compiler.gccPrefix : "",
             compiler.cppCommand);
-      sprintf(ccCommand, "%s%s%s%s%s ",
+      sprintf(ccCommand, "%s%s%s%s ",
             compiler.ccacheEnabled ? "ccache " : "",
-            compiler.ccacheEnabled && !compiler.distccEnabled ? " " : "",
             compiler.distccEnabled ? "distcc " : "",
             compiler.gccPrefix ? compiler.gccPrefix : "",
             compiler.ccCommand);
-      sprintf(cxxCommand, "%s%s%s%s%s ",
+      sprintf(cxxCommand, "%s%s%s%s ",
             compiler.ccacheEnabled ? "ccache " : "",
-            compiler.ccacheEnabled && !compiler.distccEnabled ? " " : "",
             compiler.distccEnabled ? "distcc " : "",
             compiler.gccPrefix ? compiler.gccPrefix : "",
             compiler.cxxCommand);
@@ -2042,7 +2039,8 @@ private:
             if(compiler.sysroot && compiler.sysroot[0])
             {
                f.Printf("SYSROOT := %s\n", compiler.sysroot);
-               f.Puts("_SYSROOT := $(space)--sysroot=$(SYSROOT)\n");
+               // Moved this to crossplatform.mk
+               //f.Puts("_SYSROOT := $(space)--sysroot=$(SYSROOT)\n");
                f.Puts("\n");
             }
 
@@ -2079,7 +2077,7 @@ private:
             f.Puts("\n");
 
             f.Puts("# HARD CODED TARGET_PLATFORM-SPECIFIC OPTIONS\n");
-            f.Printf("LDFLAGS +=$(if $(%s), -Wl,--no-undefined,)\n", PlatformToMakefileTargetVariable(tux));
+            f.Printf("LDFLAGS +=$(if $(%s), -Wl$(comma)--no-undefined,)\n", PlatformToMakefileTargetVariable(tux));
             f.Puts("\n");
 
             // JF's
@@ -2128,8 +2126,12 @@ private:
             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");
 
             delete f;
+
+            result = true;
          }
       }
       delete name;
@@ -2253,10 +2255,10 @@ private:
          f.Puts("# FLAGS\n\n");
 
          f.Puts("ECFLAGS =\n");
-         f.Puts("ifndef DEBIAN_PACKAGE\n" "CFLAGS =\n" "endif\n");
+         f.Puts("ifndef DEBIAN_PACKAGE\n" "CFLAGS =\n" "LDFLAGS =\n" "endif\n");
+         f.Puts("PRJ_CFLAGS =\n");
          f.Puts("CECFLAGS =\n");
          f.Puts("OFLAGS =\n");
-         f.Puts("LDFLAGS =\n");
          f.Puts("LIBS =\n");
          f.Puts("\n");
 
@@ -2418,7 +2420,7 @@ private:
                cflagsVariations, nodeCFlagsMapping,
                ecflagsVariations, nodeECFlagsMapping, null);
 
-         GenMakePrintCustomFlags(f, "CFLAGS", false, cflagsVariations);
+         GenMakePrintCustomFlags(f, "PRJ_CFLAGS", false, cflagsVariations);
          GenMakePrintCustomFlags(f, "ECFLAGS", true, ecflagsVariations);
 
          if(platforms || (config && config.platforms))
@@ -2444,7 +2446,7 @@ private:
                   if((projectPlatformOptions && projectPlatformOptions.options.linkerOptions && projectPlatformOptions.options.linkerOptions.count) ||
                      (configPlatformOptions && configPlatformOptions.options.linkerOptions && configPlatformOptions.options.linkerOptions.count))
                   {
-                     f.Puts("CFLAGS +=");
+                     f.Puts("PRJ_CFLAGS +=");
                      // tocheck: does any of that -Wl stuff from linkerOptions have any business being in CFLAGS?
                      if(projectPlatformOptions && projectPlatformOptions.options.linkerOptions && projectPlatformOptions.options.linkerOptions.count)
                      {
@@ -2513,7 +2515,7 @@ private:
          // tocheck: does any of that -Wl stuff from linkerOptions have any business being in CFLAGS?
          if(options && options.linkerOptions && options.linkerOptions.count)
          {
-            f.Puts("CFLAGS +=");
+            f.Puts("PRJ_CFLAGS +=");
             f.Puts(" \\\n\t -Wl");
             for(s : options.linkerOptions)
                f.Printf(",%s", s);
@@ -2538,7 +2540,6 @@ private:
          if(options && options.libraryDirs)
             OutputListOption(f, "L", options.libraryDirs, lineEach, true);
          f.Puts("\n");
-         f.Puts("OFLAGS += $(LDFLAGS)\n");
          f.Puts("endif\n");
          f.Puts("\n");
 
@@ -2616,9 +2617,9 @@ private:
             f.Puts("\n");
             // Main Module (Linking) for ECERE C modules
             f.Puts("$(OBJ)$(MODULE).main.c: $(OBJ)$(MODULE).main.ec\n");
-            f.Puts("\t$(ECP) $(CECFLAGS) $(ECFLAGS) $(CFLAGS)"
+            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) $(CECFLAGS) $(ECFLAGS) $(CFLAGS) $(FVISIBILITY)"
+            f.Puts("\t$(ECC) $(CFLAGS) $(CECFLAGS) $(ECFLAGS) $(PRJ_CFLAGS) $(FVISIBILITY)"
                   " -c $(OBJ)$(MODULE).main.ec -o $(OBJ)$(MODULE).main.c -symbols $(OBJ)\n");
             f.Puts("\n");
          }
@@ -2711,32 +2712,19 @@ private:
 
          f.Puts("# SYMBOL RULES\n");
          f.Puts("\n");
-         {
-            Map<Platform, bool> excludedPlatforms { };
-            topNode.GenMakefilePrintSymbolRules(f, this, config, excludedPlatforms,
-                  nodeCFlagsMapping, nodeECFlagsMapping);
-            delete excludedPlatforms;
-         }
+
+         topNode.GenMakefilePrintSymbolRules(f, this, config, nodeCFlagsMapping, nodeECFlagsMapping);
 
          f.Puts("# C OBJECT RULES\n");
          f.Puts("\n");
-         {
-            Map<Platform, bool> excludedPlatforms { };
-            topNode.GenMakefilePrintCObjectRules(f, this, config, excludedPlatforms,
-                  nodeCFlagsMapping, nodeECFlagsMapping);
-            delete excludedPlatforms;
-         }
+
+         topNode.GenMakefilePrintCObjectRules(f, this, config, nodeCFlagsMapping, nodeECFlagsMapping);
 
          f.Puts("# OBJECT RULES\n");
          f.Puts("\n");
          // todo call this still but only generate rules whith specific options
          // see we-have-file-specific-options in ProjectNode.ec
-         {
-            Map<Platform, bool> excludedPlatforms { };
-            topNode.GenMakefilePrintObjectRules(f, this, namesInfo, config, excludedPlatforms,
-                  nodeCFlagsMapping, nodeECFlagsMapping);
-            delete excludedPlatforms;
-         }
+         topNode.GenMakefilePrintObjectRules(f, this, namesInfo, config, nodeCFlagsMapping, nodeECFlagsMapping);
 
          if(numCObjects)
             GenMakefilePrintMainObjectRule(f, config);
@@ -2762,7 +2750,6 @@ private:
 
          f.Puts("distclean:\n");
          f.Puts("\t$(call rmrq,obj/)\n");
-         f.Puts("\n");
 
          delete f;
 
@@ -2875,13 +2862,12 @@ private:
          {
 #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 $(OBJ)$(MODULE).main$(O)\n", extension);
+            f.Puts("\n");
 #if 0
          }
       }
 #endif
-
-      f.Printf("\t$(CC) $(CFLAGS) $(FVISIBILITY) -c $(OBJ)$(MODULE).main.%s -o $(OBJ)$(MODULE).main$(O)\n", extension);
-      f.Puts("\n");
    }
 
    void GenMakePrintCustomFlags(File f, String variableName, bool printNonCustom, Map<String, int> cflagsVariations)