sdk/Build System: Solved the $(CPP) space issues
[sdk] / epj2make / epj2make.ec
index 75c6c2c..920d1c0 100644 (file)
@@ -203,7 +203,7 @@ class epj2makeApp : GuiApplication
             else
             {
                valid = false;
-               printf("invalid option: %s\n", arg);
+               printf($"invalid option: %s\n", arg);
             }
          }
          else
@@ -224,24 +224,24 @@ class epj2makeApp : GuiApplication
       
       if(!valid)
       {
-         printf("Syntax:\n");
-         printf("   epj2make [-t <target platform>] [-c <configuration>] [toolchain] [directories] [options] [-o <output>] <input>\n");
-         printf("      toolchain:\n");
-         printf("         [-make <make tool>]\n");
-         printf("         [-cpp <c preprocessor>]\n");
-         printf("         [-cc <c compiler>]\n");
-         printf("         [-ecp <eC preprocessor>]\n");
-         printf("         [-ecc <eC compiler>]\n");
-         printf("         [-ecs <eC symbol generator>]\n");
-         printf("         [-ear <Ecere Archiver>]\n");
-         printf("      directories:\n");
-         printf("         [-i <include dir[;inc dir[...]]>]\n");
-         printf("         [-l <library dir[;lib dir[...]]>]\n");
-         printf("      options:\n");
-         printf("         [-noglobalsettings]\n");
-         printf("         [-noresources]\n");
-         printf("         [-d <intermediate objects directory>]\n");
-         printf("         [-includemk <include.mk path>]\n");
+         printf($"Syntax:\n");
+         printf($"   epj2make [-t <target platform>] [-c <configuration>] [toolchain] [directories] [options] [-o <output>] <input>\n");
+         printf($"      toolchain:\n");
+         printf($"         [-make <make tool>]\n");
+         printf($"         [-cpp <c preprocessor>]\n");
+         printf($"         [-cc <c compiler>]\n");
+         printf($"         [-ecp <eC preprocessor>]\n");
+         printf($"         [-ecc <eC compiler>]\n");
+         printf($"         [-ecs <eC symbol generator>]\n");
+         printf($"         [-ear <Ecere Archiver>]\n");
+         printf($"      directories:\n");
+         printf($"         [-i <include dir[;inc dir[...]]>]\n");
+         printf($"         [-l <library dir[;lib dir[...]]>]\n");
+         printf($"      options:\n");
+         printf($"         [-noglobalsettings]\n");
+         printf($"         [-noresources]\n");
+         printf($"         [-d <intermediate objects directory>]\n");
+         printf($"         [-includemk <crossplatform.mk path>]\n");
       }
       else
       {
@@ -259,6 +259,8 @@ class epj2makeApp : GuiApplication
                }
                else
                {
+                  char * compiler = getenv("COMPILER");
+                  if(!compiler) compiler = "Default";
                   settingsContainer.Load();
                   //incref ideSettings;
                   delete settingsContainer;
@@ -266,7 +268,7 @@ class epj2makeApp : GuiApplication
       // TODO: Command line option to choose between the two
       // or a command line option to not use global settings 
       //defaultCompiler = MakeDefaultCompiler();
-                  defaultCompiler = ideSettings.GetCompilerConfig("Default");
+                  defaultCompiler = ideSettings.GetCompilerConfig(compiler);
       // possible TODO: use the workspace to select the active compiler
       // TODO: option to specify compiler name when using global settings
                }
@@ -292,7 +294,7 @@ class epj2makeApp : GuiApplication
                   defaultCompiler.libraryDirs.Add(dir);
                delete optionsCompiler;
 
-               project = LoadProject(epjPath);
+               project = LoadProject(epjPath, null);
                if(project)
                {
                   ProjectConfig defaultConfig = null;
@@ -309,7 +311,7 @@ class epj2makeApp : GuiApplication
                         }
                      }
                      if(!valid)
-                        printf("Error: Project configuration (%s) was not found.\n", configName);
+                        printf($"Error: Project configuration (%s) was not found.\n", configName);
                   }
                   else
                   {
@@ -325,7 +327,7 @@ class epj2makeApp : GuiApplication
                      if(!releaseConfig && project.configurations.count)
                      {
                         releaseConfig = project.configurations[0];
-                        printf("Notice: Project configuration (%s) will be used.\n", releaseConfig.name);
+                        printf($"Notice: Project configuration (%s) will be used.\n", releaseConfig.name);
                      }
 
                      if(releaseConfig)
@@ -353,7 +355,9 @@ class epj2makeApp : GuiApplication
                   }
                   if(valid)
                   {
-                     if(project.GenerateMakefile(makePath, noResources, includemkPath))
+                     project.GenerateCompilerCf(defaultCompiler);
+                     project.GenerateCrossPlatformMk();
+                     if(project.GenerateMakefile(makePath, noResources, includemkPath, project.config))
                      {
                         if(makePath)
                            printf("%s\n", makePath);
@@ -367,11 +371,11 @@ class epj2makeApp : GuiApplication
                   delete project;
                }
                else
-                  printf("Error: Unable to open project file (%s) due to unknown error.\n", epjPath);
+                  printf($"Error: Unable to open project file (%s) due to unknown error.\n", epjPath);
             }
          }
          else
-            printf("Error: Input file (%s) does not exist.\n", epjPath);
+            printf($"Error: Input file (%s) does not exist.\n", epjPath);
       }
 
       //if(optionsCompiler) // how to fix those leaks?