build system / makefiles / ide: added support for ccache and distcc
authorRejean Loyer <rejean.loyer@gmail.com>
Tue, 16 Aug 2011 09:59:07 +0000 (05:59 -0400)
committerRejean Loyer <rejean.loyer@gmail.com>
Thu, 18 Aug 2011 08:00:05 +0000 (04:00 -0400)
31 files changed:
Makefile
compiler/bootstrap/ecc/Makefile
compiler/bootstrap/ecere/Makefile
compiler/bootstrap/ecp/Makefile
compiler/bootstrap/ecs/Makefile
compiler/bootstrap/libec/Makefile
compiler/ecc/Makefile
compiler/ecp/Makefile
compiler/ecs/Makefile
compiler/libec/Makefile
deps/freetype-2.3.5/Makefile
deps/jpeg-6b/Makefile
deps/libpng-1.4.0/Makefile
deps/libungif-4.1.1/Makefile
deps/zlib/Makefile
documentor/Makefile
ear/cmd/Makefile
ear/extract/Makefile
ecere/Makefile
ecere/Makefile.ecereCOM
ecere/Makefile.vanilla
eda/drivers/sqlite/Makefile
eda/drivers/sqliteCipher/Makefile
eda/libeda/Makefile
epj2make/Makefile
ide/Makefile
ide/src/IDESettings.ec
ide/src/dialogs/GlobalSettingsDialog.ec
ide/src/ide.ec
ide/src/project/Project.ec
include.mk

index d0b2617..cc548eb 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -1,4 +1,4 @@
-.PHONY: all clean realclean distclean emptyoutput install uninstall outputdirs bootstrap deps ecere ecerecom ecerevanilla ear compiler prepbinaries epj2make ide documentor eda prepcodeguard codeguard
+.PHONY: all clean realclean distclean emptyoutput install uninstall troubleshoot outputdirs bootstrap deps ecere ecerecom ecerevanilla ear compiler prepbinaries epj2make ide documentor eda prepcodeguard codeguard
 .SILENT:
 
 include include.mk
@@ -563,3 +563,21 @@ ifdef WINDOWS
        $(call rmdirq,"$(DESTDIR)/")
 endif
        @$(call echo,The Ecere SDK has been uninstalled.)
+
+troubleshoot:
+       @$(call echo,Printing values of some variables.)
+       @$(call echo,CCACHE=$(CCACHE))
+       @$(call echo,CCACHE_COMPILE=$(CCACHE_COMPILE))
+       @$(call echo,CCACHE_PREFIX=$(CCACHE_PREFIX))
+       @$(call echo,DISTCC=$(DISTCC))
+       @$(call echo,CC=$(CC))
+       @$(call echo,CPP=$(CPP))
+       @$(call echo,ECP=$(ECP))
+       @$(call echo,ECC=$(ECC))
+       @$(call echo,ECS=$(ECS))
+       @$(call echo,EAR=$(EAR))
+       @$(call echo,AS=$(AS))
+       @$(call echo,LD=$(LD))
+       @$(call echo,AR=$(AR))
+       @$(call echo,STRIP=$(STRIP))
+       @$(call echo,UPX=$(UPX))
index 51e3ee8..063d587 100644 (file)
@@ -23,19 +23,6 @@ SOURCES = bootstrap/ecc.c bootstrap/ecc.main.c
 
 include ../../../include.mk
 
-# TOOLCHAIN
-
-CPP := cpp
-CC := gcc
-ECP := ecp
-ECC := ecc
-ECS := ecs
-EAR := ear
-LD := gcc
-AR := ar
-STRIP := strip
-UPX := upx
-
 # FLAGS
 
 CFLAGS = -fmessage-length=0 -O2 -ffast-math -m32 $(FPIC) -w \
index 494f0a8..04259ba 100644 (file)
@@ -32,19 +32,6 @@ SOURCES = bootstrap/Array.c bootstrap/AVLTree.c bootstrap/BinaryTree.c \
 
 include ../../../include.mk
 
-# TOOLCHAIN
-
-CPP := cpp
-CC := gcc
-ECP := ecp
-ECC := ecc
-ECS := ecs
-EAR := ear
-LD := gcc
-AR := ar
-STRIP := strip
-UPX := upx
-
 # FLAGS
 
 CFLAGS = -fmessage-length=0 -O2 -ffast-math -m32 $(FPIC) -w \
