endif
endif
-# EXTENSIONS
-OUT := $(if $(STATIC_LIBRARY_TARGET),$(A),$(if $(SHARED_LIBRARY_TARGET),$(SO)$(VER),$(if $(EXECUTABLE_TARGET),$(E),.x)))
+# PREFIXES AND EXTENSIONS
+EC := .ec
+S := .sym
+I := .imp
+B := .bowl
+C := .c
+ifndef O
+O := .o
+endif
+A := .a
+E := $(if $(WINDOWS_TARGET),.exe,)
+SO := $(if $(WINDOWS_TARGET),.dll,$(if $(OSX_TARGET),.dylib,.so))
+LP := $(if $(WINDOWS_TARGET),$(if $(STATIC_LIBRARY_TARGET),lib,),lib)
+HOST_E := $(if $(WINDOWS_HOST),.exe,)
+HOST_SO := $(if $(WINDOWS_HOST),.dll,$(if $(OSX_HOST),.dylib,.so))
+HOST_LP := $(if $(WINDOWS_HOST),$(if $(STATIC_LIBRARY_TARGET),lib,),lib)
+.SUFFIXES: .c .ec .sym .imp .bowl $(O) $(A)
# TOOLCHAIN
export CC = $(CCACHE_COMPILE)$(DISTCC_COMPILE)$(GCC_PREFIX)gcc$(_SYSROOT)$(if $(GCC_CC_FLAGS),$(space)$(GCC_CC_FLAGS),)
get { return objectFileExt && objectFileExt[0] ? objectFileExt : objectDefaultFileExt ; }
isset { return objectFileExt && objectFileExt[0] && strcmp(objectFileExt, objectDefaultFileExt); }
}
- property const char * outputFileExt
+ property const char * staticLibFileExt
+ {
+ set { delete staticLibFileExt; if(value && value[0]) staticLibFileExt = CopyString(value); }
+ get { return staticLibFileExt; }
+ isset { return staticLibFileExt && staticLibFileExt[0]; }
+ }
+ property const char * sharedLibFileExt
{
- set { delete outputFileExt; if(value && value[0]) outputFileExt = CopyString(value); }
- get { return outputFileExt; }
- isset { return outputFileExt && outputFileExt[0]; }
+ set { delete sharedLibFileExt; if(value && value[0]) sharedLibFileExt = CopyString(value); }
+ get { return sharedLibFileExt; }
+ isset { return sharedLibFileExt && sharedLibFileExt[0]; }
+ }
+ property const char * executableFileExt
+ {
+ set { delete executableFileExt; if(value && value[0]) executableFileExt = CopyString(value); }
+ get { return executableFileExt; }
+ isset { return executableFileExt && executableFileExt[0]; }
}
property const char * executableLauncher
{
isset { return sysroot && sysroot[0]; }
}
bool resourcesDotEar;
+ bool noStripTarget;
property Array<String> includeDirs
{
set
get { return executableLauncher; }
isset { return false; }
}
+ property const char * outputFileExt
+ {
+ set { delete executableFileExt; if(value && value[0]) executableFileExt = CopyString(value); }
+ get { return executableFileExt; }
+ isset { return false; }
+ }
+ // utility
+ property bool hasDocumentOutput
+ {
+ get
+ {
+ bool result = executableFileExt && executableFileExt[0] &&
+ (!strcmpi(executableFileExt, "htm") || !strcmpi(executableFileExt, "html"));
+ return result;
+ }
+ isset { return false; }
+ }
private:
Array<String> includeDirs { };
Array<String> libraryDirs { };
char * ldCommand;
char * arCommand;
char * objectFileExt;
- char * outputFileExt;
+ char * staticLibFileExt;
+ char * sharedLibFileExt;
+ char * executableFileExt;
char * executableLauncher;
char * distccHosts;
char * gnuToolchainPrefix;
delete ldCommand;
delete arCommand;
delete objectFileExt;
- delete outputFileExt;
+ delete staticLibFileExt;
+ delete sharedLibFileExt;
+ delete executableFileExt;
delete makeCommand;
delete executableLauncher;
delete distccHosts;
arCommand,
ldCommand,
objectFileExt,
- outputFileExt,
+ staticLibFileExt,
+ sharedLibFileExt,
+ executableFileExt,
executableLauncher,
ccacheEnabled,
distccEnabled,
distccHosts,
gnuToolchainPrefix,
sysroot,
- resourcesDotEar
+ resourcesDotEar,
+ noStripTarget
};
for(s : includeDirs) copy.includeDirs.Add(CopyString(s));
for(s : libraryDirs) copy.libraryDirs.Add(CopyString(s));
ccfg.arCommand = arDefaultCommand;
if(!ccfg.objectFileExt || !ccfg.objectFileExt[0])
ccfg.objectFileExt = objectDefaultFileExt;
- /*if(!ccfg.outputFileExt || !ccfg.outputFileExt[0])
- ccfg.outputFileExt = outputDefaultFileExt;*/
+ /*if(!ccfg.staticLibFileExt || !ccfg.staticLibFileExt[0])
+ ccfg.staticLibFileExt = staticLibDefaultFileExt;*/
+ /*if(!ccfg.sharedLibFileExt || !ccfg.sharedLibFileExt[0])
+ ccfg.sharedLibFileExt = sharedLibDefaultFileExt;*/
+ /*if(!ccfg.executableFileExt || !ccfg.executableFileExt[0])
+ ccfg.executableFileExt = outputDefaultFileExt;*/
if(!ccfg._refCount) incref ccfg;
}
}
cppLabel.disabled = cpp.disabled = isVC || disabled;
cxxLabel.disabled = cxx.disabled = isVC || disabled;
ccLabel.disabled = cc.disabled = isVC || disabled;
- ldLabel.disabled = cxx.disabled = isVC || disabled;
+ ldLabel.disabled = ld.disabled = isVC || disabled;
+ arLabel.disabled = ar.disabled = isVC || disabled;
makeLabel.disabled = make.disabled = disabled;
executableLauncherLabel.disabled = executableLauncher.disabled = disabled;
gnuToolchainPrefixLabel.disabled = gnuToolchainPrefix.disabled = disabled;
}
};
- Label outputFileExtLabel { this, position = { 8, 306 }, labeledWindow = outputFileExt };
- EditBox outputFileExt
+ Label staticLibFileExtLabel { this, position = { 8, 306 }, labeledWindow = staticLibFileExt };
+ EditBox staticLibFileExt
{
- this, text = $"Output file extension";//, hotKey = altH;
+ this, text = $"Output (a, so, exe) file extension";//, hotKey = altH;
position = { 168, 304 }, size = { 80, 22 };
bool NotifyModified(EditBox editBox)
CompilerConfig compiler = loadedCompiler;
if(compiler)
{
- compiler.outputFileExt = editBox.contents;
+ compiler.staticLibFileExt = editBox.contents;
+ modifiedDocument = true;
+ compilersTab.modifiedDocument = true;
+ }
+ return true;
+ }
+ };
+ EditBox sharedLibFileExt
+ {
+ this;
+ position = { 256, 304 }, size = { 80, 22 };
+
+ bool NotifyModified(EditBox editBox)
+ {
+ CompilerConfig compiler = loadedCompiler;
+ if(compiler)
+ {
+ compiler.sharedLibFileExt = editBox.contents;
+ modifiedDocument = true;
+ compilersTab.modifiedDocument = true;
+ }
+ return true;
+ }
+ };
+ EditBox executableFileExt
+ {
+ this;
+ position = { 344, 304 }, size = { 80, 22 };
+
+ bool NotifyModified(EditBox editBox)
+ {
+ CompilerConfig compiler = loadedCompiler;
+ if(compiler)
+ {
+ compiler.executableFileExt = editBox.contents;
+ modifiedDocument = true;
+ compilersTab.modifiedDocument = true;
+ }
+ return true;
+ }
+ };
+
+ Button stripTarget
+ {
+ this, text = $"Strip target", hotKey = altC, position = { 168, 332 };
+ isCheckbox = true;
+
+ bool NotifyClicked(Button button, int x, int y, Modifiers mods)
+ {
+ CompilerConfig compiler = loadedCompiler;
+ if(compiler)
+ {
+ compiler.noStripTarget = !button.checked;
modifiedDocument = true;
compilersTab.modifiedDocument = true;
}
Button resourcesDotEar
{
- this, text = $"Use resources.ear", position = { 300, 308 };
+ this, text = $"Use resources.ear", position = { 308, 332 };
isCheckbox = true;
bool NotifyClicked(Button button, int x, int y, Modifiers mods)
cxxFlags.strings = compiler.cxxFlags;
linkerFlags.strings = compiler.linkerFlags;
objectFileExt.contents = compiler.objectFileExt;
- outputFileExt.contents = compiler.outputFileExt;
+ staticLibFileExt.contents = compiler.staticLibFileExt;
+ sharedLibFileExt.contents = compiler.sharedLibFileExt;
+ executableFileExt.contents = compiler.executableFileExt;
+ stripTarget.checked = !compiler.noStripTarget;
resourcesDotEar.checked = compiler.resourcesDotEar;
labelTargetPlatform.disabled = disabled;
switch(targetType)
{
case executable:
- if(compiler.targetPlatform == win32)
+ if(compiler.executableFileExt)
+ {
+ strcat(string, ".");
+ strcat(string, compiler.executableFileExt);
+ }
+ else if(compiler.targetPlatform == win32)
strcat(string, ".exe");
break;
case sharedLibrary:
- if(compiler.targetPlatform == win32)
+ if(compiler.sharedLibFileExt)
+ {
+ strcat(string, ".");
+ strcat(string, compiler.sharedLibFileExt);
+ }
+ else if(compiler.targetPlatform == win32)
strcat(string, ".dll");
else if(compiler.targetPlatform == apple)
strcat(string, ".dylib");
}
break;
case staticLibrary:
- strcat(string, ".a");
+ if(compiler.staticLibFileExt)
+ {
+ strcat(string, ".");
+ strcat(string, compiler.staticLibFileExt);
+ }
+ else
+ strcat(string, ".a");
break;
}
}
cc.concatx((String)prefix, compiler.ccCommand, " ");
cxx.concatx((String)prefix, compiler.cxxCommand, " ");
+ ar.concatx((String)gnuToolchainPrefix, compiler.arCommand, " ");
strip.concatx(gnuToolchainPrefix, "strip ");
- ar.concatx(gnuToolchainPrefix, "ar rcs");
windres.concatx(gnuToolchainPrefix, "windres ");
testLen = Max(testLen, ecp.size);
char command[MAX_F_STRING*4];
char * compilerName = CopyString(compiler.name);
Map<String, NameCollisionInfo> cfgNameCollisions;
- const char * objFileExt = strcmp(compiler.objectFileExt, objectDefaultFileExt) != 0 ? compiler.objectFileExt : null;
delete lastBuildConfigName;
lastBuildConfigName = CopyString(config ? config.name : "Common");
// Create object dir if it does not exist already
if(!FileExists(objDirExp.dir).isDirectory)
{
- sprintf(command, "%s CF_DIR=\"%s\"%s%s%s%s%s COMPILER=%s%s%s objdir -C \"%s\"%s%s -f \"%s\"",
+ sprintf(command, "%s CF_DIR=\"%s\"%s%s%s%s%s COMPILER=%s objdir -C \"%s\"%s%s -f \"%s\"",
compiler.makeCommand, cfDir,
crossCompiling ? " TARGET_PLATFORM=" : "",
targetPlatform,
bitDepth ? " ARCH=" : "", bitDepth == 32 ? "32" : bitDepth == 64 ? "64" : "",
/*(bitDepth == 64 && compiler.targetPlatform == win32) ? " GCC_PREFIX=x86_64-w64-mingw32-" : (bitDepth == 32 && compiler.targetPlatform == win32) ? " GCC_PREFIX=i686-w64-mingw32-" : */"",
-
compilerName,
- objFileExt ? " O=." : "", objFileExt ? objFileExt : "",
topNode.path, outputMode == verbose ? " V=1" : "", outputMode == justPrint ? " -n" : "", makeFilePath);
if(outputMode != normal)
ide.outputView.buildBox.Logf("%s\n", command);
GccVersionInfo cxxVersion = GetGccVersionInfo(compiler, compiler.cxxCommand);
char cfDir[MAX_LOCATION];
GetIDECompilerConfigsDir(cfDir, true, true);
- sprintf(command, "%s%s %sCF_DIR=\"%s\"%s%s%s%s%s%s COMPILER=%s%s%s %s%s%s-j%d %s%s%s -C \"%s\"%s%s -f \"%s\"",
+ sprintf(command, "%s%s %sCF_DIR=\"%s\"%s%s%s%s%s%s COMPILER=%s%s %s%s%s-j%d %s%s%s -C \"%s\"%s%s -f \"%s\"",
#if defined(__WIN32__)
"",
#else
ide.workspace.useValgrind ? " DISABLED_POOLING=1" : "",
/*(bitDepth == 64 && compiler.targetPlatform == win32) ? " GCC_PREFIX=x86_64-w64-mingw32-" : (bitDepth == 32 && compiler.targetPlatform == win32) ? " GCC_PREFIX=i686-w64-mingw32-" :*/ "",
compilerName,
- objFileExt ? " O=." : "", objFileExt ? objFileExt : "",
+ compiler.noStripTarget ? " NOSTRIP=y" : "",
eC_Debug ? "--always-make " : "",
ccVersion == post4_8 ? "GCC_CC_FLAGS=-fno-diagnostics-show-caret " : "",
cxxVersion == post4_8 ? "GCC_CXX_FLAGS=-fno-diagnostics-show-caret " : "",
PathBackup pathBackup { };
bool crossCompiling = (compiler.targetPlatform != __runtimePlatform);
const char * targetPlatform = crossCompiling ? (char *)compiler.targetPlatform : "";
- const char * objFileExt = strcmp(compiler.objectFileExt, objectDefaultFileExt) ? compiler.objectFileExt : null;
compilerName = CopyString(compiler.name);
CamelCase(compilerName);
{
char cfDir[MAX_LOCATION];
GetIDECompilerConfigsDir(cfDir, true, true);
- sprintf(command, "%s CF_DIR=\"%s\"%s%s%s%s COMPILER=%s%s%s %sclean%s -C \"%s\"%s%s -f \"%s\"",
+ sprintf(command, "%s CF_DIR=\"%s\"%s%s%s%s COMPILER=%s %sclean%s -C \"%s\"%s%s -f \"%s\"",
compiler.makeCommand, cfDir,
crossCompiling ? " TARGET_PLATFORM=" : "", targetPlatform,
bitDepth ? " ARCH=" : "", bitDepth == 32 ? "32" : bitDepth == 64 ? "64" : "",
compilerName,
- objFileExt ? " O=." : "", objFileExt ? objFileExt : "",
cleanType == realClean ? "real" : "", cleanType == cleanTarget ? "target" : "",
topNode.path, outputMode == verbose ? " V=1" : "", outputMode == justPrint ? " -n": "", makeFilePath);
if(outputMode != normal)
delete compilerName;
}
- void Run(const char * args, CompilerConfig compiler, ProjectConfig config, int bitDepth)
+ void Run(const char * args, CompilerConfig compiler, ProjectConfig config, int bitDepth, bool shellOpen)
{
String target = new char[maxPathLen];
char oldDirectory[MAX_LOCATION];
strcpy(target, topNode.path);
PathCatSlash(target, targetDirExp.dir);
CatTargetFileName(target, compiler, config);
- sprintf(target, "%s %s", target, args);
+ if(args[0] && (executableLauncher || !shellOpen))
+ sprintf(target, "%s %s", target, args);
GetWorkingDir(oldDirectory, MAX_LOCATION);
if(ide.workspace.debugDir && strlen(ide.workspace.debugDir))
Execute(prefixedTarget);
delete prefixedTarget;
}
+ else if(shellOpen)
+ ShellOpen(target);
else
Execute(target);
f.Puts("\n");
}
+ f.Puts("# PREFIXES AND EXTENSIONS\n");
+ f.Puts("EC := .ec\n");
+ f.Puts("S := .sym\n");
+ f.Puts("I := .imp\n");
+ f.Puts("B := .bowl\n");
+ f.Puts("C := .c\n");
+ f.Printf("O := .%s\n", compiler.objectFileExt ? compiler.objectFileExt : "o");
+ f.Printf("A := .%s\n", compiler.staticLibFileExt ? compiler.staticLibFileExt : "a");
+ f.Printf("SO := .%s\n", compiler.sharedLibFileExt ? compiler.sharedLibFileExt : "$(if $(WINDOWS_TARGET),dll,$(if $(OSX_TARGET),dylib,so))");
+ f.Printf("E := %s%s\n", compiler.executableFileExt ? "." : "",
+ compiler.executableFileExt ? compiler.executableFileExt : "$(if $(WINDOWS_TARGET),.exe,)");
+ f.Puts("OUT := $(if $(STATIC_LIBRARY_TARGET),$(A),$(if $(SHARED_LIBRARY_TARGET),$(SO)$(VER),$(if $(EXECUTABLE_TARGET),$(E),.x)))\n");
+ f.Puts("LP := $(if $(WINDOWS_TARGET),$(if $(STATIC_LIBRARY_TARGET),lib,),lib)\n");
+ f.Puts("HOST_E := $(if $(WINDOWS_HOST),.exe,)\n");
+ f.Puts("HOST_SO := $(if $(WINDOWS_HOST),.dll,$(if $(OSX_HOST),.dylib,.so))\n");
+ f.Puts("HOST_LP := $(if $(WINDOWS_HOST),$(if $(STATIC_LIBRARY_TARGET),lib,),lib)\n");
+ f.Puts(".SUFFIXES: .c .ec .sym .imp .bowl $(O) $(A)\n");
+
f.Puts("# TOOLCHAIN\n");
f.Puts("\n");
f.Puts(" USE_RESOURCES_EAR := defined\n");
f.Puts("endif\n");
}
+ if(compiler.noStripTarget)
+ f.Puts("NOSTRIP := defined");
+
f.Puts("\n");
f.Puts("# EXTENSIONS\n");
CompilerConfig compiler = ideSettings.GetCompilerConfig(ide.workspace.activeCompiler);
ProjectConfig config = project.config;
int bitDepth = ide.workspace.bitDepth;
+ bool shellOpen = compiler.hasDocumentOutput;
String args = new char[maxPathLen];
args[0] = '\0';
if(ide.workspace.commandLineArgs)
//ide.debugger.GetCommandLineArgs(args);
strcpy(args, ide.workspace.commandLineArgs);
if(ide.debugger.isActive)
- project.Run(args, compiler, config, bitDepth);
+ project.Run(args, compiler, config, bitDepth, shellOpen);
/*else if(config.targetType == sharedLibrary || config.targetType == staticLibrary)
MessageBox { master = ide, type = ok, text = "Run", contents = "Shared and static libraries cannot be run like executables." }.Modal();*/
else if(BuildInterrim(project, run, compiler, config, bitDepth, normal))
- project.Run(args, compiler, config, bitDepth);
+ project.Run(args, compiler, config, bitDepth, shellOpen);
delete args;
delete compiler;
return true;
delete pathBackup;
}
+ else if(compiler.hasDocumentOutput)
+ {
+ project.Run("", compiler, config, bitDepth, true);
+ }
else
{
ide.debugger.Start(compiler, config, bitDepth, useValgrind);