buildsystem,ide,epj2make; added GCC_PREFIX to simplify toolchain compiler changes...
authorRejean Loyer <rejean.loyer@gmail.com>
Tue, 23 Oct 2012 01:03:58 +0000 (21:03 -0400)
committerRejean Loyer <rejean.loyer@gmail.com>
Wed, 24 Oct 2012 07:28:22 +0000 (03:28 -0400)
Makefile
ide/src/IDESettings.ec
ide/src/dialogs/GlobalSettingsDialog.ec
ide/src/project/Project.ec
include.mk

index 9f50ae5..d6bf157 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -626,6 +626,7 @@ troubleshoot:
        @$(call echo,CCACHE_COMPILE=$(CCACHE_COMPILE))
        @$(call echo,CCACHE_PREFIX=$(CCACHE_PREFIX))
        @$(call echo,DISTCC=$(DISTCC))
+       @$(call echo,GCC_PREFIX=$(GCC_PREFIX))
        @$(call echo,CC=$(CC))
        @$(call echo,CPP=$(CPP))
        @$(call echo,ECP=$(ECP))
index 3d1f3ab..523a908 100644 (file)
@@ -777,6 +777,12 @@ public:
       get { return distccHosts; }
       isset { return distccHosts && distccHosts[0]; }
    }
+   property char * gccPrefix
+   {
+      set { delete gccPrefix; if(value && value[0]) gccPrefix = CopyString(value); }
+      get { return gccPrefix; }
+      isset { return gccPrefix && gccPrefix[0]; }
+   }
    property Array<String> includeDirs
    {
       set
@@ -897,6 +903,7 @@ private:
    char * execPrefixCommand;
    char * distccHosts;
    bool supportsBitDepth;
+   char * gccPrefix;
    /*union
    {
       struct { Array<String> includes, libraries, executables; };
@@ -916,6 +923,7 @@ private:
       delete makeCommand;
       delete execPrefixCommand;
       delete distccHosts;
+      delete gccPrefix;
       if(environmentVars) environmentVars.Free();
       if(includeDirs) { includeDirs.Free(); }
       if(libraryDirs) { libraryDirs.Free(); }
@@ -945,7 +953,8 @@ private:
          ccacheEnabled,
          distccEnabled,
          supportsBitDepth,
-         distccHosts
+         distccHosts,
+         gccPrefix
       };
       for(s : includeDirs) copy.includeDirs.Add(CopyString(s));
       for(s : libraryDirs) copy.libraryDirs.Add(CopyString(s));
index 6a4dbfe..625f41e 100644 (file)
@@ -16,7 +16,7 @@ class GlobalSettingsDialog : Window
    hasClose = true;
    borderStyle = sizable;
    text = $"Global Settings";
-   minClientSize = { 560, 446 };
+   minClientSize = { 560, 466 };
    nativeDecorations = true;
 
    IDESettings ideSettings;
@@ -736,6 +736,12 @@ class CompilerToolchainTab : CompilersSubTab
       this, anchor = { left = 120, top = 216, right = 8 };
       text = $"Execution Prefix", browseDialog = toolchainFileDialog, NotifyModified = NotifyModifiedDocument;
    };
+   Label gccPrefixLabel { this, position = { 8, 246 }, labeledWindow = gccPrefix, tabCycle = false, inactive = true };
+   PathBox gccPrefix
+   {
+      this, anchor = { left = 120, top = 242, right = 8 };
+      text = $"GCC Prefix", browseDialog = toolchainFileDialog, NotifyModified = NotifyModifiedDocument;
+   };
 
    bool NotifyModifiedDocument(PathBox pathBox)
    {
@@ -760,6 +766,8 @@ class CompilerToolchainTab : CompilersSubTab
             compiler.makeCommand = pathBox.slashPath;
          else if(pathBox == execPrefix)
             compiler.execPrefixCommand = pathBox.slashPath;
+         else if(pathBox == gccPrefix)
+            compiler.gccPrefix = pathBox.slashPath;
          modifiedDocument = true;
          compilersTab.modifiedDocument = true;
       }
@@ -782,6 +790,7 @@ class CompilerToolchainTab : CompilersSubTab
          cxx.path = compiler.cxxCommand;
          make.path = compiler.makeCommand;
          execPrefix.path = compiler.execPrefixCommand;
+         gccPrefix.path = compiler.gccPrefix;
 
          ecpLabel.disabled = ecp.disabled = disabled;
          eccLabel.disabled = ecc.disabled = disabled;
@@ -792,6 +801,7 @@ class CompilerToolchainTab : CompilersSubTab
          ccLabel.disabled = cc.disabled = isVC || disabled;
          makeLabel.disabled = make.disabled = disabled;
          execPrefixLabel.disabled = execPrefix.disabled = disabled;
+         gccPrefixLabel.disabled = gccPrefix.disabled = disabled;
       }
       modifiedDocument = false;
    }
index 0244db1..6dbc587 100644 (file)
@@ -1347,6 +1347,7 @@ private:
       char cppCommand[MAX_LOCATION];
       char ccCommand[MAX_LOCATION];
       char cxxCommand[MAX_LOCATION];
+      char stripCommand[MAX_LOCATION];
       char ecpCommand[MAX_LOCATION];
       char eccCommand[MAX_LOCATION];
       char ecsCommand[MAX_LOCATION];
@@ -1355,21 +1356,29 @@ private:
       char * cc = compiler.ccCommand;
       char * cxx = compiler.cxxCommand;
       char * cpp = compiler.cppCommand;
-      sprintf(cppCommand, "%s%s%s%s ",
+      char * strip = compiler.cppCommand;
+      sprintf(cppCommand, "%s%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 ",
+      sprintf(ccCommand, "%s%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 ",
+      sprintf(cxxCommand, "%s%s%s%s%s ",
             compiler.ccacheEnabled ? "ccache " : "",
             compiler.ccacheEnabled && !compiler.distccEnabled ? " " : "",
             compiler.distccEnabled ? "distcc " : "",
+            compiler.gccPrefix ? compiler.gccPrefix : "",
             compiler.cxxCommand);
+
+      sprintf(stripCommand, "%sstrip ",
+            compiler.gccPrefix ? compiler.gccPrefix : "");
+
       sprintf(ecpCommand, "%s ", compiler.ecpCommand);
       sprintf(eccCommand, "%s ", compiler.eccCommand);
       sprintf(ecsCommand, "%s ", compiler.ecsCommand);
@@ -1409,7 +1418,7 @@ private:
                   //}
                }
                else if(strstr(line, "ear ") == line);
-               else if(strstr(line, "strip ") == line);
+               else if(strstr(line, stripCommand) == line);
                else if(strstr(line, ccCommand) == line || strstr(line, cxxCommand) == line || strstr(line, ecpCommand) == line || strstr(line, eccCommand) == line)
                {
                   char moduleName[MAX_FILENAME];
@@ -2008,19 +2017,22 @@ private:
          {
             f.Printf("# TOOLCHAIN\n\n");
 
+            if(compiler.gccPrefix && compiler.gccPrefix[0])
+               f.Printf("GCC_PREFIX := %s\n", compiler.gccPrefix);
+
             //f.Printf("SHELL := %s\n", "sh"/*compiler.shellCommand*/); // is this really needed?