index d55a908..f03e620 100644 (file)
@@ -23,19 +23,6 @@ SOURCES = bootstrap/ecp.c bootstrap/ecp.main.c
 
 include ../../../include.mk
 
-# TOOLCHAIN
-
-CPP := cpp
-CC := gcc
-ECP := ecp
-ECC := ecc
-ECS := ecs
-EAR := ear
-LD := gcc
-AR := ar
-STRIP := strip
-UPX := upx
-
 # FLAGS
 
 CFLAGS = -fmessage-length=0 -O2 -ffast-math -m32 $(FPIC) -w \
index 2ad4dc6..d5ce937 100644 (file)
@@ -23,19 +23,6 @@ SOURCES = bootstrap/ecs.c bootstrap/ecs.main.c
 
 include ../../../include.mk
 
-# TOOLCHAIN
-
-CPP := cpp
-CC := gcc
-ECP := ecp
-ECC := ecc
-ECS := ecs
-EAR := ear
-LD := gcc
-AR := ar
-STRIP := strip
-UPX := upx
-
 # FLAGS
 
 CFLAGS = -fmessage-length=0 -O2 -ffast-math -m32 $(FPIC) -w \
index d4825d2..3df26f7 100644 (file)
@@ -28,19 +28,6 @@ SOURCES = bootstrap/ast.c bootstrap/copy.c bootstrap/dbpass.c bootstrap/ec.main.
 
 include ../../../include.mk
 
-# TOOLCHAIN
-
-CPP := cpp
-CC := gcc
-ECP := ecp
-ECC := ecc
-ECS := ecs
-EAR := ear
-LD := gcc
-AR := ar
-STRIP := strip
-UPX := upx
-
 # FLAGS
 
 CFLAGS = -fmessage-length=0 -O2 -ffast-math -m32 $(FPIC) -w \
index 1240f1b..0b972e4 100644 (file)
@@ -35,16 +35,9 @@ include ../../include.mk
 
 export LD_LIBRARY_PATH = ../../obj/$(PLATFORM)/lib/
 export DYLD_LIBRARY_PATH = ../../obj/$(PLATFORM)/lib/
-CPP := cpp
-CC := gcc
 ECP := $(call psep,../bootstrap/obj/bin.$(PLATFORM)/ecp)
 ECC := $(call psep,../bootstrap/obj/bin.$(PLATFORM)/ecc)
 ECS := $(call psep,../bootstrap/obj/bin.$(PLATFORM)/ecs)
-EAR := ear
-LD := gcc
-AR := ar
-STRIP := strip
-UPX := upx
 
 # FLAGS
 
index 78be8b6..9061f8b 100644 (file)
@@ -35,16 +35,9 @@ include ../../include.mk
 
 export LD_LIBRARY_PATH = ../../obj/$(PLATFORM)/lib/
 export DYLD_LIBRARY_PATH = ../../obj/$(PLATFORM)/lib/
-CPP := cpp
-CC := gcc
 ECP := $(call psep,../bootstrap/obj/bin.$(PLATFORM)/ecp)
 ECC := $(call psep,../bootstrap/obj/bin.$(PLATFORM)/ecc)
 ECS := $(call psep,../bootstrap/obj/bin.$(PLATFORM)/ecs)
-EAR := ear
-LD := gcc
-AR := ar
-STRIP := strip
-UPX := upx
 
 # FLAGS
 
index a21e784..b7379db 100644 (file)
@@ -35,16 +35,9 @@ include ../../include.mk
 
 export LD_LIBRARY_PATH = ../../obj/$(PLATFORM)/lib/
 export DYLD_LIBRARY_PATH = ../../obj/$(PLATFORM)/lib/
-CPP := cpp
-CC := gcc
 ECP := $(call psep,../bootstrap/obj/bin.$(PLATFORM)/ecp)
 ECC := $(call psep,../bootstrap/obj/bin.$(PLATFORM)/ecc)
 ECS := $(call psep,../bootstrap/obj/bin.$(PLATFORM)/ecs)
-EAR := ear
-LD := gcc
-AR := ar
-STRIP := strip
-UPX := upx
 
 # FLAGS
 
