#define SEPS "/"
#define SEP '/'
+static Array<String> notLinkerOptions
+{ [
+ "-static-libgcc",
+ "-shared",
+ "-static",
+ "-s",
+ "-shared-libgcc",
+ "-nostartfiles",
+ "-nodefaultlibs",
+ "-nostdlib",
+ "-pie",
+ "-rdynamic",
+ "-static-libasan",
+ "-static-libtsan",
+ "-static libstdc++",
+ "-symbolic",
+ "-Wl,"
+ //"-T ",
+ //"-Xlinker ",
+ //"-u "
+] };
+
+static bool IsLinkerOption(String s)
+{
+ for(i : notLinkerOptions)
+ if(strstr(s, "-Wl,") || !strcmp(s, i))
+ return false;
+ return true;
+}
+
static byte epjSignature[] = { 'E', 'P', 'J', 0x04, 0x01, 0x12, 0x03, 0x12 };
enum GenMakefilePrintTypes { objects, cObjects, symbols, imports, sources, resources, eCsources };
char temp[MAX_LOCATION];
bool result = false;
strcpy(cfDir, topNode.path);
- if(ideSettings.compilerConfigsDir && ideSettings.compilerConfigsDir[0])
+ if(ideSettings && ideSettings.compilerConfigsDir && ideSettings.compilerConfigsDir[0])
{
PathCatSlash(cfDir, ideSettings.compilerConfigsDir);
result = true;
}
property::config = cfg.data;
+ ide.UpdateToolBarActiveConfigs(true);
ide.workspace.modified = true;
ide.projectView.Update(null);
}
if((projectPlatformOptions && projectPlatformOptions.options.linkerOptions && projectPlatformOptions.options.linkerOptions.count) ||
(configPlatformOptions && configPlatformOptions.options.linkerOptions && configPlatformOptions.options.linkerOptions.count))
{
- f.Puts("PRJ_CFLAGS +=");
- // tocheck: does any of that -Wl stuff from linkerOptions have any business being in CFLAGS?
+ f.Puts("OFLAGS +=");
if(projectPlatformOptions && projectPlatformOptions.options.linkerOptions && projectPlatformOptions.options.linkerOptions.count)
{
- f.Puts(" \\\n\t -Wl");
+ bool needWl = false;
+ f.Puts(" \\\n\t ");
for(s : projectPlatformOptions.options.linkerOptions)
- f.Printf(",%s", s);
+ {
+ if(!IsLinkerOption(s))
+ f.Printf(" %s", s);
+ else
+ needWl = true;
+ }
+ if(needWl)
+ {
+ f.Puts(" -Wl");
+ for(s : projectPlatformOptions.options.linkerOptions)
+ if(IsLinkerOption(s))
+ f.Printf(",%s", s);
+ }
}
if(configPlatformOptions && configPlatformOptions.options.linkerOptions && configPlatformOptions.options.linkerOptions.count)
{
- f.Puts(" \\\n\t -Wl");
+ bool needWl = false;
+ f.Puts(" \\\n\t ");
for(s : configPlatformOptions.options.linkerOptions)
- f.Printf(",%s", s);
+ {
+ if(IsLinkerOption(s))
+ f.Printf(" %s", s);
+ else
+ needWl = true;
+ }
+ if(needWl)
+ {
+ f.Puts(" -Wl");
+ for(s : configPlatformOptions.options.linkerOptions)
+ if(!IsLinkerOption(s))
+ f.Printf(",%s", s);
+ }
}
f.Puts("\n");
f.Puts("\n");
f.Puts("\n");
}
- // tocheck: does any of that -Wl stuff from linkerOptions have any business being in CFLAGS?
- if(options && options.linkerOptions && options.linkerOptions.count)
+ if((config && config.options && config.options.linkerOptions && config.options.linkerOptions.count) ||
+ (options && options.linkerOptions && options.linkerOptions.count))
{
- f.Puts("PRJ_CFLAGS +=");
- f.Puts(" \\\n\t -Wl");
- for(s : options.linkerOptions)
- f.Printf(",%s", s);
+ f.Puts("OFLAGS +=");
+ f.Puts(" \\\n\t");
+
+ if(config && config.options && config.options.linkerOptions && config.options.linkerOptions.count)
+ {
+ bool needWl = false;
+ for(s : config.options.linkerOptions)
+ {
+ if(!IsLinkerOption(s))
+ f.Printf(" %s", s);
+ else
+ needWl = true;
+ }
+ if(needWl)
+ {
+ f.Puts(" -Wl");
+ for(s : config.options.linkerOptions)
+ if(IsLinkerOption(s))
+ f.Printf(",%s", s);
+ }
+ }
+ if(options && options.linkerOptions && options.linkerOptions.count)
+ {
+ bool needWl = false;
+ for(s : options.linkerOptions)
+ {
+ if(!IsLinkerOption(s))
+ f.Printf(" %s", s);
+ else
+ needWl = true;
+ }
+ if(needWl)
+ {
+ f.Puts(" -Wl");
+ for(s : options.linkerOptions)
+ if(IsLinkerOption(s))
+ f.Printf(",%s", s);
+ }
+ }
}
f.Puts("\n");
f.Puts("\n");
f.Puts("\n");
f.Puts("\n");
- f.Puts("ifndef STATIC_LIBRARY_TARGET\n");
- f.Puts("OFLAGS +=");
forceBitDepth = (options && options.buildBitDepth) || numCObjects;
- if(forceBitDepth)
- f.Puts((!options || !options.buildBitDepth || options.buildBitDepth == bits32) ? " $(FORCE_32_BIT)" : " $(FORCE_64_BIT) \\\n");
-
- if(GetProfile(config))
- f.Puts(" -pg");
- if(config && config.options && config.options.libraryDirs)
- OutputListOption(f, "L", config.options.libraryDirs, lineEach, true);
- if(options && options.libraryDirs)
- OutputListOption(f, "L", options.libraryDirs, lineEach, true);
- f.Puts("\n");
- f.Puts("endif\n");
- f.Puts("\n");
+ if(forceBitDepth || GetProfile(config))
+ {
+ f.Puts("OFLAGS +=");
+ if(forceBitDepth)
+ f.Puts((!options || !options.buildBitDepth || options.buildBitDepth == bits32) ? " $(FORCE_32_BIT)" : " $(FORCE_64_BIT)");
+ if(GetProfile(config))
+ f.Puts(" -pg");
+ f.Puts("\n");
+ f.Puts("\n");
+ }
+
+ if((config && config.options && config.options.libraryDirs) || (options && options.libraryDirs))
+ {
+ f.Puts("ifndef STATIC_LIBRARY_TARGET\n");
+ f.Puts("OFLAGS +=");
+ if(config && config.options && config.options.libraryDirs)
+ OutputListOption(f, "L", config.options.libraryDirs, lineEach, true);
+ if(options && options.libraryDirs)
+ OutputListOption(f, "L", options.libraryDirs, lineEach, true);
+ f.Puts("\n");
+ f.Puts("endif\n");
+ f.Puts("\n");
+ }
f.Puts("# TARGETS\n");
f.Puts("\n");
// 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 $(ECSLIBOPT) $(SYMBOLS) $(IMPORTS) -symbols %s -o $(OBJ)$(MODULE).main.ec\n",
+ f.Printf("\t$(ECS)%s $(FORCE_32_BIT) $(ECSLIBOPT) $(SYMBOLS) $(IMPORTS) -symbols %s -o $(OBJ)$(MODULE).main.ec\n",
GetConsole(config) ? " -console" : "", objDirExpNoSpaces);
f.Puts("\n");
// Main Module (Linking) for ECERE C modules