-            f.Printf("CPP := %s\n", compiler.cppCommand);
-            f.Printf("CC := $(CCACHE_COMPILE) $(DISTCC_COMPILE) %s\n", compiler.ccCommand);
-            f.Printf("CXX := $(CCACHE_COMPILE) $(DISTCC_COMPILE) %s\n", compiler.cxxCommand);
+            f.Printf("CPP := $(GCC_PREFIX)%s\n", compiler.cppCommand);
+            f.Printf("CC := $(CCACHE_COMPILE) $(DISTCC_COMPILE) $(GCC_PREFIX)%s\n", compiler.ccCommand);
+            f.Printf("CXX := $(CCACHE_COMPILE) $(DISTCC_COMPILE) $(GCC_PREFIX)%s\n", compiler.cxxCommand);
             f.Printf("ECP := %s\n", compiler.ecpCommand);
             f.Printf("ECC := %s\n", compiler.eccCommand);
             f.Printf("ECS := %s -t $(TARGET_PLATFORM)\n", compiler.ecsCommand);
             f.Printf("EAR := %s\n", compiler.earCommand);
 
-            f.Printf("AS := as\n");
-            f.Printf("LD := ld\n");
-            f.Printf("AR := ar\n");
-            f.Printf("STRIP := strip\n");
+            f.Printf("AS := $(GCC_PREFIX)as\n");
+            f.Printf("LD := $(GCC_PREFIX)ld\n");
+            f.Printf("AR := $(GCC_PREFIX)ar\n");
+            f.Printf("STRIP := $(GCC_PREFIX)strip\n");
             f.Printf("UPX := upx\n");
 
             f.Printf("\n");
index ef7565b..3f3bec1 100644 (file)
@@ -1,14 +1,14 @@
 # TOOLCHAIN
-export CC      = $(CCACHE_COMPILE) $(DISTCC_COMPILE) gcc
-export CPP     = $(CCACHE_COMPILE) $(DISTCC_COMPILE) cpp
+export CC      = $(CCACHE_COMPILE) $(DISTCC_COMPILE) $(GCC_PREFIX)gcc
+export CPP     = $(CCACHE_COMPILE) $(DISTCC_COMPILE) $(GCC_PREFIX)cpp
 export ECP     = ecp
 export ECC     = ecc
 export ECS     = ecs
 export EAR     = ear
-export AS      = as
-export LD      = ld
-export AR      = ar
-export STRIP   = strip
+export AS      = $(GCC_PREFIX)as
+export LD      = $(GCC_PREFIX)ld
+export AR      = $(GCC_PREFIX)ar
+export STRIP   = $(GCC_PREFIX)strip
 UPX := upx
 
 # DEBIAN