index e260078..5f08fd6 100644 (file)
@@ -62,16 +62,9 @@ export LD_LIBRARY_PATH = ../../obj/$(PLATFORM)/lib/
 export DYLD_LIBRARY_PATH = ../../obj/$(PLATFORM)/lib/
 endif
 
-CPP := cpp
-CC := gcc
 ECP := $(call psep,../bootstrap/obj/bin.$(PLATFORM)/ecp)
 ECC := $(call psep,../bootstrap/obj/bin.$(PLATFORM)/ecc)
 ECS := $(call psep,../bootstrap/obj/bin.$(PLATFORM)/ecs)
-EAR := ear
-LD := gcc
-AR := ar
-STRIP := strip
-UPX := upx
 
 # FLAGS
 
index aaf4648..eee84ef 100644 (file)
@@ -45,15 +45,6 @@ RESOURCES =
 
 include ../../include.mk
 
-# TOOLCHAIN
-
-CPP := cpp
-CC := gcc
-LD := gcc
-AR := ar
-STRIP := strip
-UPX := upx
-
 # FLAGS
 
 # Warning: Compiling with -O2 gives 0 font height with MinGW!!
index 2ea20ac..86f1029 100644 (file)
@@ -43,15 +43,6 @@ RESOURCES =
 
 include ../../include.mk
 
-# TOOLCHAIN
-
-CPP := cpp
-CC := gcc
-LD := gcc
-AR := ar
-STRIP := strip
-UPX := upx
-
 # FLAGS
 
 CFLAGS = -fmessage-length=0 -O2 -ffast-math -m32 $(FPIC) -w
index de40b3f..1f3ac5a 100644 (file)
@@ -33,15 +33,6 @@ RESOURCES =
 
 include ../../include.mk
 
-# TOOLCHAIN
-
-CPP := cpp
-CC := gcc
-LD := gcc
-AR := ar
-STRIP := strip
-UPX := upx
-
 # FLAGS
 
 CFLAGS = -fmessage-length=0 -O2 -ffast-math -m32 $(FPIC) -w \
index c3d1ac0..a7dffaa 100644 (file)
@@ -29,15 +29,6 @@ RESOURCES =
 
 include ../../include.mk
 
-# TOOLCHAIN
-
-CPP := cpp
-CC := gcc
-LD := gcc
-AR := ar
-STRIP := strip
-UPX := upx
-
 # FLAGS
 
 CFLAGS = -fmessage-length=0 -O2 -ffast-math -m32 $(FPIC) -w
index db886d1..5d3881f 100644 (file)
@@ -32,15 +32,6 @@ RESOURCES =
 
 include ../../include.mk
 
-# TOOLCHAIN
-
-CPP := cpp
-CC := gcc
-LD := gcc
-AR := ar
-STRIP := strip
-UPX := upx
-
 # FLAGS
 
 CFLAGS = -fmessage-length=0 -O2 -ffast-math -m32 $(FPIC) -w
index 908ae94..fb3465e 100644 (file)
@@ -45,16 +45,10 @@ include ../include.mk
 # TOOLCHAIN
 export LD_LIBRARY_PATH = ../obj/$(PLATFORM)/lib/
 export DYLD_LIBRARY_PATH = ../obj/$(PLATFORM)/lib/
-CPP := cpp
-CC := gcc
 ECP := $(call psep,../obj/$(PLATFORM)/bin/ecp)
 ECC := $(call psep,../obj/$(PLATFORM)/bin/ecc)
 ECS := $(call psep,../obj/$(PLATFORM)/bin/ecs)
 EAR := $(call psep,../obj/$(PLATFORM)/bin/ear)
-LD := gcc
-AR := ar
-STRIP := strip
-UPX := upx
 
 # FLAGS
 
index 4d3afe7..f919edf 100644 (file)
@@ -34,16 +34,10 @@ include ../../include.mk
 # TOOLCHAIN
 export LD_LIBRARY_PATH = ../../obj/$(PLATFORM)/lib/
 export DYLD_LIBRARY_PATH = ../../obj/$(PLATFORM)/lib/
-CPP := cpp
-CC := gcc
 ECP := $(call psep,../../compiler/bootstrap/obj/bin.$(PLATFORM)/ecp)
 ECC := $(call psep,../../compiler/bootstrap/obj/bin.$(PLATFORM)/ecc)
 ECS := $(call psep,../../compiler/bootstrap/obj/bin.$(PLATFORM)/ecs)
 EAR := $(call psep,../../obj/$(PLATFORM)/bin/ear)
