buildsystem,epj2make,ide; (#996) fixed remaining issues with .ec modules containing...
authorRejean Loyer <redj@ecere.com>
Sun, 6 Oct 2013 03:33:28 +0000 (23:33 -0400)
committerJerome St-Louis <jerome@ecere.com>
Wed, 9 Oct 2013 06:03:19 +0000 (02:03 -0400)
crossplatform.mk
ide/src/project/Project.ec
ide/src/project/ProjectNode.ec

index b3b90c0..550b9e7 100644 (file)
@@ -171,6 +171,8 @@ ifdef WIN_PS_TOOLS
    slash_path = $(subst $(backslash),$(slash),$(1))
    sys_path = $(subst $(backslash)$(backslash),$(slash),$(subst $(slash),$(backslash),$(1)))
    quote_path = "$(call sys_path,$(call unescp_all,$(1)))"
+   each_path_quote = $(if $(findstring $(esc),$(path)),"$(call unescp_all,$(call shwspace,$(path)))",$(call unescp_all,$(path)))
+   sys_path_list = $(foreach path,$(1),$(each_path_quote))
 else
    psep := $(slash)
    slash_path = $(1)
@@ -223,7 +225,7 @@ ifdef WIN_SHELL_COMMANDS
    echo = $(if $(1),echo $(1))
    touch = $(if $(1),@cmd /c "for %%I in ($(call sys_path,$(1))) do @(cd %%~pI && type nul >> %%~nxI && copy /by %%~nxI+,, > nul 2>&1 && cd %%cd%%)")
    cpq = $(if $(1),@cmd /c "for %%I in ($(call sys_path,$(1))) do copy /by %%I $(call sys_path,$(2))" > nul 2>&1)
-   rmq = $(if $(1),-del /f /q $(call sys_path,$(1)) > nul 2>&1)
+   rmq = $(if $(1),-del /f /q $(call sys_path,$(call sys_path_list,$(1))) > nul 2>&1)
    rmrq = $(if $(1),-rmdir /q /s $(call sys_path,$(1)) > nul 2>&1)
    mkdirq = $(if $(1),-mkdir $(call sys_path,$(1)) > nul 2>&1)
    rmdirq = $(if $(1),-rmdir /q $(call sys_path,$(1)) > nul 2>&1)
index e177087..085e2fa 100644 (file)
@@ -622,10 +622,10 @@ void OutputCleanActions(File f, char * name, int parts)
    {
       int c;
       for(c=0; c<parts; c++)
-         f.Printf("\t$(call rmq,$(%s%d))\n", name, c+1);
+         f.Printf("\t$(call rmq,$(_%s%d))\n", name, c+1);
    }
    else
-      f.Printf("\t$(call rmq,$(%s))\n", name);
+      f.Printf("\t$(call rmq,$(_%s))\n", name);
 }
 
 enum LineOutputMethod { inPlace, newLine, lineEach };
@@ -1637,9 +1637,8 @@ private:
                         ide.outputView.buildBox.Logf($"Generating symbols...\n");
                         precompiling = true;
                      }
-                     // Changed escapeBackSlashes here to handle paths with spaces
-                     Tokenize(module, 1, tokens, (BackSlashEscaping)true); // fix #139
-                     GetLastDirectory(module, moduleName);
+                     Tokenize(module, 1, tokens, forArgsPassing/*(BackSlashEscaping)true*/);
+                     GetLastDirectory(tokens[0], moduleName);
                      ide.outputView.buildBox.Logf("%s\n", moduleName);
                   }
                   else if((module = strstr(line, " -o ")))
@@ -1676,7 +1675,7 @@ private:
                         while(*dashF && *dashF == ' ') dashF++;
                         module = dashF;
                      }
-                     Tokenize(module, 1, tokens, (BackSlashEscaping)true); // fix #139
+                     Tokenize(module, 1, tokens, forArgsPassing/*(BackSlashEscaping)true*/);
                      GetLastDirectory(module, moduleName);
                      ide.outputView.buildBox.Logf("%s\n", moduleName);
                   }
