sdk;ide: Fix for compiler libraries not working
[sdk] / ide / src / project / Project.ec
index c789e32..9fdfb87 100755 (executable)
@@ -2076,7 +2076,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
@@ -2125,8 +2125,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;
@@ -2250,10 +2254,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");
 
@@ -2415,7 +2419,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))
@@ -2441,7 +2445,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)
                      {
@@ -2510,7 +2514,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);
@@ -2535,7 +2539,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");
 
@@ -2613,9 +2616,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) $(CECFLAGS) $(ECFLAGS) $(CFLAGS) $(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) $(CECFLAGS) $(ECFLAGS) $(CFLAGS) $(PRJ_CFLAGS) $(FVISIBILITY)"
                   " -c $(OBJ)$(MODULE).main.ec -o $(OBJ)$(MODULE).main.c -symbols $(OBJ)\n");
             f.Puts("\n");
          }
@@ -2759,7 +2762,6 @@ private:
 
          f.Puts("distclean:\n");
          f.Puts("\t$(call rmrq,obj/)\n");
-         f.Puts("\n");
 
          delete f;
 
@@ -2877,7 +2879,7 @@ private:
       }
 #endif
 
-      f.Printf("\t$(CC) $(CFLAGS) $(FVISIBILITY) -c $(OBJ)$(MODULE).main.%s -o $(OBJ)$(MODULE).main$(O)\n", extension);
+      f.Printf("\t$(CC) $(CFLAGS) $(PRJ_CFLAGS) $(FVISIBILITY) -c $(OBJ)$(MODULE).main.%s -o $(OBJ)$(MODULE).main$(O)\n", extension);
       f.Puts("\n");
    }