-LD := gcc
-AR := ar
-STRIP := strip
-UPX := upx
 
 # FLAGS
 
index f27e8f6..5c2b39d 100644 (file)
@@ -47,16 +47,10 @@ include ../../include.mk
 # TOOLCHAIN
 export LD_LIBRARY_PATH = ../../obj/$(PLATFORM)/lib/
 export DYLD_LIBRARY_PATH = ../../obj/$(PLATFORM)/lib/
-CPP := cpp
-CC := gcc
 ECP := $(call psep,../../compiler/bootstrap/obj/bin.$(PLATFORM)/ecp)
 ECC := $(call psep,../../compiler/bootstrap/obj/bin.$(PLATFORM)/ecc)
 ECS := $(call psep,../../compiler/bootstrap/obj/bin.$(PLATFORM)/ecs)
 EAR := $(call psep,../../obj/$(PLATFORM)/bin/ear)
-LD := gcc
-AR := ar
-STRIP := strip
-UPX := upx
 
 # FLAGS
 
index 65246c0..af6475b 100644 (file)
@@ -242,16 +242,10 @@ RESOURCES3 = $(RES)places/folder.png $(RES)places/folderRemote.png \
 # TOOLCHAIN
 export LD_LIBRARY_PATH=../obj/$(PLATFORM)/lib
 export DYLD_LIBRARY_PATH=../obj/$(PLATFORM)/lib
-CPP := cpp
-CC := gcc
 ECP := $(call psep,../compiler/bootstrap/obj/bin.$(PLATFORM)/ecp$(E))
 ECC := $(call psep,../compiler/bootstrap/obj/bin.$(PLATFORM)/ecc$(E))
 ECS := $(call psep,../compiler/bootstrap/obj/bin.$(PLATFORM)/ecs$(E))
 EAR := $(call psep,../obj/$(PLATFORM)/bin/ear)
-LD := gcc
-AR := ar
-STRIP := strip
-UPX := upx
 
 # FLAGS
 
index 57b4843..e75cae6 100644 (file)
@@ -53,16 +53,10 @@ RESOURCES =
 
 # TOOLCHAIN
 
-CPP := cpp
-CC := gcc
 ECP := $(call psep,../compiler/bootstrap/obj/bin.$(PLATFORM)/ecp$(E))
 ECC := $(call psep,../compiler/bootstrap/obj/bin.$(PLATFORM)/ecc$(E))
 ECS := $(call psep,../compiler/bootstrap/obj/bin.$(PLATFORM)/ecs$(E))
 EAR := $(call psep,../obj/$(PLATFORM)/bin/ear)
-LD := gcc
-AR := ar
-STRIP := strip
-UPX := upx
 
 # FLAGS
 
index 101098c..c67a0fb 100644 (file)
@@ -179,16 +179,10 @@ include ../include.mk
 
 # TOOLCHAIN
 
-CPP := cpp
-CC := gcc
 ECP := $(call psep,../compiler/bootstrap/obj/bin.$(PLATFORM)/ecp$(E))
 ECC := $(call psep,../compiler/bootstrap/obj/bin.$(PLATFORM)/ecc$(E))
 ECS := $(call psep,../compiler/bootstrap/obj/bin.$(PLATFORM)/ecs$(E))
 EAR := $(call psep,../obj/$(PLATFORM)/bin/ear)
-LD := gcc
-AR := ar
-STRIP := strip
-UPX := upx
 
 # FLAGS
 
index 6ed06a4..c20518b 100644 (file)
@@ -39,16 +39,10 @@ RESOURCES =
 # TOOLCHAIN
 export LD_LIBRARY_PATH = ../../../obj/$(PLATFORM)/lib/
 export DYLD_LIBRARY_PATH = ../../../obj/$(PLATFORM)/lib/
-CPP := cpp
-CC := gcc
 ECP := $(call psep,../../../obj/$(PLATFORM)/bin/ecp)
 ECC := $(call psep,../../../obj/$(PLATFORM)/bin/ecc)
 ECS := $(call psep,../../../obj/$(PLATFORM)/bin/ecs)
 EAR := $(call psep,../../../obj/$(PLATFORM)/bin/ear)