@@ -2815,15 +2814,32 @@ private:
                   if(eCsourcesParts > 1)
                   {
                      int n;
+                     f.Printf("_%s =", map[c][0]);
+                     for(n = 1; n <= eCsourcesParts; n++)
+                        f.Printf(" $(%s%d)", map[c][0], n);
+                     f.Puts("\n");
+                     for(n = 1; n <= eCsourcesParts; n++)
+                        f.Printf("_%s%d = $(addprefix $(OBJ),$(patsubst %%.ec,%%$(%s),$(notdir $(_ECSOURCES%d))))\n", map[c][0], n, map[c][1], n);
+                  }
+                  else if(eCsourcesParts == 1)
+                     f.Printf("_%s = $(addprefix $(OBJ),$(patsubst %%.ec,%%$(%s),$(notdir $(_ECSOURCES))))\n", map[c][0], map[c][1]);
+                  f.Puts("\n");
+               }
+
+               for(c = 0; c < 5; c++)
+               {
+                  if(eCsourcesParts > 1)
+                  {
+                     int n;
                      f.Printf("%s =", map[c][0]);
                      for(n = 1; n <= eCsourcesParts; n++)
                         f.Printf(" $(%s%d)", map[c][0], n);
                      f.Puts("\n");
                      for(n = 1; n <= eCsourcesParts; n++)
-                        f.Printf("%s%d = $(call shwspace,$(addprefix $(OBJ),$(patsubst %%.ec,%%$(%s),$(notdir $(_ECSOURCES%d)))))\n", map[c][0], n, map[c][1], n);
+                        f.Printf("%s%d = $(call shwspace,$(_%s%d))\n", map[c][0], n, map[c][0], n);
                   }
                   else if(eCsourcesParts == 1)
-                     f.Printf("%s = $(call shwspace,$(addprefix $(OBJ),$(patsubst %%.ec,%%$(%s),$(notdir $(_ECSOURCES)))))\n", map[c][0], map[c][1]);
+                     f.Printf("%s = $(call shwspace,$(_%s))\n", map[c][0], map[c][0]);
                   f.Puts("\n");
                }
             }
@@ -3204,7 +3220,7 @@ private:
             // Main Module (Linking) for ECERE C modules
             f.Puts("$(OBJ)$(MODULE).main.ec: $(SYMBOLS) $(COBJECTS)\n");
             // use of objDirExpNoSpaces used instead of $(OBJ) to prevent problematic joining of arguments in ecs
-            f.Printf("\t$(ECS)%s $(ARCH_FLAGS) $(ECSLIBOPT) $(SYMBOLS) $(IMPORTS) -symbols %s -o $(call escspace,$@)\n",
+            f.Printf("\t$(ECS)%s $(ARCH_FLAGS) $(ECSLIBOPT) $(SYMBOLS) $(IMPORTS) -symbols %s -o $(call quote_path,$@)\n",
                GetConsole(config) ? " -console" : "", objDirExpNoSpaces);
             f.Puts("\n");
             // Main Module (Linking) for ECERE C modules
@@ -3212,7 +3228,7 @@ private:
             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) $(CFLAGS) $(CECFLAGS) $(ECFLAGS) $(PRJ_CFLAGS) $(FVISIBILITY)"
-                  " -c $(OBJ)$(MODULE).main.ec -o $(call escspace,$@) -symbols $(OBJ)\n");
+                  " -c $(OBJ)$(MODULE).main.ec -o $(call quote_path,$@) -symbols $(OBJ)\n");
             f.Puts("\n");
          }
 
@@ -3434,7 +3450,7 @@ private:
 
          f.Puts("clean: cleantarget\n");
          f.Printf("\t$(call rmq,$(OBJ)linkobjects.lst)\n");