-LD := gcc
-AR := ar
-STRIP := strip
-UPX := upx
 
 # FLAGS
 
index 3c10091..e101a9a 100644 (file)
@@ -39,16 +39,10 @@ RESOURCES =
 # TOOLCHAIN
 export LD_LIBRARY_PATH = ../../../obj/$(PLATFORM)/lib/
 export DYLD_LIBRARY_PATH = ../../../obj/$(PLATFORM)/lib/
-CPP := cpp
-CC := gcc
 ECP := $(call psep,../../../obj/$(PLATFORM)/bin/ecp)
 ECC := $(call psep,../../../obj/$(PLATFORM)/bin/ecc)
 ECS := $(call psep,../../../obj/$(PLATFORM)/bin/ecs)
 EAR := $(call psep,../../../obj/$(PLATFORM)/bin/ear)
-LD := gcc
-AR := ar
-STRIP := strip
-UPX := upx
 
 # FLAGS
 
index ba090fa..7436818 100644 (file)
@@ -43,16 +43,10 @@ RESOURCES =
 # TOOLCHAIN
 export LD_LIBRARY_PATH = ../../obj/$(PLATFORM)/lib/
 export DYLD_LIBRARY_PATH = ../../obj/$(PLATFORM)/lib/
-CPP := cpp
-CC := gcc
 ECP := $(call psep,../../obj/$(PLATFORM)/bin/ecp)
 ECC := $(call psep,../../obj/$(PLATFORM)/bin/ecc)
 ECS := $(call psep,../../obj/$(PLATFORM)/bin/ecs)
 EAR := $(call psep,../../obj/$(PLATFORM)/bin/ear)
-LD := gcc
-AR := ar
-STRIP := strip
-UPX := upx
 
 # FLAGS
 
index acaee43..466e78a 100644 (file)
@@ -45,16 +45,10 @@ include ../include.mk
 # TOOLCHAIN
 export LD_LIBRARY_PATH = ../obj/$(PLATFORM)/lib/
 export DYLD_LIBRARY_PATH = ../obj/$(PLATFORM)/lib/
-CPP := cpp
-CC := gcc
 ECP := $(call psep,../obj/$(PLATFORM)/bin/ecp)
 ECC := $(call psep,../obj/$(PLATFORM)/bin/ecc)
 ECS := $(call psep,../obj/$(PLATFORM)/bin/ecs)
 EAR := $(call psep,../obj/$(PLATFORM)/bin/ear)
-LD := gcc
-AR := ar
-STRIP := strip
-UPX := upx
 
 # FLAGS
 
index f4027e6..2e272bd 100644 (file)
@@ -104,16 +104,10 @@ include ../include.mk
 # TOOLCHAIN
 export LD_LIBRARY_PATH = ../obj/$(PLATFORM)/lib/
 export DYLD_LIBRARY_PATH = ../obj/$(PLATFORM)/lib/
-CPP := cpp
-CC := gcc
 ECP := $(call psep,../obj/$(PLATFORM)/bin/ecp)
 ECC := $(call psep,../obj/$(PLATFORM)/bin/ecc)
 ECS := $(call psep,../obj/$(PLATFORM)/bin/ecs)
 EAR := $(call psep,../obj/$(PLATFORM)/bin/ear)
-LD := gcc
-AR := ar
-STRIP := strip
-UPX := upx
 
 # FLAGS
 
index bc38733..1aaf4d9 100644 (file)
@@ -703,6 +703,14 @@ public:
       get { return execPrefixCommand; }
       isset { return execPrefixCommand && execPrefixCommand[0]; }
    }
+   bool ccacheEnabled;
+   bool distccEnabled;
+   property char * distccHosts
+   {
+      set { delete distccHosts; if(value && value[0]) distccHosts = CopyString(value); }
+      get { return distccHosts; }
+      isset { return distccHosts && distccHosts[0]; }
+   }
    Array<String> includeDirs { };
    Array<String> libraryDirs { };
    Array<String> executableDirs { };
@@ -719,6 +727,7 @@ private:
    char * cppCommand;
    char * ccCommand;
    char * execPrefixCommand;
+   char * distccHosts;
    /*union
    {
       struct { Array<String> includes, libraries, executables; };
@@ -736,6 +745,7 @@ private:
       delete ccCommand;
       delete makeCommand;
       delete execPrefixCommand;
+      delete distccHosts;
       if(includeDirs) { includeDirs.Free(); delete includeDirs; }
       if(libraryDirs) { libraryDirs.Free(); delete libraryDirs; }
       if(executableDirs) { executableDirs.Free(); delete executableDirs; }
@@ -756,7 +766,10 @@ private:
          earCommand,
          cppCommand,
          ccCommand,
-         execPrefixCommand
+         execPrefixCommand,
+         ccacheEnabled,
+         distccEnabled,
+         distccHosts
       };
       for(s : includeDirs) copy.includeDirs.Add(CopyString(s));
       for(s : libraryDirs) copy.libraryDirs.Add(CopyString(s));
index aae411f..01f3931 100644 (file)
@@ -834,6 +834,62 @@ class CompilerOptionsTab : CompilersSubTab
       }
    };
 
+   Button ccacheEnabled
+   {
+      this, text = "Use ccache", hotKey = altC, position = { 8, 68 };
+      isCheckbox = true;
+
+      bool NotifyClicked(Button button, int x, int y, Modifiers mods)
+      {
+         CompilerConfig compiler = loadedCompiler;
+         if(compiler)
+         {
+            compiler.ccacheEnabled = button.checked;
+            modifiedDocument = true;
+            compilersTab.modifiedDocument = true;
+         }
+         return true;
+      }
+   };
+
+   Button distccEnabled
+   {
+      this, text = "Use distcc", hotKey = altD, position = { 8, 96 };
+      isCheckbox = true;
+
+      bool NotifyClicked(Button button, int x, int y, Modifiers mods)
+      {
+         CompilerConfig compiler = loadedCompiler;
+         if(compiler)
+         {
+            distccHosts.disabled = !button.checked;
+            compiler.distccEnabled = button.checked;
+            modifiedDocument = true;
+            compilersTab.modifiedDocument = true;
+         }
+         return true;
+      }
+   };
+
+   Label distccHostsLabel { this, position = { 8, 124 }, labeledWindow = distccHosts };
+   EditBox distccHosts
+   {
+      this, text = "distcc hosts", hotKey = altH;
+      position = { 88, 120 }, size = { 300 };
+
+      bool NotifyModified(EditBox editBox)
+      {
+         if(loadedCompiler)
+         {
+            CompilerConfig compiler = loadedCompiler;
+            compiler.distccHosts = editBox.contents;
+            modifiedDocument = true;
+            compilersTab.modifiedDocument = true;
+         }
+         return true;
+      }
+   }
+
    CompilerOptionsTab()
    {
       Platform p;
@@ -855,6 +911,10 @@ class CompilerOptionsTab : CompilersSubTab
          targetPlatform.currentRow = targetPlatform.FindRow(compiler.targetPlatform);
          numJobs = compiler.numJobs;
          numJobsBox.Refresh();
+         ccacheEnabled.checked = compiler.ccacheEnabled;
+         distccEnabled.checked = compiler.distccEnabled;
+         distccHosts.disabled = !compiler.distccEnabled;
+         distccHosts.contents = compiler.distccHosts;
          
          labelTargetPlatform.disabled = disabled;
          targetPlatform.disabled = disabled;
index 0416cce..2152cff 100644 (file)
@@ -2235,7 +2235,7 @@ class IDE : Window
             if(prj == workspace.projects.firstIterator.data) continue;
 
             targetDirExp = prj.targetDir;
-            
+
             /*if(prj.config.targetType == sharedLibrary && prj.config.debug)
                cfg = prj.config;
             else
@@ -2309,7 +2309,7 @@ class IDE : Window
          if(!found)
             newExePaths.Add(CopySystemPath(oldPaths[c]));
       }
-      
+
       len = 0;
       for(path : newExePaths)
          len += strlen(path) + 1;
@@ -2358,7 +2358,7 @@ class IDE : Window
             libPathExists[oldPaths[c]] = true;
          }
       }
-      
+
       len = 0;
       for(path : newLibPaths)
          len += strlen(path) + 1;
@@ -2383,6 +2383,10 @@ class IDE : Window
       delete newLibPaths;
       delete libPathExists;
 #endif
+
+      if(compiler.distccEnabled && compiler.distccHosts)
+         SetEnvironment("DISTCC_HOSTS", compiler.distccHosts);
+
       delete compiler;
    }
 
index 2c9e4ab..ae11e04 100644 (file)
@@ -1092,8 +1092,18 @@ private:
       char ecsCommand[MAX_LOCATION];
       char earCommand[MAX_LOCATION];
 
-      sprintf(cppCommand, "%s ", compiler.cppCommand);
-      sprintf(ccCommand, "%s ", compiler.ccCommand);
+      char * cc = compiler.ccCommand;
+      char * cpp = compiler.cppCommand;
+      sprintf(cppCommand, "%s%s%s%s ",
+            compiler.ccacheEnabled ? "ccache " : "",
+            compiler.ccacheEnabled && !compiler.distccEnabled ? " " : "",
+            compiler.distccEnabled ? "distcc " : "",
+            compiler.cppCommand);
+      sprintf(ccCommand, "%s%s%s%s ",
+            compiler.ccacheEnabled ? "ccache " : "",
+            compiler.ccacheEnabled && !compiler.distccEnabled ? " " : "",
+            compiler.distccEnabled ? "distcc " : "",
+            compiler.ccCommand);
       sprintf(ecpCommand, "%s ", compiler.ecpCommand);
       sprintf(eccCommand, "%s ", compiler.eccCommand);
       sprintf(ecsCommand, "%s ", compiler.ecsCommand);
@@ -1452,7 +1462,10 @@ private:
       }
       else
       {
-         sprintf(command, "%s -j%d %s -C \"%s\" -f \"%s\"", compiler.makeCommand, numJobs, makeTarget, topNode.path, makeFilePath);
+         sprintf(command, "%s -j%d %s%s%s -C \"%s\" -f \"%s\"", compiler.makeCommand, numJobs,
+               compiler.ccacheEnabled ? "CCACHE=y " : "",
+               compiler.distccEnabled ? "DISTCC=y " : "",
+               makeTarget, topNode.path, makeFilePath);
          if((f = DualPipeOpen(PipeOpenMode { output = true, error = true, input = true }, command)))
          {
             result = ProcessBuildPipeOutput(f, objDirExp, isARun, onlyNode);
@@ -1696,7 +1709,7 @@ private:
          f.Printf("\n");
 
          f.Printf("OBJ = %s%s\n\n", objDirExpNoSpaces, objDirExpNoSpaces[0] ? "/" : "");
-         
+
          f.Printf("RES = %s%s\n\n", resDirNoSpaces, resDirNoSpaces[0] ? "/" : "");
 
          if(targetType == executable)
@@ -1705,26 +1718,26 @@ private:
          f.Printf("TARGET = %s\n\n", targetNoSpaces);
 
          varStringLenDiffs["$(OBJ)"] = strlen(objDirNoSpaces) - 6;
-         
+
          topNode.GenMakefileGetNameCollisionInfo(namesInfo);
 
          numCObjects = topNode.GenMakefilePrintNode(f, this, objects, namesInfo, listItems);
          if(numCObjects)
             listItems.Add(CopyString("$(OBJ)$(MODULE).main$(O)"));
          objectsParts = OutputFileList(f, "OBJECTS", listItems, varStringLenDiffs);
-         
+
          topNode.GenMakefilePrintNode(f, this, cObjects, namesInfo, listItems);
          cobjectsParts = OutputFileList(f, "COBJECTS", listItems, varStringLenDiffs);
-         
+
          topNode.GenMakefilePrintNode(f, this, symbols, null, listItems);
          symbolsParts = OutputFileList(f, "SYMBOLS", listItems, varStringLenDiffs);
-         
+
          topNode.GenMakefilePrintNode(f, this, imports, null, listItems);
          importsParts = OutputFileList(f, "IMPORTS", listItems, varStringLenDiffs);
-         
+
          topNode.GenMakefilePrintNode(f, this, sources, null, listItems);
          OutputFileList(f, "SOURCES", listItems, varStringLenDiffs);
-         
+
          if(!noResources)
             resNode.GenMakefilePrintNode(f, this, resources, null, listItems);
          OutputFileList(f, "RESOURCES", listItems, varStringLenDiffs);
@@ -1750,24 +1763,38 @@ private:
             }
          }
 
-         f.Printf("# TOOLCHAIN\n\n");
-
-         //f.Printf("SHELL := %s\n", "ar"/*compiler.arCommand*/); // is this really needed?
-         f.Printf("CPP := %s\n", compiler.cppCommand);
-         f.Printf("CC := %s\n", compiler.ccCommand);
-         f.Printf("ECP := %s\n", compiler.ecpCommand);
-         f.Printf("ECC := %s\n", compiler.eccCommand);
-         f.Printf("ECS := %s%s%s\n", compiler.ecsCommand, 
-               crossCompiling ? " -t " : "", crossCompiling ? (char*)compiler.targetPlatform : "");
-         f.Printf("EAR := %s\n", compiler.earCommand);
-         f.Printf("LD := %s\n", compiler.ccCommand);
-         f.Printf("AR := %s\n", "ar"/*compiler.arCommand*/);
-         f.Printf("STRIP := %s\n", "strip"/*compiler.stripCommand*/);
-         f.Printf("UPX := %s\n", "upx"/*compiler.upxCommand*/);
          f.Printf("\n");
 