-         OutputCleanActions(f, "_OBJECTS", objectsParts);
+         OutputCleanActions(f, "OBJECTS", objectsParts);
          if(rcSourcesParts)
          {
             f.Puts("ifdef WINDOWS_TARGET\n");
@@ -3574,7 +3590,7 @@ 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 $(call escspace,$@)\n", extension);
+            f.Printf("\t$(CC) $(CFLAGS) $(PRJ_CFLAGS) $(FVISIBILITY) -c $(OBJ)$(MODULE).main.%s -o $(call quote_path,$@)\n", extension);
             f.Puts("\n");
 #if 0
          }
index fa5bff7..8d2f8e5 100644 (file)
@@ -1686,7 +1686,7 @@ private:
                   GenMakePrintNodeFlagsVariable(this, nodeECFlagsMapping, "ECFLAGS", f);
                   GenMakePrintNodeFlagsVariable(this, nodeCFlagsMapping, "PRJ_CFLAGS", f);
 
-                  f.Printf(" -c %s%s.%s -o $(call escspace,$@)\n",
+                  f.Printf(" -c $(call quote_path,%s%s.%s) -o $(call quote_path,$@)\n",
                      modulePath, moduleName, extension);
                   if(ifCount) f.Puts("endif\n");
                   f.Puts("\n");
@@ -1922,7 +1922,7 @@ private:
             GenMakePrintNodeFlagsVariable(this, nodeCFlagsMapping, "PRJ_CFLAGS", f);
             f.Puts(" $(FVISIBILITY)");
 
-            f.Printf(" -c %s%s.%s -o $(call escspace,$@) -symbols $(OBJ)\n",
+            f.Printf(" -c $(call quote_path,%s%s.%s) -o $(call quote_path,$@) -symbols $(OBJ)\n",
                modulePath, moduleName, extension);
             if(ifCount) f.Puts("endif\n");
             f.Puts("\n");
@@ -2095,7 +2095,7 @@ private:
             if(!strcmpi(extension, "cc") || !strcmpi(extension, "cpp") || !strcmpi(extension, "cxx"))
                f.Printf("\t$(CXX)");
             else if(!strcmpi(extension, "rc"))
-               f.Printf("\t$(WINDRES) $(WINDRES_FLAGS) $< $(call escspace,$@)\n");
+               f.Printf("\t$(WINDRES) $(WINDRES_FLAGS) $< \"$(call escspace,$(call quote_path,$@))\"\n");
             else
                f.Printf("\t$(CC)");
 
@@ -2105,9 +2105,9 @@ private:
                GenMakePrintNodeFlagsVariable(this, nodeCFlagsMapping, "PRJ_CFLAGS", f);
 
                if(!strcmpi(extension, "ec"))
-                  f.Printf(" $(FVISIBILITY) -c $(OBJ)%s.c -o $(call escspace,$@)\n", moduleName);
+                  f.Printf(" $(FVISIBILITY) -c $(call quote_path,$(OBJ)%s.c) -o $(call quote_path,$@)\n", moduleName);
                else
-                  f.Printf(" -c %s%s.%s -o $(call escspace,$@)\n",
+                  f.Printf(" -c $(call quote_path,%s%s.%s) -o $(call quote_path,$@)\n",
                         modulePath, moduleName, !strcmpi(extension, "ec") ? "c" : extension);
             }
             if(ifCount) f.Puts("endif\n");
@@ -2447,7 +2447,7 @@ private:
          Map<String, String> headerToSource { [ { "eh", "ec" }, { "h", "c" }, { "hh", "cc" }, { "hpp", "cpp" }, { "hxx", "cxx" } ] };
 
          GetExtension(name, extension);
-         ReplaceSpaces(moduleName, name);
+         strcpy(moduleName, name);
          StripExtension(moduleName);
          info = namesInfo[moduleName];
          collision = info ? info.IsExtensionColliding(extension) : false;