+         if(strcmpi(compiler.cppCommand, "cpp") ||
+               strcmpi(compiler.ccCommand,  "gcc") ||
+               strcmpi(compiler.ecpCommand, "ecp") ||
+               strcmpi(compiler.eccCommand, "ecc") ||
+               strcmpi(compiler.ecsCommand, "ecs") || crossCompiling ||
+               strcmpi(compiler.earCommand, "ear"))
+         {
+            f.Printf("# TOOLCHAIN\n\n");
+
+            //f.Printf("SHELL := %s\n", "ar"/*compiler.arCommand*/); // is this really needed?
+            if(strcmpi(compiler.cppCommand, "cpp"))
+               f.Printf("CPP := $(CCACHE_COMPILE) $(DISTCC_COMPILE) %s\n", compiler.cppCommand);
+            if(strcmpi(compiler.ccCommand,  "gcc"))
+               f.Printf("CC := $(CCACHE_COMPILE) $(DISTCC_COMPILE) %s\n", compiler.ccCommand);
+            if(strcmpi(compiler.ecpCommand, "ecp"))
+               f.Printf("ECP := %s\n", compiler.ecpCommand);
+            if(strcmpi(compiler.eccCommand, "ecc"))
+               f.Printf("ECC := %s\n", compiler.eccCommand);
+            if(strcmpi(compiler.ecsCommand, "ecs") || crossCompiling)
+            {
+               f.Printf("ECS := %s%s%s\n", compiler.ecsCommand,
+                     crossCompiling ? " -t " : "", crossCompiling ? (char*)compiler.targetPlatform : "");
+            }
+            if(strcmpi(compiler.earCommand, "ear"))
+               f.Printf("EAR := %s\n", compiler.earCommand);
+            f.Printf("\n");
+         }
+
          f.Printf("# FLAGS\n\n");
-         
+
          f.Printf("CFLAGS =");
          if(gccCompiler)
          {
@@ -1836,7 +1863,7 @@ private:
                f.Printf(" -defaultns %s", s);
          }
          f.Printf("\n\n");
-         
+
          if(targetType != staticLibrary)
          {
             f.Printf("OFLAGS = -m32"); // TARGET_TYPE is fixed in a Makefile, we don't want this. $(if TARGET_TYPE_STATIC_LIBRARY,,-m32)");
@@ -2139,7 +2166,7 @@ private:
          {
             int ifCount = 0;
             Platform platform;
-            
+
             //f.Printf("# PLATFORM-SPECIFIC POST-BUILD COMMANDS\n");
             for(platform = (Platform)1; platform < Platform::enumSize; platform++)
             {
index bcf1f2a..3626921 100644 (file)
@@ -73,6 +73,31 @@ else
 endif
 endif
 
+# SUPER TOOLS
+ifdef CCACHE
+   CCACHE_COMPILE := ccache
+ifdef DISTCC
+   DISTCC_COMPILE := distcc
+endif
+else
+ifdef DISTCC
+   DISTCC_COMPILE := distcc
+endif
+endif
+
+# TOOLCHAIN
+export CC      = $(CCACHE_COMPILE) $(DISTCC_COMPILE) gcc
+export CPP     = $(CCACHE_COMPILE) $(DISTCC_COMPILE) 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
+UPX := upx
+
 # SHELL COMMANDS
 ifdef WINDOWS
    echo = $(if $(1),echo $(1))