diff options
Diffstat (limited to 'src/main/java/net/sf/antcontrib/cpptasks')
63 files changed, 601 insertions, 374 deletions
diff --git a/src/main/java/net/sf/antcontrib/cpptasks/CompilerEnum.java b/src/main/java/net/sf/antcontrib/cpptasks/CompilerEnum.java index 28eebda..e7af352 100644 --- a/src/main/java/net/sf/antcontrib/cpptasks/CompilerEnum.java +++ b/src/main/java/net/sf/antcontrib/cpptasks/CompilerEnum.java @@ -1,5 +1,5 @@ /* - * + * * Copyright 2002-2008 The Ant-Contrib project * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -46,7 +46,7 @@ import net.sf.antcontrib.cpptasks.openwatcom.OpenWatcomFortranCompiler; import org.apache.tools.ant.types.EnumeratedAttribute; /** * Enumeration of supported compilers - * + * * <table width="100%" border="1"> <thead>Supported compilers </thead> * <tr> * <td>gcc (default)</td> @@ -57,6 +57,10 @@ import org.apache.tools.ant.types.EnumeratedAttribute; * <td>clang / llvm C compiler</td> * </tr> * <tr> + * <td>xcode.clang</td> + * <td>Xcode clang / llvm C compiler (via xcrun)</td> + * </tr> + * <tr> * <td>g++</td> * <td>GCC C++ compiler</td> * </tr> @@ -65,6 +69,10 @@ import org.apache.tools.ant.types.EnumeratedAttribute; * <td>clang++ / llvm C++ compiler</td> * </tr> * <tr> + * <td>xcode.clang++</td> + * <td>Xcode clang++ / llvm C++ compiler (via xcrun)</td> + * </tr> + * <tr> * <td>c++</td> * <td>GCC C++ compiler</td> * </tr> @@ -189,9 +197,9 @@ import org.apache.tools.ant.types.EnumeratedAttribute; * <td>GNU windres resource compiler</td> * </tr> * </table> - * + * * @author Curt Arnold, et.al. - * + * */ public class CompilerEnum extends EnumeratedAttribute { private final static ProcessorEnumValue[] compilers = new ProcessorEnumValue[]{ @@ -199,6 +207,8 @@ public class CompilerEnum extends EnumeratedAttribute { new ProcessorEnumValue("g++", GccCCompiler.getGppInstance()), new ProcessorEnumValue("clang", GccCCompiler.getCLangInstance()), new ProcessorEnumValue("clang++", GccCCompiler.getCPPLangInstance()), + new ProcessorEnumValue("xcode.clang", GccCCompiler.getXCodeCLangInstance()), + new ProcessorEnumValue("xcode.clang++", GccCCompiler.getXCodeCPPLangInstance()), new ProcessorEnumValue("c++", GccCCompiler.getCppInstance()), new ProcessorEnumValue("g77", GccCCompiler.getG77Instance()), new ProcessorEnumValue("msvc", DevStudioCCompiler.getInstance()), diff --git a/src/main/java/net/sf/antcontrib/cpptasks/LinkerEnum.java b/src/main/java/net/sf/antcontrib/cpptasks/LinkerEnum.java index 7421923..38800ae 100644 --- a/src/main/java/net/sf/antcontrib/cpptasks/LinkerEnum.java +++ b/src/main/java/net/sf/antcontrib/cpptasks/LinkerEnum.java @@ -1,5 +1,5 @@ /* - * + * * Copyright 2002-2004 The Ant-Contrib project * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -40,16 +40,18 @@ import net.sf.antcontrib.cpptasks.openwatcom.OpenWatcomFortranLinker; /** * Enumeration of supported linkers - * + * * @author Curt Arnold, et.al. - * + * */ public class LinkerEnum extends EnumeratedAttribute { private final static ProcessorEnumValue[] linkers = new ProcessorEnumValue[]{ new ProcessorEnumValue("gcc", GccLinker.getInstance()), new ProcessorEnumValue("g++", GppLinker.getInstance()), - new ProcessorEnumValue("clang", GccLinker.getCLangInstance()), - new ProcessorEnumValue("clang++", GppLinker.getCLangInstance()), + new ProcessorEnumValue("clang", GccLinker.getClangInstance()), + new ProcessorEnumValue("clang++", GppLinker.getClangInstance()), + new ProcessorEnumValue("xcode.clang", GccLinker.getXcodeClangInstance()), + new ProcessorEnumValue("xcode.clang++", GppLinker.getXcodeClangInstance()), new ProcessorEnumValue("ld", LdLinker.getInstance()), new ProcessorEnumValue("ar", GccLibrarian.getInstance()), new ProcessorEnumValue("msvc", DevStudioLinker.getInstance()), diff --git a/src/main/java/net/sf/antcontrib/cpptasks/arm/ADSCCompiler.java b/src/main/java/net/sf/antcontrib/cpptasks/arm/ADSCCompiler.java index 11004ad..455adba 100644 --- a/src/main/java/net/sf/antcontrib/cpptasks/arm/ADSCCompiler.java +++ b/src/main/java/net/sf/antcontrib/cpptasks/arm/ADSCCompiler.java @@ -109,7 +109,7 @@ public class ADSCCompiler extends CommandLineCCompiler { */ private ADSCCompiler(String command, boolean newEnvironment, Environment env) { super(command, "-vsn", sourceExtensions, headerExtensions, ".o", false, - null, newEnvironment, env); + false, null, newEnvironment, env); } /** * {@inheritDoc} diff --git a/src/main/java/net/sf/antcontrib/cpptasks/arm/ADSLibrarian.java b/src/main/java/net/sf/antcontrib/cpptasks/arm/ADSLibrarian.java index 65c430f..fa8397f 100644 --- a/src/main/java/net/sf/antcontrib/cpptasks/arm/ADSLibrarian.java +++ b/src/main/java/net/sf/antcontrib/cpptasks/arm/ADSLibrarian.java @@ -40,7 +40,7 @@ public class ADSLibrarian extends CommandLineLinker { private ADSLibrarian() { super("armar",null, - new String[] { ".o" }, new String[0], ".lib", false, null); + new String[] { ".o" }, new String[0], ".lib", false, false, null); } /* (non-Javadoc) diff --git a/src/main/java/net/sf/antcontrib/cpptasks/arm/ADSLinker.java b/src/main/java/net/sf/antcontrib/cpptasks/arm/ADSLinker.java index fda52fa..55f6682 100644 --- a/src/main/java/net/sf/antcontrib/cpptasks/arm/ADSLinker.java +++ b/src/main/java/net/sf/antcontrib/cpptasks/arm/ADSLinker.java @@ -40,7 +40,7 @@ public class ADSLinker extends CommandLineLinker { } private ADSLinker(String outputSuffix) { super("armlink", "-vsn", new String[]{".o", ".lib", ".res"}, - new String[]{".map", ".pdb", ".lnk"}, outputSuffix, false, null); + new String[]{".map", ".pdb", ".lnk"}, outputSuffix, false, false, null); } /* * (non-Javadoc) diff --git a/src/main/java/net/sf/antcontrib/cpptasks/borland/BorlandLibrarian.java b/src/main/java/net/sf/antcontrib/cpptasks/borland/BorlandLibrarian.java index 703ddd3..bdcd6f5 100644 --- a/src/main/java/net/sf/antcontrib/cpptasks/borland/BorlandLibrarian.java +++ b/src/main/java/net/sf/antcontrib/cpptasks/borland/BorlandLibrarian.java @@ -40,7 +40,7 @@ public class BorlandLibrarian extends CommandLineLinker { } private BorlandLibrarian() { super("tlib", "--version", new String[]{".obj"}, new String[0], ".lib", false, - null); + false, null); } protected void addBase(long base, Vector args) { } diff --git a/src/main/java/net/sf/antcontrib/cpptasks/borland/BorlandLinker.java b/src/main/java/net/sf/antcontrib/cpptasks/borland/BorlandLinker.java index 6a28805..8a5b13e 100644 --- a/src/main/java/net/sf/antcontrib/cpptasks/borland/BorlandLinker.java +++ b/src/main/java/net/sf/antcontrib/cpptasks/borland/BorlandLinker.java @@ -43,7 +43,7 @@ public final class BorlandLinker extends CommandLineLinker { } private BorlandLinker(String outputSuffix) { super("ilink32", "-r", new String[]{".obj", ".lib", ".res"}, - new String[]{".map", ".pdb", ".lnk"}, outputSuffix, false, null); + new String[]{".map", ".pdb", ".lnk"}, outputSuffix, false, false, null); } protected void addBase(long base, Vector args) { if (base >= 0) { diff --git a/src/main/java/net/sf/antcontrib/cpptasks/borland/BorlandResourceCompiler.java b/src/main/java/net/sf/antcontrib/cpptasks/borland/BorlandResourceCompiler.java index debfa2b..501a871 100644 --- a/src/main/java/net/sf/antcontrib/cpptasks/borland/BorlandResourceCompiler.java +++ b/src/main/java/net/sf/antcontrib/cpptasks/borland/BorlandResourceCompiler.java @@ -43,8 +43,8 @@ public class BorlandResourceCompiler extends CommandLineCompiler { } private BorlandResourceCompiler(boolean newEnvironment, Environment env) { super("brc32", "c:\\__bogus\\__bogus.rc", new String[]{".rc"}, - new String[]{".h", ".hpp", ".inl"}, ".res", false, null, - newEnvironment, env); + new String[]{".h", ".hpp", ".inl"}, ".res", false, false, + null, newEnvironment, env); } protected void addImpliedArgs(final Vector args, final boolean debug, diff --git a/src/main/java/net/sf/antcontrib/cpptasks/compaq/CompaqVisualFortranLibrarian.java b/src/main/java/net/sf/antcontrib/cpptasks/compaq/CompaqVisualFortranLibrarian.java index 2488619..84a0497 100644 --- a/src/main/java/net/sf/antcontrib/cpptasks/compaq/CompaqVisualFortranLibrarian.java +++ b/src/main/java/net/sf/antcontrib/cpptasks/compaq/CompaqVisualFortranLibrarian.java @@ -37,7 +37,7 @@ public class CompaqVisualFortranLibrarian extends CommandLineLinker { } private CompaqVisualFortranLibrarian() { super("lib", "/bogus", new String[]{".obj"}, new String[0], ".lib", - false, null); + false, false, null); } protected void addBase(long base, Vector args) { } diff --git a/src/main/java/net/sf/antcontrib/cpptasks/compiler/AbstractCompiler.java b/src/main/java/net/sf/antcontrib/cpptasks/compiler/AbstractCompiler.java index 2d1401f..c75334d 100644 --- a/src/main/java/net/sf/antcontrib/cpptasks/compiler/AbstractCompiler.java +++ b/src/main/java/net/sf/antcontrib/cpptasks/compiler/AbstractCompiler.java @@ -40,12 +40,16 @@ public abstract class AbstractCompiler extends AbstractProcessor implements Compiler { private static final String[] emptyIncludeArray = new String[0]; - private String outputSuffix; + private final String outputSuffix; protected AbstractCompiler(String[] sourceExtensions, String[] headerExtensions, String outputSuffix) { super(sourceExtensions, headerExtensions); this.outputSuffix = outputSuffix; } + protected AbstractCompiler(AbstractCompiler cc) { + super(cc); + this.outputSuffix = cc.outputSuffix; + } /** * Checks file name to see if parse should be attempted * diff --git a/src/main/java/net/sf/antcontrib/cpptasks/compiler/AbstractLinker.java b/src/main/java/net/sf/antcontrib/cpptasks/compiler/AbstractLinker.java index 5d9cefa..4e81408 100644 --- a/src/main/java/net/sf/antcontrib/cpptasks/compiler/AbstractLinker.java +++ b/src/main/java/net/sf/antcontrib/cpptasks/compiler/AbstractLinker.java @@ -1,5 +1,5 @@ /* - * + * * Copyright 2001-2004 The Ant-Contrib project * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -28,7 +28,7 @@ import net.sf.antcontrib.cpptasks.VersionInfo; import org.apache.tools.ant.types.Environment; /** * An abstract Linker implementation. - * + * * @author Adam Murdoch */ public abstract class AbstractLinker extends AbstractProcessor @@ -37,11 +37,14 @@ public abstract class AbstractLinker extends AbstractProcessor public AbstractLinker(String[] objExtensions, String[] ignoredExtensions) { super(objExtensions, ignoredExtensions); } + public AbstractLinker(AbstractLinker ld) { + super(ld); + } /** * Returns the bid of the processor for the file. - * + * * A linker will bid 1 on any unrecognized file type. - * + * * @param inputFile * filename of input file * @return bid for the file, 0 indicates no interest, 1 indicates that the @@ -86,12 +89,12 @@ public abstract class AbstractLinker extends AbstractProcessor return libfile.getName(); } public abstract String[] getOutputFileNames(String fileName, VersionInfo versionInfo); - - + + /** * Adds source or object files to the bidded fileset to * support version information. - * + * * @param versionInfo version information * @param linkType link type * @param isDebug true if debug build @@ -99,11 +102,11 @@ public abstract class AbstractLinker extends AbstractProcessor * @param objDir directory for generated files * @param matcher bidded fileset */ - public void addVersionFiles(final VersionInfo versionInfo, + public void addVersionFiles(final VersionInfo versionInfo, final LinkType linkType, final File outputFile, final boolean isDebug, - final File objDir, + final File objDir, final TargetMatcher matcher) throws IOException { if (versionInfo == null) { throw new NullPointerException("versionInfo"); @@ -118,5 +121,5 @@ public abstract class AbstractLinker extends AbstractProcessor throw new NullPointerException("objDir"); } } - + } diff --git a/src/main/java/net/sf/antcontrib/cpptasks/compiler/AbstractProcessor.java b/src/main/java/net/sf/antcontrib/cpptasks/compiler/AbstractProcessor.java index d0cd77b..464371f 100644 --- a/src/main/java/net/sf/antcontrib/cpptasks/compiler/AbstractProcessor.java +++ b/src/main/java/net/sf/antcontrib/cpptasks/compiler/AbstractProcessor.java @@ -1,5 +1,5 @@ /* - * + * * Copyright 2002-2004 The Ant-Contrib project * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -18,7 +18,7 @@ package net.sf.antcontrib.cpptasks.compiler; import org.apache.tools.ant.types.Environment; /** * An abstract processor (compiler/linker) implementation. - * + * * @author Curt Arnold */ public abstract class AbstractProcessor implements Processor, Cloneable { @@ -34,7 +34,7 @@ public abstract class AbstractProcessor implements Processor, Cloneable { /** * Determines the identification of a command line processor by capture the * first line of its output for a specific command. - * + * * @param command * array of command line arguments starting with executable * name. For example, { "cl" } @@ -59,12 +59,16 @@ public abstract class AbstractProcessor implements Processor, Cloneable { private final String[] sourceExtensions; protected AbstractProcessor(String[] sourceExtensions, String[] headerExtensions) { - this.sourceExtensions = (String[]) sourceExtensions.clone(); - this.headerExtensions = (String[]) headerExtensions.clone(); + this.sourceExtensions = sourceExtensions.clone(); + this.headerExtensions = headerExtensions.clone(); + } + protected AbstractProcessor(AbstractProcessor ap) { + this.sourceExtensions = ap.sourceExtensions.clone(); + this.headerExtensions = ap.headerExtensions.clone(); } /** * Returns the bid of the processor for the file. - * + * * @param inputFile * filename of input file * @return bid for the file, 0 indicates no interest, 1 indicates that the @@ -92,12 +96,12 @@ public abstract class AbstractProcessor implements Processor, Cloneable { return super.clone(); } public String[] getHeaderExtensions() { - return (String[]) this.headerExtensions.clone(); + return this.headerExtensions.clone(); } abstract public String getIdentifier(); /** * Gets the target operating system architecture - * + * * @return String target operating system architecture */ protected String getOSArch() { @@ -105,18 +109,18 @@ public abstract class AbstractProcessor implements Processor, Cloneable { } /** * Gets the target operating system name - * + * * @return String target operating system name */ protected String getOSName() { return System.getProperty("os.name"); } public String[] getSourceExtensions() { - return (String[]) this.sourceExtensions.clone(); + return this.sourceExtensions.clone(); } /** * Returns true if the target operating system is Mac OS X or Darwin. - * + * * @return boolean */ protected boolean isDarwin() { diff --git a/src/main/java/net/sf/antcontrib/cpptasks/compiler/CommandLineCCompiler.java b/src/main/java/net/sf/antcontrib/cpptasks/compiler/CommandLineCCompiler.java index adafa08..e380fa4 100644 --- a/src/main/java/net/sf/antcontrib/cpptasks/compiler/CommandLineCCompiler.java +++ b/src/main/java/net/sf/antcontrib/cpptasks/compiler/CommandLineCCompiler.java @@ -1,5 +1,5 @@ /* - * + * * Copyright 2002-2004 The Ant-Contrib project * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -24,17 +24,20 @@ import org.apache.tools.ant.types.Environment; /** * An abstract Compiler implementation which uses an external program to * perform the compile. - * + * * @author Adam Murdoch */ public abstract class CommandLineCCompiler extends CommandLineCompiler { protected CommandLineCCompiler(String command, String identifierArg, String[] sourceExtensions, String[] headerExtensions, - String outputSuffix, boolean libtool, - CommandLineCCompiler libtoolCompiler, boolean newEnvironment, - Environment env) { + String outputSuffix, boolean isXcoderun, + boolean libtool, CommandLineCCompiler libtoolCompiler, + boolean newEnvironment, Environment env) { super(command, identifierArg, sourceExtensions, headerExtensions, - outputSuffix, libtool, libtoolCompiler, newEnvironment, env); + outputSuffix, isXcoderun, libtool, libtoolCompiler, newEnvironment, env); + } + protected CommandLineCCompiler(CommandLineCCompiler cc, boolean isXcoderun) { + super(cc, isXcoderun); } protected Parser createParser(File source) { return new CParser(); diff --git a/src/main/java/net/sf/antcontrib/cpptasks/compiler/CommandLineCompiler.java b/src/main/java/net/sf/antcontrib/cpptasks/compiler/CommandLineCompiler.java index 46ec59a..3188f57 100644 --- a/src/main/java/net/sf/antcontrib/cpptasks/compiler/CommandLineCompiler.java +++ b/src/main/java/net/sf/antcontrib/cpptasks/compiler/CommandLineCompiler.java @@ -1,5 +1,5 @@ /* - * + * * Copyright 2002-2004 The Ant-Contrib project * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -35,44 +35,58 @@ import net.sf.antcontrib.cpptasks.OptimizationEnum;; /** * An abstract Compiler implementation which uses an external program to * perform the compile. - * + * * @author Adam Murdoch */ public abstract class CommandLineCompiler extends AbstractCompiler { private String command; private final Environment env; private String identifier; - private String identifierArg; - private boolean libtool; - private CommandLineCompiler libtoolCompiler; + private final String identifierArg; + private final boolean isLibtool, isXcoderun; + private final CommandLineCompiler libtoolCompiler; private final boolean newEnvironment; + protected CommandLineCompiler(String command, String identifierArg, String[] sourceExtensions, String[] headerExtensions, - String outputSuffix, boolean libtool, - CommandLineCompiler libtoolCompiler, boolean newEnvironment, - Environment env) { + String outputSuffix, boolean isXcoderun, + boolean libtool, CommandLineCompiler libtoolCompiler, + boolean newEnvironment, Environment env) { super(sourceExtensions, headerExtensions, outputSuffix); this.command = command; if (libtool && libtoolCompiler != null) { throw new java.lang.IllegalArgumentException( "libtoolCompiler should be null when libtool is true"); } - this.libtool = libtool; + this.isLibtool = libtool; + this.isXcoderun = isXcoderun; this.libtoolCompiler = libtoolCompiler; this.identifierArg = identifierArg; this.newEnvironment = newEnvironment; this.env = env; } + protected CommandLineCompiler(CommandLineCompiler cc, boolean isXcoderun) { + super(cc); + this.command = cc.command; + this.isLibtool = cc.isLibtool; + this.isXcoderun = isXcoderun; + this.libtoolCompiler = cc.libtoolCompiler; + this.identifierArg = cc.identifierArg; + this.newEnvironment = cc.newEnvironment; + this.env = cc.env; + } + abstract protected void addImpliedArgs(Vector args, boolean debug, boolean multithreaded, boolean exceptions, LinkType linkType, Boolean rtti, OptimizationEnum optimization); + /** * Adds command-line arguments for include directories. - * + * * If relativeArgs is not null will add corresponding relative paths * include switches to that vector (for use in building a configuration * identifier that is consistent between machines). - * + * * @param baseDirPath Base directory path. * @param includeDirs * Array of include directory paths @@ -128,7 +142,7 @@ public abstract class CommandLineCompiler extends AbstractCompiler { } /** * Compiles a source file. - * + * */ public void compile(CCTask task, File outputDir, String[] sourceFiles, String[] args, String[] endArgs, boolean relentless, @@ -140,8 +154,11 @@ public abstract class CommandLineCompiler extends AbstractCompiler { // String command = getCommand(); int baseLength = command.length() + args.length + endArgs.length; - if (libtool) { - baseLength += 8; + if (isLibtool) { + baseLength += 8; // 'libtool ' + } + if(isXcoderun) { + baseLength += 6; // 'xcrun ' } for (int i = 0; i < args.length; i++) { baseLength += args[i].length(); @@ -175,14 +192,20 @@ public abstract class CommandLineCompiler extends AbstractCompiler { int argCount = args.length + 1 + endArgs.length + (firstFileNextExec - sourceIndex) * argumentCountPerInputFile; - if (libtool) { + if (isLibtool) { + argCount++; + } + if(isXcoderun) { argCount++; } String[] commandline = new String[argCount]; int index = 0; - if (libtool) { + if (isLibtool) { commandline[index++] = "libtool"; } + if(isXcoderun) { + commandline[index++] = "xcrun"; + } commandline[index++] = command; for (int j = 0; j < args.length; j++) { commandline[index++] = args[j]; @@ -232,8 +255,8 @@ public abstract class CommandLineCompiler extends AbstractCompiler { } } protected CompilerConfiguration createConfiguration(final CCTask task, - final LinkType linkType, - final ProcessorDef[] baseDefs, + final LinkType linkType, + final ProcessorDef[] baseDefs, final CompilerDef specificDef, final TargetDef targetPlatform, final VersionInfo versionInfo) { @@ -400,12 +423,20 @@ public abstract class CommandLineCompiler extends AbstractCompiler { } return filename; } + + protected final boolean getNewEnvironment() { return newEnvironment; } + + protected final Environment getEnv() { return env; } + protected final boolean getLibtool() { - return libtool; + return isLibtool; + } + protected final boolean getXcodeRun() { + return isXcoderun; } /** * Obtains the same compiler, but with libtool set - * + * * Default behavior is to ignore libtool */ public final CommandLineCompiler getLibtoolCompiler() { diff --git a/src/main/java/net/sf/antcontrib/cpptasks/compiler/CommandLineFortranCompiler.java b/src/main/java/net/sf/antcontrib/cpptasks/compiler/CommandLineFortranCompiler.java index 7b0eed2..f692823 100644 --- a/src/main/java/net/sf/antcontrib/cpptasks/compiler/CommandLineFortranCompiler.java +++ b/src/main/java/net/sf/antcontrib/cpptasks/compiler/CommandLineFortranCompiler.java @@ -34,7 +34,7 @@ public abstract class CommandLineFortranCompiler extends CommandLineCompiler { CommandLineFortranCompiler libtoolCompiler, boolean newEnvironment, Environment env) { super(command, identifierArg, sourceExtensions, headerExtensions, - outputSuffix, libtool, libtoolCompiler, newEnvironment, env); + outputSuffix, false, libtool, libtoolCompiler, newEnvironment, env); } protected Parser createParser(File source) { return new FortranParser(); diff --git a/src/main/java/net/sf/antcontrib/cpptasks/compiler/CommandLineLinker.java b/src/main/java/net/sf/antcontrib/cpptasks/compiler/CommandLineLinker.java index 86594fa..f2eee51 100644 --- a/src/main/java/net/sf/antcontrib/cpptasks/compiler/CommandLineLinker.java +++ b/src/main/java/net/sf/antcontrib/cpptasks/compiler/CommandLineLinker.java @@ -1,5 +1,5 @@ /* - * + * * Copyright 2002-2004 The Ant-Contrib project * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -45,30 +45,41 @@ import org.apache.tools.ant.types.Environment; public abstract class CommandLineLinker extends AbstractLinker { private String command; - private Environment env = null; + private final Environment env = null; private String identifier; - private String identifierArg; - private boolean isLibtool; + private final String identifierArg; + private final boolean isLibtool, isXcoderun; private String[] librarySets; - private CommandLineLinker libtoolLinker; - private boolean newEnvironment = false; - private String outputSuffix; + private final CommandLineLinker libtoolLinker; + private final boolean newEnvironment = false; + private final String outputSuffix; - /** Creates a comand line linker invocation */ + /** Creates a comand line linker invocation + * @param isXCoderun TODO*/ public CommandLineLinker(String command, String identifierArg, String[] extensions, String[] ignoredExtensions, String outputSuffix, - boolean isLibtool, CommandLineLinker libtoolLinker) + boolean isXCoderun, boolean isLibtool, CommandLineLinker libtoolLinker) { super(extensions, ignoredExtensions); this.command = command; this.identifierArg = identifierArg; this.outputSuffix = outputSuffix; this.isLibtool = isLibtool; + this.isXcoderun = isXCoderun; this.libtoolLinker = libtoolLinker; } + public CommandLineLinker(CommandLineLinker ld, boolean isXCoderun) { + super(ld); + this.command = ld.command; + this.identifierArg = ld.identifierArg; + this.outputSuffix = ld.outputSuffix; + this.isLibtool = ld.isLibtool; + this.isXcoderun = isXCoderun; + this.libtoolLinker = ld.libtoolLinker; + } protected abstract void addBase(long base, Vector args); protected abstract void addFixed(Boolean fixed, Vector args); @@ -87,7 +98,7 @@ public abstract class CommandLineLinker extends AbstractLinker protected abstract void addMap(boolean map, Vector args); protected abstract void addStack(int stack, Vector args); protected abstract void addEntry(String entry, Vector args); - + protected LinkerConfiguration createConfiguration( CCTask task, LinkType linkType, @@ -229,6 +240,12 @@ public abstract class CommandLineLinker extends AbstractLinker return null; } + protected final boolean getLibtool() { + return isLibtool; + } + protected final boolean getXcodeRun() { + return isXcoderun; + } /** * Performs a link using a command line linker * @@ -265,8 +282,8 @@ public abstract class CommandLineLinker extends AbstractLinker throw new BuildException(ex); } } - - int retval = runCommand(task,parentDir,execArgs); + + int retval = runCommand(task,parentDir,execArgs); // // if the process returned a failure code then // throw an BuildException @@ -277,7 +294,7 @@ public abstract class CommandLineLinker extends AbstractLinker // throw new BuildException(this.getCommand() + " failed with return code " + retval, task.getLocation()); } - + } @@ -297,7 +314,7 @@ public abstract class CommandLineLinker extends AbstractLinker String outputFile, String[] sourceFiles, CommandLineLinkerConfiguration config) { - + String[] preargs = config.getPreArguments(); String[] endargs = config.getEndArguments(); String outputSwitch[] = getOutputFileSwitch(task, outputFile); @@ -306,11 +323,17 @@ public abstract class CommandLineLinker extends AbstractLinker if (isLibtool) { allArgsCount++; } + if(isXcoderun) { + allArgsCount++; + } String[] allArgs = new String[allArgsCount]; int index = 0; if (isLibtool) { allArgs[index++] = "libtool"; } + if(isXcoderun) { + allArgs[index++] = "xcrun"; + } allArgs[index++] = this.getCommand(); StringBuffer buf = new StringBuffer(); for (int i = 0; i < preargs.length; i++) { @@ -356,6 +379,9 @@ public abstract class CommandLineLinker extends AbstractLinker if (isLibtool) { execArgCount++; } + if(isXcoderun) { + execArgCount++; + } String[] execArgs = new String[execArgCount+1]; for (int i = 0; i < execArgCount; i++) { execArgs[i] = args[i]; diff --git a/src/main/java/net/sf/antcontrib/cpptasks/compiler/PrecompilingCommandLineCompiler.java b/src/main/java/net/sf/antcontrib/cpptasks/compiler/PrecompilingCommandLineCompiler.java index 3b66597..23bfa47 100644 --- a/src/main/java/net/sf/antcontrib/cpptasks/compiler/PrecompilingCommandLineCompiler.java +++ b/src/main/java/net/sf/antcontrib/cpptasks/compiler/PrecompilingCommandLineCompiler.java @@ -39,7 +39,7 @@ public abstract class PrecompilingCommandLineCompiler PrecompilingCommandLineCompiler libtoolCompiler, boolean newEnvironment, Environment env) { super(command, identifierArg, sourceExtensions, headerExtensions, - outputSuffix, libtool, libtoolCompiler, newEnvironment, env); + outputSuffix, false, libtool, libtoolCompiler, newEnvironment, env); } /** * diff --git a/src/main/java/net/sf/antcontrib/cpptasks/devstudio/DevStudioCompatibleLibrarian.java b/src/main/java/net/sf/antcontrib/cpptasks/devstudio/DevStudioCompatibleLibrarian.java index 985dfcf..343ebcf 100644 --- a/src/main/java/net/sf/antcontrib/cpptasks/devstudio/DevStudioCompatibleLibrarian.java +++ b/src/main/java/net/sf/antcontrib/cpptasks/devstudio/DevStudioCompatibleLibrarian.java @@ -30,7 +30,7 @@ import net.sf.antcontrib.cpptasks.types.LibraryTypeEnum; public abstract class DevStudioCompatibleLibrarian extends CommandLineLinker { public DevStudioCompatibleLibrarian(String command, String identifierArg) { super(command, identifierArg, new String[]{".obj"}, new String[0], - ".lib", false, null); + ".lib", false, false, null); } protected void addBase(long base, Vector args) { } diff --git a/src/main/java/net/sf/antcontrib/cpptasks/devstudio/DevStudioCompatibleLinker.java b/src/main/java/net/sf/antcontrib/cpptasks/devstudio/DevStudioCompatibleLinker.java index 80d2aac..6d491df 100644 --- a/src/main/java/net/sf/antcontrib/cpptasks/devstudio/DevStudioCompatibleLinker.java +++ b/src/main/java/net/sf/antcontrib/cpptasks/devstudio/DevStudioCompatibleLinker.java @@ -38,7 +38,7 @@ public abstract class DevStudioCompatibleLinker extends CommandLineLinker { String outputSuffix) { super(command, identifierArg, new String[]{".obj", ".lib", ".res"}, new String[]{".map", ".pdb", ".lnk", ".dll"}, outputSuffix, - false, null); + false, false, null); } protected void addBase(long base, Vector args) { if (base >= 0) { diff --git a/src/main/java/net/sf/antcontrib/cpptasks/devstudio/DevStudioMIDLCompiler.java b/src/main/java/net/sf/antcontrib/cpptasks/devstudio/DevStudioMIDLCompiler.java index fa2e414..b44a56e 100644 --- a/src/main/java/net/sf/antcontrib/cpptasks/devstudio/DevStudioMIDLCompiler.java +++ b/src/main/java/net/sf/antcontrib/cpptasks/devstudio/DevStudioMIDLCompiler.java @@ -40,7 +40,7 @@ public final class DevStudioMIDLCompiler extends CommandLineCompiler { } private DevStudioMIDLCompiler(boolean newEnvironment, Environment env) { super("midl", null, new String[]{".idl", ".odl"}, new String[]{}, - ".tlb", false, null, newEnvironment, env); + ".tlb", false, false, null, newEnvironment, env); } protected void addImpliedArgs(final Vector args, final boolean debug, diff --git a/src/main/java/net/sf/antcontrib/cpptasks/devstudio/DevStudioResourceCompiler.java b/src/main/java/net/sf/antcontrib/cpptasks/devstudio/DevStudioResourceCompiler.java index 6f8360b..4645ac3 100644 --- a/src/main/java/net/sf/antcontrib/cpptasks/devstudio/DevStudioResourceCompiler.java +++ b/src/main/java/net/sf/antcontrib/cpptasks/devstudio/DevStudioResourceCompiler.java @@ -42,7 +42,7 @@ public final class DevStudioResourceCompiler extends CommandLineCompiler { private String identifier; private DevStudioResourceCompiler(boolean newEnvironment, Environment env) { super("rc", null, new String[]{".rc"}, new String[]{".h", ".hpp", - ".inl"}, ".res", false, null, newEnvironment, env); + ".inl"}, ".res", false, false, null, newEnvironment, env); } protected void addImpliedArgs(final Vector args, final boolean debug, diff --git a/src/main/java/net/sf/antcontrib/cpptasks/gcc/AbstractArLibrarian.java b/src/main/java/net/sf/antcontrib/cpptasks/gcc/AbstractArLibrarian.java index 2e8d4af..3b496b9 100644 --- a/src/main/java/net/sf/antcontrib/cpptasks/gcc/AbstractArLibrarian.java +++ b/src/main/java/net/sf/antcontrib/cpptasks/gcc/AbstractArLibrarian.java @@ -40,7 +40,7 @@ public abstract class AbstractArLibrarian extends CommandLineLinker { String outputPrefix, String outputExtension, boolean isLibtool, AbstractArLibrarian libtoolLibrarian) { super(command, identificationArg, inputExtensions, ignoredExtensions, - outputExtension, isLibtool, libtoolLibrarian); + outputExtension, false, isLibtool, libtoolLibrarian); this.outputPrefix = outputPrefix; } public void addBase(long base, Vector args) { diff --git a/src/main/java/net/sf/antcontrib/cpptasks/gcc/AbstractLdLinker.java b/src/main/java/net/sf/antcontrib/cpptasks/gcc/AbstractLdLinker.java index 0a0f5ff..3ee7f8e 100644 --- a/src/main/java/net/sf/antcontrib/cpptasks/gcc/AbstractLdLinker.java +++ b/src/main/java/net/sf/antcontrib/cpptasks/gcc/AbstractLdLinker.java @@ -33,15 +33,19 @@ import net.sf.antcontrib.cpptasks.types.LibraryTypeEnum; * @author Curt Arnold */ public abstract class AbstractLdLinker extends CommandLineLinker { - private String outputPrefix; + private final String outputPrefix; protected AbstractLdLinker(String command, String identifierArg, String[] extensions, String[] ignoredExtensions, - String outputPrefix, String outputSuffix, boolean isLibtool, - AbstractLdLinker libtoolLinker) { + String outputPrefix, String outputSuffix, boolean isXCoderun, + boolean isLibtool, AbstractLdLinker libtoolLinker) { super(command, identifierArg, extensions, ignoredExtensions, - outputSuffix, isLibtool, libtoolLinker); + outputSuffix, isXCoderun, isLibtool, libtoolLinker); this.outputPrefix = outputPrefix; } + protected AbstractLdLinker(AbstractLdLinker ld, boolean isXCoderun) { + super(ld, isXCoderun); + this.outputPrefix = ld.outputPrefix; + } public void addBase(long base, Vector args) { if (base >= 0) { args.addElement("--image-base"); @@ -292,7 +296,7 @@ public abstract class AbstractLdLinker extends CommandLineLinker { // // null out any sources that correspond to library names // - String[] localSources = (String[]) sourceFiles.clone(); + String[] localSources = sourceFiles.clone(); int extra = 0; for (int i = 0; i < libnames.length; i++) { String libname = libnames[i]; diff --git a/src/main/java/net/sf/antcontrib/cpptasks/gcc/GccCCompiler.java b/src/main/java/net/sf/antcontrib/cpptasks/gcc/GccCCompiler.java index fb831e1..da6de52 100644 --- a/src/main/java/net/sf/antcontrib/cpptasks/gcc/GccCCompiler.java +++ b/src/main/java/net/sf/antcontrib/cpptasks/gcc/GccCCompiler.java @@ -53,28 +53,28 @@ public final class GccCCompiler extends GccCompatibleCCompiler { ".inl"}; private static final GccCCompiler cppInstance = new GccCCompiler("c++", sourceExtensions, headerExtensions, false, - new GccCCompiler("c++", sourceExtensions, headerExtensions, true, - null, false, null), false, null); + false, new GccCCompiler("c++", sourceExtensions, headerExtensions, false, + true, null, false, null), false, null); private static final GccCCompiler g77Instance = new GccCCompiler("g77", sourceExtensions, headerExtensions, false, - new GccCCompiler("g77", sourceExtensions, headerExtensions, true, - null, false, null), false, null); + false, new GccCCompiler("g77", sourceExtensions, headerExtensions, false, + true, null, false, null), false, null); private static final GccCCompiler gppInstance = new GccCCompiler("g++", sourceExtensions, headerExtensions, false, - new GccCCompiler("g++", sourceExtensions, headerExtensions, true, - null, false, null), false, null); + false, new GccCCompiler("g++", sourceExtensions, headerExtensions, false, + true, null, false, null), false, null); private static final GccCCompiler instance = new GccCCompiler("gcc", sourceExtensions, headerExtensions, false, - new GccCCompiler("gcc", sourceExtensions, headerExtensions, true, - null, false, null), false, null); + false, new GccCCompiler("gcc", sourceExtensions, headerExtensions, false, + true, null, false, null), false, null); private static final GccCCompiler clangInstance = new GccCCompiler("clang", sourceExtensions, headerExtensions, false, - new GccCCompiler("clang", sourceExtensions, headerExtensions, true, - null, false, null), false, null); + false, new GccCCompiler("clang", sourceExtensions, headerExtensions, false, + true, null, false, null), false, null); private static final GccCCompiler cpplangInstance = new GccCCompiler("clang++", sourceExtensions, headerExtensions, false, - new GccCCompiler("clang++", sourceExtensions, headerExtensions, true, - null, false, null), false, null); + false, new GccCCompiler("clang++", sourceExtensions, headerExtensions, false, + true, null, false, null), false, null); /** * Gets c++ adapter */ @@ -111,21 +111,53 @@ public final class GccCCompiler extends GccCompatibleCCompiler { public static GccCCompiler getCPPLangInstance() { return cpplangInstance; } + /** + * Gets XCode clang adapter + */ + public static GccCCompiler getXCodeCLangInstance() { + return createXCodeRun(clangInstance); + } + /** + * Gets clang++ adapter + */ + public static GccCCompiler getXCodeCPPLangInstance() { + return createXCodeRun(cpplangInstance); + } private String identifier; private File[] includePath; private boolean isPICMeaningful = true; /** * Private constructor. Use GccCCompiler.getInstance() to get singleton * instance of this class. + * @param isXCoderun TODO */ private GccCCompiler(String command, String[] sourceExtensions, - String[] headerExtensions, boolean isLibtool, - GccCCompiler libtoolCompiler, boolean newEnvironment, - Environment env) { - super(command, null, sourceExtensions, headerExtensions, isLibtool, - libtoolCompiler, newEnvironment, env); + String[] headerExtensions, boolean isXCoderun, + boolean isLibtool, GccCCompiler libtoolCompiler, + boolean newEnvironment, Environment env) { + super(command, null, sourceExtensions, headerExtensions, isXCoderun, + isLibtool, libtoolCompiler, newEnvironment, env); isPICMeaningful = System.getProperty("os.name").indexOf("Windows") < 0; } + private GccCCompiler(GccCCompiler cc, boolean isXcoderun) { + super(cc, isXcoderun); + isPICMeaningful = cc.isPICMeaningful; + } + private static GccCCompiler createXCodeRun(GccCCompiler cc) { + /** + super(command, null, sourceExtensions, headerExtensions, isXCoderun, + isLibtool, libtoolCompiler, newEnvironment, env); + */ + final GccCCompiler libtoolCC = (GccCCompiler)cc.getLibtoolCompiler(); + final GccCCompiler libtoolCCXCR; + if( null != libtoolCC ) { + libtoolCCXCR = new GccCCompiler(libtoolCC, true /* isXCoderun */); + } else { + libtoolCCXCR = null; + } + return new GccCCompiler(cc, true /* isXCoderun */); + } + public void addImpliedArgs(final Vector args, final boolean debug, final boolean multithreaded, @@ -142,9 +174,9 @@ public final class GccCCompiler extends GccCompatibleCCompiler { public Processor changeEnvironment(boolean newEnvironment, Environment env) { if (newEnvironment || env != null) { return new GccCCompiler(getCommand(), this.getSourceExtensions(), - this.getHeaderExtensions(), this.getLibtool(), - (GccCCompiler) this.getLibtoolCompiler(), newEnvironment, - env); + this.getHeaderExtensions(), false, + this.getLibtool(), (GccCCompiler) this.getLibtoolCompiler(), + newEnvironment, env); } return this; } @@ -234,7 +266,7 @@ public final class GccCCompiler extends GccCompatibleCCompiler { } } } - return (File[]) includePath.clone(); + return includePath.clone(); } public String getIdentifier() throws BuildException { if (identifier == null) { diff --git a/src/main/java/net/sf/antcontrib/cpptasks/gcc/GccCompatibleCCompiler.java b/src/main/java/net/sf/antcontrib/cpptasks/gcc/GccCompatibleCCompiler.java index 0485fba..1a698c1 100644 --- a/src/main/java/net/sf/antcontrib/cpptasks/gcc/GccCompatibleCCompiler.java +++ b/src/main/java/net/sf/antcontrib/cpptasks/gcc/GccCompatibleCCompiler.java @@ -35,29 +35,32 @@ public abstract class GccCompatibleCCompiler extends CommandLineCCompiler { ".inl"}; private final static String[] sourceExtensions = new String[]{".c", ".cc", ".cpp", ".cxx", ".c++", ".i", ".f", ".for"}; + + protected GccCompatibleCCompiler(GccCompatibleCCompiler cc, boolean isXcoderun) { + super(cc, isXcoderun); + } /** * Private constructor. Use GccCCompiler.getInstance() to get singleton * instance of this class. + * @param isXcoderun TODO */ protected GccCompatibleCCompiler(String command, String identifierArg, - boolean libtool, GccCompatibleCCompiler libtoolCompiler, + boolean isXcoderun, boolean libtool, GccCompatibleCCompiler libtoolCompiler, boolean newEnvironment, Environment env) { super(command, identifierArg, sourceExtensions, headerExtensions, - libtool ? ".fo" : ".o", libtool, libtoolCompiler, - newEnvironment, env); + libtool ? ".fo" : ".o", isXcoderun, libtool, + libtoolCompiler, newEnvironment, env); } - /** - * Private constructor. Use GccCCompiler.getInstance() to get singleton - * instance of this class. - */ + protected GccCompatibleCCompiler(String command, String identifierArg, String[] sourceExtensions, String[] headerExtensions, - boolean libtool, GccCompatibleCCompiler libtoolCompiler, + boolean isXcoderun, boolean libtool, GccCompatibleCCompiler libtoolCompiler, boolean newEnvironment, Environment env) { - super(command, identifierArg, sourceExtensions, headerExtensions, - libtool ? ".fo" : ".o", libtool, libtoolCompiler, + super(command, identifierArg, sourceExtensions, headerExtensions, + libtool ? ".fo" : ".o", isXcoderun, libtool, libtoolCompiler, newEnvironment, env); } + public void addImpliedArgs(final Vector args, final boolean debug, final boolean multithreaded, diff --git a/src/main/java/net/sf/antcontrib/cpptasks/gcc/GccLinker.java b/src/main/java/net/sf/antcontrib/cpptasks/gcc/GccLinker.java index 52a5473..4f3d7f0 100644 --- a/src/main/java/net/sf/antcontrib/cpptasks/gcc/GccLinker.java +++ b/src/main/java/net/sf/antcontrib/cpptasks/gcc/GccLinker.java @@ -1,5 +1,5 @@ /* - * + * * Copyright 2002-2004 The Ant-Contrib project * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -15,136 +15,123 @@ * limitations under the License. */ package net.sf.antcontrib.cpptasks.gcc; + import java.io.File; -import java.util.Vector; -import java.util.HashSet; -import java.util.Arrays; import net.sf.antcontrib.cpptasks.CUtil; -import net.sf.antcontrib.cpptasks.compiler.LinkType; -import net.sf.antcontrib.cpptasks.compiler.Linker; + /** * Adapter for the GCC linker - * + * * @author Adam Murdoch, et.al. */ -public class GccLinker extends AbstractLdLinker { +public class GccLinker extends GnuLinker { private static final String[] discardFiles = new String[0]; private static final String[] objFiles = new String[]{".o", ".a", ".lib", ".dll", ".so", ".sl"}; private static final String[] libtoolObjFiles = new String[]{".fo", ".a", ".lib", ".dll", ".so", ".sl"}; - private static String[] linkerOptions = new String[]{"-bundle", + private static final String[] linkerOptions = new String[]{"-bundle", "-dynamiclib", "-nostartfiles", "-nostdlib", "-prebind", "-noprebind", "-s", "-static", "-shared", "-symbolic", "-Xlinker", - "--export-all-symbols", "-static-libgcc",}; - private static String[] darwinLinkerOptions = new String[]{"-arch", "-weak_framework", "-lazy_framework", "-weak_library" }; - - private static final GccLinker dllLinker = new GccLinker("gcc", objFiles, + "--export-all-symbols", "-static-libgcc",}; + + private static final GccLinker dllLinker = new GccLinker("gcc", objFiles, discardFiles, "lib", ".so", false, new GccLinker("gcc", objFiles, discardFiles, "lib", ".so", true, null)); - private static final GccLinker dllCLangLinker = new GccLinker("clang", objFiles, + private static final GccLinker dllClangLinker = new GccLinker("clang", objFiles, discardFiles, "lib", ".so", false, new GccLinker("clang", objFiles, discardFiles, "lib", ".so", true, null)); - + private static final GccLinker instance = new GccLinker("gcc", objFiles, discardFiles, "", "", false, null); private static final GccLinker clangInstance = new GccLinker("clang", objFiles, discardFiles, "", "", false, null); - + private static final GccLinker xcodeClangInstance = new GccLinker(clangInstance, true); + private static final GccLinker machBundleLinker = new GccLinker("gcc", objFiles, discardFiles, "lib", ".bundle", false, null); - private static final GccLinker machCLangBundleLinker = new GccLinker("clang", + private static final GccLinker machClangBundleLinker = new GccLinker("clang", objFiles, discardFiles, "lib", ".bundle", false, null); - + private static final GccLinker xcodeMachClangBundleLinker = new GccLinker(machClangBundleLinker, true); + private static final GccLinker machDllLinker = new GccLinker("gcc", objFiles, discardFiles, "lib", ".dylib", false, null); - private static final GccLinker machDllCLangLinker = new GccLinker("clang", + private static final GccLinker machDllClangLinker = new GccLinker("clang", objFiles, discardFiles, "lib", ".dylib", false, null); - + private static final GccLinker xcodeMachDllClangLinker = new GccLinker(machDllClangLinker, true); + public static GccLinker getInstance() { return instance; } - public static GccLinker getCLangInstance() { + public static GccLinker getClangInstance() { return clangInstance; } - private final boolean isGCC; - private File[] libDirs; + public static GccLinker getXcodeClangInstance() { + return xcodeClangInstance; + } + protected GccLinker(String command, String[] extensions, String[] ignoredExtensions, String outputPrefix, String outputSuffix, boolean isLibtool, GccLinker libtoolLinker) { super(command, "-dumpversion", extensions, ignoredExtensions, - outputPrefix, outputSuffix, isLibtool, libtoolLinker); - isGCC = "gcc".equals(command); - } - protected void addImpliedArgs(boolean debug, LinkType linkType, Vector args) { - super.addImpliedArgs(debug, linkType, args); - if (getIdentifier().indexOf("mingw") >= 0) { - if (linkType.isSubsystemConsole()) { - args.addElement("-mconsole"); - } - if (linkType.isSubsystemGUI()) { - args.addElement("-mwindows"); - } - } + outputPrefix, outputSuffix, false, isLibtool, libtoolLinker); + } + protected GccLinker(GccLinker ld, boolean isXCoderun) { + super(ld, isXCoderun); } - /** - * Allows drived linker to decorate linker option. Override by GccLinker to - * prepend a "-Wl," to pass option to through gcc to linker. - * - * @param buf - * buffer that may be used and abused in the decoration process, - * must not be null. - * @param arg - * linker argument - */ - public String decorateLinkerOption(StringBuffer buf, String arg) { - String decoratedArg = arg; - if (arg.startsWith("--sysroot")) { - return arg; - } - if (arg.startsWith("-nostdlib")) { - return arg; - } - if (arg.length() > 1 && arg.charAt(0) == '-') { - switch (arg.charAt(1)) { - // - // passed automatically by GCC - // - case 'g' : - case 'f' : - case 'F' : - /* Darwin */ - case 'm' : - case 'O' : - case 'W' : - case 'l' : - case 'L' : - case 'u' : - case 'v' : - break; - default : - boolean known = false; - HashSet allLinkerOptions = new HashSet(); - allLinkerOptions.addAll(Arrays.asList(linkerOptions)); - if (isDarwin()) { - allLinkerOptions.addAll(Arrays.asList(darwinLinkerOptions)); - } - known = allLinkerOptions.contains(arg); - if (!known) { - buf.setLength(0); - buf.append("-Wl,"); - buf.append(arg); - decoratedArg = buf.toString(); - } - break; - } - } - return decoratedArg; + @Override + protected final String[] getStaticLinkerOptions() { return linkerOptions; } + + @Override + protected final GnuLinker getStaticDllLinker() { + return dllLinker; + } + @Override + protected final GnuLinker getStaticDllClangLinker() { + return dllClangLinker; + } + @Override + protected final GnuLinker getStaticClangInstance() { + return clangInstance; + } + @Override + protected final GnuLinker getStaticXcodeClangInstance() { + return xcodeClangInstance; + } + @Override + protected final GnuLinker getStaticMachBundleLinker() { + return machBundleLinker; } + @Override + protected final GnuLinker getStaticMachClangBundleLinker() { + return machClangBundleLinker; + } + @Override + protected final GnuLinker getStaticXcodeMachClangBundleLinker() { + return xcodeMachClangBundleLinker; + } + @Override + protected final GnuLinker getStaticMachDllLinker() { + return machDllLinker; + } + @Override + protected final GnuLinker getStaticMachDllClangLinker() { + return machDllClangLinker; + } + @Override + protected final GnuLinker getStaticXcodeMachDllClangLinker() { + return xcodeMachDllClangLinker; + } + @Override + protected final GnuLinker getStaticInstance() { + return instance; + } + /** * Returns library path. - * + * */ + @Override public File[] getLibraryPath() { if (libDirs == null) { // @@ -157,8 +144,8 @@ public class GccLinker extends AbstractLdLinker { // // build default path from gcc and system /lib and /lib/w32api // - String[] impliedLibPath = new String[]{buf.toString(), - "/lib/w32api", "/lib"}; + // String[] impliedLibPath = new String[]{buf.toString(), "/lib/w32api", "/lib"}; + // // read gcc specs file for other library paths // @@ -214,24 +201,4 @@ public class GccLinker extends AbstractLdLinker { } return libDirs; } - public Linker getLinker(LinkType type) { - if (type.isStaticLibrary()) { - return GccLibrarian.getInstance(); // uses 'ar', which is 'gcc' agnostic - } - if (type.isPluginModule()) { - if (isDarwin()) { - return isGCC ? machBundleLinker : machCLangBundleLinker; - } else { - return isGCC ? dllLinker : dllCLangLinker; - } - } - if (type.isSharedLibrary()) { - if (isDarwin()) { - return isGCC ? machDllLinker : machDllCLangLinker; - } else { - return isGCC ? dllLinker : dllCLangLinker; - } - } - return isGCC ? instance : clangInstance; - } } diff --git a/src/main/java/net/sf/antcontrib/cpptasks/gcc/GnuLinker.java b/src/main/java/net/sf/antcontrib/cpptasks/gcc/GnuLinker.java new file mode 100644 index 0000000..cbd30ea --- /dev/null +++ b/src/main/java/net/sf/antcontrib/cpptasks/gcc/GnuLinker.java @@ -0,0 +1,139 @@ +package net.sf.antcontrib.cpptasks.gcc; + +import java.io.File; +import java.util.Arrays; +import java.util.HashSet; +import java.util.Vector; + +import net.sf.antcontrib.cpptasks.CUtil; +import net.sf.antcontrib.cpptasks.compiler.LinkType; +import net.sf.antcontrib.cpptasks.compiler.Linker; + +public abstract class GnuLinker extends AbstractLdLinker { + + static String[] darwinLinkerOptions = new String[]{"-arch", "-weak_framework", "-lazy_framework", "-weak_library" }; + + protected final boolean isGCC; + protected File[] libDirs; + + public GnuLinker(String command, String identifierArg, String[] extensions, + String[] ignoredExtensions, String outputPrefix, + String outputSuffix, boolean isXCoderun, boolean isLibtool, + AbstractLdLinker libtoolLinker) { + super(command, identifierArg, extensions, ignoredExtensions, + outputPrefix, outputSuffix, isXCoderun, isLibtool, + libtoolLinker); + isGCC = "gcc".equals(command); + } + + public GnuLinker(AbstractLdLinker ld, boolean isXCoderun) { + super(ld, isXCoderun); + isGCC = "gcc".equals(getCommand()); + } + + protected abstract String[] getStaticLinkerOptions(); + protected abstract GnuLinker getStaticDllLinker(); + protected abstract GnuLinker getStaticDllClangLinker(); + protected abstract GnuLinker getStaticClangInstance(); + protected abstract GnuLinker getStaticXcodeClangInstance(); + protected abstract GnuLinker getStaticMachBundleLinker(); + protected abstract GnuLinker getStaticMachClangBundleLinker(); + protected abstract GnuLinker getStaticXcodeMachClangBundleLinker(); + protected abstract GnuLinker getStaticMachDllLinker(); + protected abstract GnuLinker getStaticMachDllClangLinker(); + protected abstract GnuLinker getStaticXcodeMachDllClangLinker(); + protected abstract GnuLinker getStaticInstance(); + + @Override + protected void addImpliedArgs(boolean debug, LinkType linkType, Vector args) { + super.addImpliedArgs(debug, linkType, args); + if (getIdentifier().indexOf("mingw") >= 0) { + if (linkType.isSubsystemConsole()) { + args.addElement("-mconsole"); + } + if (linkType.isSubsystemGUI()) { + args.addElement("-mwindows"); + } + } + } + + /** + * Allows drived linker to decorate linker option. Override by GccLinker to + * prepend a "-Wl," to pass option to through gcc to linker. + * + * @param buf + * buffer that may be used and abused in the decoration process, + * must not be null. + * @param arg + * linker argument + */ + @Override + public String decorateLinkerOption(StringBuffer buf, String arg) { + if (arg.startsWith("--sysroot")) { + return arg; + } + if (arg.startsWith("-nostdlib")) { + return arg; + } + String decoratedArg = arg; + if (arg.length() > 1 && arg.charAt(0) == '-') { + switch (arg.charAt(1)) { + // + // passed automatically by GCC + // + case 'g' : + case 'f' : + case 'F' : + /* Darwin */ + case 'm' : + case 'O' : + case 'W' : + case 'l' : + case 'L' : + case 'u' : + case 'v' : + break; + default : + boolean known = false; + HashSet<String> allLinkerOptions = new HashSet<String>(); + allLinkerOptions.addAll(Arrays.asList(getStaticLinkerOptions())); + if (isDarwin()) { + allLinkerOptions.addAll(Arrays.asList(darwinLinkerOptions)); + } + known = allLinkerOptions.contains(arg); + + if (!known) { + buf.setLength(0); + buf.append("-Wl,"); + buf.append(arg); + decoratedArg = buf.toString(); + } + break; + } + } + return decoratedArg; + } + + @Override + public Linker getLinker(LinkType type) { + if (type.isStaticLibrary()) { + return GccLibrarian.getInstance(); // uses 'ar', which is 'gcc' agnostic + } + if (type.isPluginModule()) { + if (isDarwin()) { + return isGCC ? getStaticMachBundleLinker() : ( getXcodeRun() ? getStaticXcodeMachClangBundleLinker() : getStaticMachClangBundleLinker() ); + } else { + return isGCC ? getStaticDllLinker() : getStaticDllClangLinker(); + } + } + if (type.isSharedLibrary()) { + if (isDarwin()) { + return isGCC ? getStaticMachDllLinker() : ( getXcodeRun() ? getStaticXcodeMachDllClangLinker() : getStaticMachDllClangLinker() ); + } else { + return isGCC ? getStaticDllLinker() : getStaticDllClangLinker(); + } + } + return isGCC ? getStaticInstance() : ( getXcodeRun() ? getStaticXcodeClangInstance() : getStaticClangInstance() ) ; + } + +}
\ No newline at end of file diff --git a/src/main/java/net/sf/antcontrib/cpptasks/gcc/GppLinker.java b/src/main/java/net/sf/antcontrib/cpptasks/gcc/GppLinker.java index 4dfe771..1ca34b5 100644 --- a/src/main/java/net/sf/antcontrib/cpptasks/gcc/GppLinker.java +++ b/src/main/java/net/sf/antcontrib/cpptasks/gcc/GppLinker.java @@ -1,5 +1,5 @@ /* - * + * * Copyright 2003-2004 The Ant-Contrib project * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -16,6 +16,8 @@ */ package net.sf.antcontrib.cpptasks.gcc; import java.io.File; +import java.util.Arrays; +import java.util.HashSet; import java.util.Vector; import net.sf.antcontrib.cpptasks.CCTask; @@ -26,54 +28,116 @@ import net.sf.antcontrib.cpptasks.compiler.Linker; import net.sf.antcontrib.cpptasks.types.LibrarySet; /** * Adapter for the g++ variant of the GCC linker - * + * * @author Stephen M. Webb <[email protected]>, et.al. */ -public class GppLinker extends AbstractLdLinker { +public class GppLinker extends GnuLinker { protected static final String[] discardFiles = new String[0]; protected static final String[] objFiles = new String[]{".o", ".a", ".lib", ".dll", ".so", ".sl"}; - private static final GppLinker dllLinker = new GppLinker("gcc", objFiles, - discardFiles, "lib", ".so", false, new GppLinker("gcc", objFiles, - discardFiles, "lib", ".so", true, null)); private final static String libPrefix = "libraries: ="; - protected static final String[] libtoolObjFiles = new String[]{".fo", ".a", + private static final String[] libtoolObjFiles = new String[]{".fo", ".a", ".lib", ".dll", ".so", ".sl"}; private static String[] linkerOptions = new String[]{"-bundle", "-dylib", "-dynamic", "-dynamiclib", "-nostartfiles", "-nostdlib", "-prebind", "-s", "-static", "-shared", "-symbolic", "-Xlinker"}; + + private static final GppLinker dllLinker = new GppLinker("gcc", objFiles, + discardFiles, "lib", ".so", false, false, new GppLinker("gcc", objFiles, + discardFiles, "lib", ".so", false, true, null)); + private static final GppLinker dllClangLinker = new GppLinker("clang", objFiles, + discardFiles, "lib", ".so", false, false, new GppLinker("clang", objFiles, + discardFiles, "lib", ".so", false, true, null)); + private static final GppLinker instance = new GppLinker("gcc", objFiles, - discardFiles, "", "", false, null); + discardFiles, "", "", false, false, null); private static final GppLinker clangInstance = new GppLinker("clang", objFiles, - discardFiles, "", "", false, null); + discardFiles, "", "", false, false, null); + private static final GppLinker xcodeClangInstance = new GppLinker(clangInstance, true); + + private static final GppLinker machBundleLinker = new GppLinker("gcc", + objFiles, discardFiles, "lib", ".bundle", false, false, null); + private static final GppLinker machClangBundleLinker = new GppLinker("clang", + objFiles, discardFiles, "lib", ".bundle", false, false, null); + private static final GppLinker xcodeMachClangBundleLinker = new GppLinker(machClangBundleLinker, true); + private static final GppLinker machDllLinker = new GppLinker("gcc", - objFiles, discardFiles, "lib", ".dylib", false, null); - private static final GppLinker machPluginLinker = new GppLinker("gcc", - objFiles, discardFiles, "lib", ".bundle", false, null); + objFiles, discardFiles, "lib", ".dylib", false, false, null); + private static final GppLinker machDllClangLinker = new GppLinker("clang", + objFiles, discardFiles, "lib", ".dylib", false, false, null); + private static final GppLinker xcodeMachDllClangLinker = new GppLinker(machDllClangLinker, true); + public static GppLinker getInstance() { return instance; } - public static GppLinker getCLangInstance() { + public static GppLinker getClangInstance() { return clangInstance; } - private File[] libDirs; + public static GppLinker getXcodeClangInstance() { + return xcodeClangInstance; + } private String runtimeLibrary; protected GppLinker(String command, String[] extensions, String[] ignoredExtensions, String outputPrefix, - String outputSuffix, boolean isLibtool, GppLinker libtoolLinker) { + String outputSuffix, boolean isXCoderun, boolean isLibtool, GppLinker libtoolLinker) { super(command, "-dumpversion", extensions, ignoredExtensions, - outputPrefix, outputSuffix, isLibtool, libtoolLinker); + outputPrefix, outputSuffix, false, isLibtool, libtoolLinker); + } + protected GppLinker(GppLinker ld, boolean isXCoderun) { + super(ld, isXCoderun); + } + + @Override + protected final String[] getStaticLinkerOptions() { return linkerOptions; } + + @Override + protected final GnuLinker getStaticDllLinker() { + return dllLinker; + } + @Override + protected final GnuLinker getStaticDllClangLinker() { + return dllClangLinker; + } + @Override + protected final GnuLinker getStaticClangInstance() { + return clangInstance; + } + @Override + protected final GnuLinker getStaticXcodeClangInstance() { + return xcodeClangInstance; + } + @Override + protected final GnuLinker getStaticMachBundleLinker() { + return machBundleLinker; + } + @Override + protected final GnuLinker getStaticMachClangBundleLinker() { + return machClangBundleLinker; + } + @Override + protected final GnuLinker getStaticXcodeMachClangBundleLinker() { + return xcodeMachClangBundleLinker; + } + @Override + protected final GnuLinker getStaticMachDllLinker() { + return machDllLinker; + } + @Override + protected final GnuLinker getStaticMachDllClangLinker() { + return machDllClangLinker; } + @Override + protected final GnuLinker getStaticXcodeMachDllClangLinker() { + return xcodeMachDllClangLinker; + } + @Override + protected final GnuLinker getStaticInstance() { + return instance; + } + + @Override protected void addImpliedArgs(boolean debug, LinkType linkType, Vector args) { super.addImpliedArgs(debug, linkType, args); - if (getIdentifier().indexOf("mingw") >= 0) { - if (linkType.isSubsystemConsole()) { - args.addElement("-mconsole"); - } - if (linkType.isSubsystemGUI()) { - args.addElement("-mwindows"); - } - } if (linkType.isStaticRuntime()) { String[] cmdin = new String[]{"g++", "-print-file-name=libstdc++.a"}; String[] cmdout = CaptureStreamHandler.run(cmdin); @@ -86,6 +150,7 @@ public class GppLinker extends AbstractLdLinker { runtimeLibrary = "-lstdc++"; } } + @Override public String[] addLibrarySets(CCTask task, LibrarySet[] libsets, Vector preargs, Vector midargs, Vector endargs) { String[] rs = super.addLibrarySets(task, libsets, preargs, midargs, @@ -96,56 +161,10 @@ public class GppLinker extends AbstractLdLinker { return rs; } /** - * Allows drived linker to decorate linker option. Override by GppLinker to - * prepend a "-Wl," to pass option to through gcc to linker. - * - * @param buf - * buffer that may be used and abused in the decoration process, - * must not be null. - * @param arg - * linker argument - */ - public String decorateLinkerOption(StringBuffer buf, String arg) { - String decoratedArg = arg; - if (arg.length() > 1 && arg.charAt(0) == '-') { - switch (arg.charAt(1)) { - // - // passed automatically by GCC - // - case 'g' : - case 'f' : - case 'F' : - /* Darwin */ - case 'm' : - case 'O' : - case 'W' : - case 'l' : - case 'L' : - case 'u' : - break; - default : - boolean known = false; - for (int i = 0; i < linkerOptions.length; i++) { - if (linkerOptions[i].equals(arg)) { - known = true; - break; - } - } - if (!known) { - buf.setLength(0); - buf.append("-Wl,"); - buf.append(arg); - decoratedArg = buf.toString(); - } - break; - } - } - return decoratedArg; - } - /** * Returns library path. - * + * */ + @Override public File[] getLibraryPath() { if (libDirs == null) { Vector dirs = new Vector(); @@ -185,24 +204,4 @@ public class GppLinker extends AbstractLdLinker { } return libDirs; } - public Linker getLinker(LinkType type) { - if (type.isStaticLibrary()) { - return GccLibrarian.getInstance(); - } - if (type.isPluginModule()) { - if (GccProcessor.getMachine().indexOf("darwin") >= 0) { - return machPluginLinker; - } else { - return dllLinker; - } - } - if (type.isSharedLibrary()) { - if (GccProcessor.getMachine().indexOf("darwin") >= 0) { - return machDllLinker; - } else { - return dllLinker; - } - } - return instance; - } } diff --git a/src/main/java/net/sf/antcontrib/cpptasks/gcc/LdLinker.java b/src/main/java/net/sf/antcontrib/cpptasks/gcc/LdLinker.java index 2104e34..aaab5c7 100644 --- a/src/main/java/net/sf/antcontrib/cpptasks/gcc/LdLinker.java +++ b/src/main/java/net/sf/antcontrib/cpptasks/gcc/LdLinker.java @@ -43,7 +43,7 @@ public final class LdLinker extends AbstractLdLinker { String[] ignoredExtensions, String outputPrefix, String outputSuffix, boolean isLibtool, LdLinker libtoolLinker) { super(command, "-version", extensions, ignoredExtensions, outputPrefix, - outputSuffix, isLibtool, libtoolLinker); + outputSuffix, false, isLibtool, libtoolLinker); } public Linker getLinker(LinkType type) { if (type.isStaticLibrary()) { diff --git a/src/main/java/net/sf/antcontrib/cpptasks/gcc/WindresResourceCompiler.java b/src/main/java/net/sf/antcontrib/cpptasks/gcc/WindresResourceCompiler.java index a617024..24b3948 100644 --- a/src/main/java/net/sf/antcontrib/cpptasks/gcc/WindresResourceCompiler.java +++ b/src/main/java/net/sf/antcontrib/cpptasks/gcc/WindresResourceCompiler.java @@ -1,5 +1,5 @@ /* - * + * * Copyright 2008 The Ant-Contrib project * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -29,7 +29,7 @@ import net.sf.antcontrib.cpptasks.OptimizationEnum; import org.apache.tools.ant.types.Environment; /** * Adapter for the GNU windres resource compiler. - * + * * @author Curt Arnold */ public final class WindresResourceCompiler extends CommandLineCompiler { @@ -40,12 +40,12 @@ public final class WindresResourceCompiler extends CommandLineCompiler { } private WindresResourceCompiler(boolean newEnvironment, Environment env) { super("windres", null, new String[]{".rc"}, new String[]{".h", ".hpp", - ".inl"}, ".o", false, null, newEnvironment, env); + ".inl"}, ".o", false, false, null, newEnvironment, env); } - protected void addImpliedArgs(final Vector args, + protected void addImpliedArgs(final Vector args, final boolean debug, - final boolean multithreaded, - final boolean exceptions, + final boolean multithreaded, + final boolean exceptions, final LinkType linkType, final Boolean rtti, final OptimizationEnum optimization) { diff --git a/src/main/java/net/sf/antcontrib/cpptasks/gcc/cross/GccCCompiler.java b/src/main/java/net/sf/antcontrib/cpptasks/gcc/cross/GccCCompiler.java index 86a8ac7..0662c3f 100755 --- a/src/main/java/net/sf/antcontrib/cpptasks/gcc/cross/GccCCompiler.java +++ b/src/main/java/net/sf/antcontrib/cpptasks/gcc/cross/GccCCompiler.java @@ -105,8 +105,8 @@ public final class GccCCompiler extends GccCompatibleCCompiler { String[] headerExtensions, boolean isLibtool, GccCCompiler libtoolCompiler, boolean newEnvironment, Environment env) { - super(command, null, sourceExtensions, headerExtensions, isLibtool, - libtoolCompiler, newEnvironment, env); + super(command, null, sourceExtensions, headerExtensions, false, + isLibtool, libtoolCompiler, newEnvironment, env); isPICMeaningful = System.getProperty("os.name").indexOf("Windows") < 0; } public void addImpliedArgs(final Vector args, diff --git a/src/main/java/net/sf/antcontrib/cpptasks/gcc/cross/GccLinker.java b/src/main/java/net/sf/antcontrib/cpptasks/gcc/cross/GccLinker.java index 4347211..fa2daff 100755 --- a/src/main/java/net/sf/antcontrib/cpptasks/gcc/cross/GccLinker.java +++ b/src/main/java/net/sf/antcontrib/cpptasks/gcc/cross/GccLinker.java @@ -57,7 +57,7 @@ public class GccLinker extends AbstractLdLinker { String[] ignoredExtensions, String outputPrefix, String outputSuffix, boolean isLibtool, GccLinker libtoolLinker) { super(command, "-dumpversion", extensions, ignoredExtensions, - outputPrefix, outputSuffix, isLibtool, libtoolLinker); + outputPrefix, outputSuffix, false, isLibtool, libtoolLinker); } protected void addImpliedArgs(boolean debug, LinkType linkType, Vector args) { super.addImpliedArgs(debug, linkType, args); diff --git a/src/main/java/net/sf/antcontrib/cpptasks/gcc/cross/GppLinker.java b/src/main/java/net/sf/antcontrib/cpptasks/gcc/cross/GppLinker.java index b332c64..319668b 100755 --- a/src/main/java/net/sf/antcontrib/cpptasks/gcc/cross/GppLinker.java +++ b/src/main/java/net/sf/antcontrib/cpptasks/gcc/cross/GppLinker.java @@ -62,7 +62,7 @@ public class GppLinker extends AbstractLdLinker { String[] ignoredExtensions, String outputPrefix, String outputSuffix, boolean isLibtool, GppLinker libtoolLinker) { super(command, "-dumpversion", extensions, ignoredExtensions, - outputPrefix, outputSuffix, isLibtool, libtoolLinker); + outputPrefix, outputSuffix, false, isLibtool, libtoolLinker); } protected void addImpliedArgs(boolean debug, LinkType linkType, Vector args) { super.addImpliedArgs(debug, linkType, args); diff --git a/src/main/java/net/sf/antcontrib/cpptasks/gcc/cross/LdLinker.java b/src/main/java/net/sf/antcontrib/cpptasks/gcc/cross/LdLinker.java index 26abf8c..6a844e6 100755 --- a/src/main/java/net/sf/antcontrib/cpptasks/gcc/cross/LdLinker.java +++ b/src/main/java/net/sf/antcontrib/cpptasks/gcc/cross/LdLinker.java @@ -49,7 +49,7 @@ public final class LdLinker extends AbstractLdLinker { String[] ignoredExtensions, String outputPrefix, String outputSuffix, boolean isLibtool, LdLinker libtoolLinker) { super(command, "-version", extensions, ignoredExtensions, outputPrefix, - outputSuffix, isLibtool, libtoolLinker); + outputSuffix, false, isLibtool, libtoolLinker); } protected Object clone() throws CloneNotSupportedException { LdLinker clone = (LdLinker) super.clone(); diff --git a/src/main/java/net/sf/antcontrib/cpptasks/gcc/cross/sparc_sun_solaris2/GccCCompiler.java b/src/main/java/net/sf/antcontrib/cpptasks/gcc/cross/sparc_sun_solaris2/GccCCompiler.java index 44dd968..4e1568e 100755 --- a/src/main/java/net/sf/antcontrib/cpptasks/gcc/cross/sparc_sun_solaris2/GccCCompiler.java +++ b/src/main/java/net/sf/antcontrib/cpptasks/gcc/cross/sparc_sun_solaris2/GccCCompiler.java @@ -104,8 +104,8 @@ public final class GccCCompiler extends GccCompatibleCCompiler { String[] headerExtensions, boolean isLibtool, GccCCompiler libtoolCompiler, boolean newEnvironment, Environment env) { - super(command, null, sourceExtensions, headerExtensions, isLibtool, - libtoolCompiler, newEnvironment, env); + super(command, null, sourceExtensions, headerExtensions, false, + isLibtool, libtoolCompiler, newEnvironment, env); isPICMeaningful = System.getProperty("os.name").indexOf("Windows") < 0; } public void addImpliedArgs(final Vector args, diff --git a/src/main/java/net/sf/antcontrib/cpptasks/gcc/cross/sparc_sun_solaris2/GccLinker.java b/src/main/java/net/sf/antcontrib/cpptasks/gcc/cross/sparc_sun_solaris2/GccLinker.java index d7dd3db..89897dc 100755 --- a/src/main/java/net/sf/antcontrib/cpptasks/gcc/cross/sparc_sun_solaris2/GccLinker.java +++ b/src/main/java/net/sf/antcontrib/cpptasks/gcc/cross/sparc_sun_solaris2/GccLinker.java @@ -58,7 +58,7 @@ public class GccLinker extends AbstractLdLinker { String[] ignoredExtensions, String outputPrefix, String outputSuffix, boolean isLibtool, GccLinker libtoolLinker) { super(command, "-dumpversion", extensions, ignoredExtensions, - outputPrefix, outputSuffix, isLibtool, libtoolLinker); + outputPrefix, outputSuffix, false, isLibtool, libtoolLinker); } protected void addImpliedArgs(boolean debug, LinkType linkType, Vector args) { super.addImpliedArgs(debug, linkType, args); diff --git a/src/main/java/net/sf/antcontrib/cpptasks/gcc/cross/sparc_sun_solaris2/GppLinker.java b/src/main/java/net/sf/antcontrib/cpptasks/gcc/cross/sparc_sun_solaris2/GppLinker.java index 45bbea9..1404e6b 100755 --- a/src/main/java/net/sf/antcontrib/cpptasks/gcc/cross/sparc_sun_solaris2/GppLinker.java +++ b/src/main/java/net/sf/antcontrib/cpptasks/gcc/cross/sparc_sun_solaris2/GppLinker.java @@ -62,7 +62,7 @@ public class GppLinker extends AbstractLdLinker { String[] ignoredExtensions, String outputPrefix, String outputSuffix, boolean isLibtool, GppLinker libtoolLinker) { super(command, "-dumpversion", extensions, ignoredExtensions, - outputPrefix, outputSuffix, isLibtool, libtoolLinker); + outputPrefix, outputSuffix, false, isLibtool, libtoolLinker); } protected void addImpliedArgs(boolean debug, LinkType linkType, Vector args) { super.addImpliedArgs(debug, linkType, args); diff --git a/src/main/java/net/sf/antcontrib/cpptasks/gcc/cross/sparc_sun_solaris2/LdLinker.java b/src/main/java/net/sf/antcontrib/cpptasks/gcc/cross/sparc_sun_solaris2/LdLinker.java index 0cc5fbf..c6370c7 100755 --- a/src/main/java/net/sf/antcontrib/cpptasks/gcc/cross/sparc_sun_solaris2/LdLinker.java +++ b/src/main/java/net/sf/antcontrib/cpptasks/gcc/cross/sparc_sun_solaris2/LdLinker.java @@ -46,7 +46,7 @@ public final class LdLinker extends AbstractLdLinker { String[] ignoredExtensions, String outputPrefix, String outputSuffix, boolean isLibtool, LdLinker libtoolLinker) { super(command, "-version", extensions, ignoredExtensions, outputPrefix, - outputSuffix, isLibtool, libtoolLinker); + outputSuffix, false, isLibtool, libtoolLinker); } public Linker getLinker(LinkType type) { if (type.isStaticLibrary()) { diff --git a/src/main/java/net/sf/antcontrib/cpptasks/hp/aCCCompiler.java b/src/main/java/net/sf/antcontrib/cpptasks/hp/aCCCompiler.java index b978f67..73a2812 100644 --- a/src/main/java/net/sf/antcontrib/cpptasks/hp/aCCCompiler.java +++ b/src/main/java/net/sf/antcontrib/cpptasks/hp/aCCCompiler.java @@ -54,7 +54,7 @@ public final class aCCCompiler extends GccCompatibleCCompiler { String[] headerExtensions, boolean newEnvironment, Environment env) { super(command, "-help", sourceExtensions, headerExtensions, false, - null, newEnvironment, env); + false, null, newEnvironment, env); } public void addImpliedArgs(Vector args, boolean debug, boolean multithreaded, boolean exceptions, LinkType linkType, diff --git a/src/main/java/net/sf/antcontrib/cpptasks/hp/aCCLinker.java b/src/main/java/net/sf/antcontrib/cpptasks/hp/aCCLinker.java index 94f7fc0..159cb37 100644 --- a/src/main/java/net/sf/antcontrib/cpptasks/hp/aCCLinker.java +++ b/src/main/java/net/sf/antcontrib/cpptasks/hp/aCCLinker.java @@ -44,7 +44,7 @@ public final class aCCLinker extends AbstractLdLinker { private aCCLinker(String command, String[] extensions, String[] ignoredExtensions, String outputPrefix, String outputSuffix) { super(command, "-help", extensions, ignoredExtensions, outputPrefix, - outputSuffix, false, null); + outputSuffix, false, false, null); } public void addImpliedArgs(boolean debug, LinkType linkType, Vector args) { if (debug) { diff --git a/src/main/java/net/sf/antcontrib/cpptasks/ibm/VisualAgeCCompiler.java b/src/main/java/net/sf/antcontrib/cpptasks/ibm/VisualAgeCCompiler.java index 781b6de..f84248e 100644 --- a/src/main/java/net/sf/antcontrib/cpptasks/ibm/VisualAgeCCompiler.java +++ b/src/main/java/net/sf/antcontrib/cpptasks/ibm/VisualAgeCCompiler.java @@ -53,7 +53,7 @@ public final class VisualAgeCCompiler extends GccCompatibleCCompiler { String[] headerExtensions, boolean newEnvironment, Environment env) { super(command, "-help", sourceExtensions, headerExtensions, false, - null, newEnvironment, env); + false, null, newEnvironment, env); } public void addImpliedArgs(final Vector args, final boolean debug, diff --git a/src/main/java/net/sf/antcontrib/cpptasks/ibm/VisualAgeLinker.java b/src/main/java/net/sf/antcontrib/cpptasks/ibm/VisualAgeLinker.java index 59ad6a3..f7d4647 100644 --- a/src/main/java/net/sf/antcontrib/cpptasks/ibm/VisualAgeLinker.java +++ b/src/main/java/net/sf/antcontrib/cpptasks/ibm/VisualAgeLinker.java @@ -43,7 +43,7 @@ public final class VisualAgeLinker extends AbstractLdLinker { // just guessing that -? might display something useful // super(command, "-?", extensions, ignoredExtensions, outputPrefix, - outputSuffix, false, null); + outputSuffix, false, false, null); } public void addImpliedArgs(boolean debug, LinkType linkType, Vector args) { if (debug) { diff --git a/src/main/java/net/sf/antcontrib/cpptasks/intel/IntelLinux32CCompiler.java b/src/main/java/net/sf/antcontrib/cpptasks/intel/IntelLinux32CCompiler.java index 12fd5bd..460a37a 100644 --- a/src/main/java/net/sf/antcontrib/cpptasks/intel/IntelLinux32CCompiler.java +++ b/src/main/java/net/sf/antcontrib/cpptasks/intel/IntelLinux32CCompiler.java @@ -39,7 +39,7 @@ public final class IntelLinux32CCompiler extends GccCompatibleCCompiler { private IntelLinux32CCompiler(boolean isLibtool, IntelLinux32CCompiler libtoolCompiler, boolean newEnvironment, Environment env) { - super("icc", "-V", isLibtool, libtoolCompiler, newEnvironment, env); + super("icc", "-V", false, isLibtool, libtoolCompiler, newEnvironment, env); } public Processor changeEnvironment(boolean newEnvironment, Environment env) { if (newEnvironment || env != null) { diff --git a/src/main/java/net/sf/antcontrib/cpptasks/intel/IntelLinux32Linker.java b/src/main/java/net/sf/antcontrib/cpptasks/intel/IntelLinux32Linker.java index 9bed915..09d96ac 100644 --- a/src/main/java/net/sf/antcontrib/cpptasks/intel/IntelLinux32Linker.java +++ b/src/main/java/net/sf/antcontrib/cpptasks/intel/IntelLinux32Linker.java @@ -41,7 +41,7 @@ public final class IntelLinux32Linker extends AbstractLdLinker { private IntelLinux32Linker(String outputPrefix, String outputSuffix, boolean isLibtool, IntelLinux32Linker libtoolLinker) { super("icc", "-V", objFiles, discardFiles, outputPrefix, outputSuffix, - isLibtool, libtoolLinker); + false, isLibtool, libtoolLinker); } public Linker getLinker(LinkType type) { if (type.isStaticLibrary()) { diff --git a/src/main/java/net/sf/antcontrib/cpptasks/intel/IntelLinux64CCompiler.java b/src/main/java/net/sf/antcontrib/cpptasks/intel/IntelLinux64CCompiler.java index 9ed6393..ae0e95a 100644 --- a/src/main/java/net/sf/antcontrib/cpptasks/intel/IntelLinux64CCompiler.java +++ b/src/main/java/net/sf/antcontrib/cpptasks/intel/IntelLinux64CCompiler.java @@ -39,7 +39,7 @@ public final class IntelLinux64CCompiler extends GccCompatibleCCompiler { private IntelLinux64CCompiler(boolean isLibtool, IntelLinux64CCompiler libtoolCompiler, boolean newEnvironment, Environment env) { - super("ecc", "-V", isLibtool, libtoolCompiler, newEnvironment, env); + super("ecc", "-V", false, isLibtool, libtoolCompiler, newEnvironment, env); } public Processor changeEnvironment(boolean newEnvironment, Environment env) { if (newEnvironment || env != null) { diff --git a/src/main/java/net/sf/antcontrib/cpptasks/intel/IntelLinux64Linker.java b/src/main/java/net/sf/antcontrib/cpptasks/intel/IntelLinux64Linker.java index d712e5b..c4c51bb 100644 --- a/src/main/java/net/sf/antcontrib/cpptasks/intel/IntelLinux64Linker.java +++ b/src/main/java/net/sf/antcontrib/cpptasks/intel/IntelLinux64Linker.java @@ -41,7 +41,7 @@ public final class IntelLinux64Linker extends AbstractLdLinker { private IntelLinux64Linker(String outputPrefix, String outputSuffix, boolean isLibtool, IntelLinux64Linker libtoolLinker) { super("ecc", "-V", objFiles, discardFiles, outputPrefix, outputSuffix, - isLibtool, libtoolLinker); + false, isLibtool, libtoolLinker); } public Linker getLinker(LinkType type) { if (type.isStaticLibrary()) { diff --git a/src/main/java/net/sf/antcontrib/cpptasks/mozilla/XpidlCompiler.java b/src/main/java/net/sf/antcontrib/cpptasks/mozilla/XpidlCompiler.java index 32eb9ec..d40852a 100644 --- a/src/main/java/net/sf/antcontrib/cpptasks/mozilla/XpidlCompiler.java +++ b/src/main/java/net/sf/antcontrib/cpptasks/mozilla/XpidlCompiler.java @@ -64,7 +64,7 @@ public final class XpidlCompiler private XpidlCompiler(final boolean newEnvironment, final Environment env) { super("xpidl", null, new String[] {".idl", ".xpidl"} - , new String[0], ".xpt", false, null, newEnvironment, env); + , new String[0], ".xpt", false, false, null, newEnvironment, env); } /** diff --git a/src/main/java/net/sf/antcontrib/cpptasks/openwatcom/OpenWatcomCompiler.java b/src/main/java/net/sf/antcontrib/cpptasks/openwatcom/OpenWatcomCompiler.java index 4cf2d18..9dfd4c4 100644 --- a/src/main/java/net/sf/antcontrib/cpptasks/openwatcom/OpenWatcomCompiler.java +++ b/src/main/java/net/sf/antcontrib/cpptasks/openwatcom/OpenWatcomCompiler.java @@ -51,7 +51,7 @@ public abstract class OpenWatcomCompiler final Environment env) { super(command, identifierArg, sourceExtensions, headerExtensions, ".obj", false, - null, newEnvironment, env); + false, null, newEnvironment, env); } /** diff --git a/src/main/java/net/sf/antcontrib/cpptasks/openwatcom/OpenWatcomLibrarian.java b/src/main/java/net/sf/antcontrib/cpptasks/openwatcom/OpenWatcomLibrarian.java index 848c395..b1919e8 100644 --- a/src/main/java/net/sf/antcontrib/cpptasks/openwatcom/OpenWatcomLibrarian.java +++ b/src/main/java/net/sf/antcontrib/cpptasks/openwatcom/OpenWatcomLibrarian.java @@ -52,7 +52,7 @@ public final class OpenWatcomLibrarian private OpenWatcomLibrarian() { super("wlib", null, new String[] {".obj"} , new String[0], ".lib", false, - null); + false, null); } /** diff --git a/src/main/java/net/sf/antcontrib/cpptasks/openwatcom/OpenWatcomLinker.java b/src/main/java/net/sf/antcontrib/cpptasks/openwatcom/OpenWatcomLinker.java index f0bbe3d..12928a8 100644 --- a/src/main/java/net/sf/antcontrib/cpptasks/openwatcom/OpenWatcomLinker.java +++ b/src/main/java/net/sf/antcontrib/cpptasks/openwatcom/OpenWatcomLinker.java @@ -45,7 +45,7 @@ public abstract class OpenWatcomLinker super(command, "-r", new String[] {".obj", ".lib", ".res"} , new String[] {".map", ".pdb", ".lnk"} - , outputSuffix, false, null); + , outputSuffix, false, false, null); } /** diff --git a/src/main/java/net/sf/antcontrib/cpptasks/os390/OS390CCompiler.java b/src/main/java/net/sf/antcontrib/cpptasks/os390/OS390CCompiler.java index 6b1895f..46228d5 100644 --- a/src/main/java/net/sf/antcontrib/cpptasks/os390/OS390CCompiler.java +++ b/src/main/java/net/sf/antcontrib/cpptasks/os390/OS390CCompiler.java @@ -44,8 +44,8 @@ public class OS390CCompiler extends CommandLineCCompiler { } private OS390CCompiler(boolean newEnvironment, Environment env) { super("cxx", null, new String[]{".c", ".cc", ".cpp", ".cxx", ".c++", - ".s"}, new String[]{".h", ".hpp"}, ".o", false, null, - newEnvironment, env); + ".s"}, new String[]{".h", ".hpp"}, ".o", false, false, + null, newEnvironment, env); } protected void addImpliedArgs(final Vector args, final boolean debug, diff --git a/src/main/java/net/sf/antcontrib/cpptasks/os390/OS390Linker.java b/src/main/java/net/sf/antcontrib/cpptasks/os390/OS390Linker.java index 9c4f845..a091665 100644 --- a/src/main/java/net/sf/antcontrib/cpptasks/os390/OS390Linker.java +++ b/src/main/java/net/sf/antcontrib/cpptasks/os390/OS390Linker.java @@ -52,13 +52,13 @@ public final class OS390Linker extends CommandLineLinker { CCTask task; private OS390Linker() { super("cxx", "/bogus", new String[]{".o", ".a", ".lib", ".xds"}, - new String[]{".dll", ".x"}, ".xds", false, null); + new String[]{".dll", ".x"}, ".xds", false, false, null); this.outputPrefix = ""; this.isADatasetLinker = true; } private OS390Linker(String outputPrefix, String outputSuffix) { super("cxx", "/bogus", new String[]{".o", ".a", ".lib", ".x"}, - new String[]{".dll"}, outputSuffix, false, null); + new String[]{".dll"}, outputSuffix, false, false, null); this.outputPrefix = outputPrefix; this.isADatasetLinker = false; } diff --git a/src/main/java/net/sf/antcontrib/cpptasks/os400/IccCompiler.java b/src/main/java/net/sf/antcontrib/cpptasks/os400/IccCompiler.java index 952d719..714597a 100644 --- a/src/main/java/net/sf/antcontrib/cpptasks/os400/IccCompiler.java +++ b/src/main/java/net/sf/antcontrib/cpptasks/os400/IccCompiler.java @@ -41,8 +41,8 @@ public class IccCompiler extends CommandLineCCompiler { } private IccCompiler(boolean newEnvironment, Environment env) { super("icc", null, new String[]{".c", ".cc", ".cpp", ".cxx", ".c++", - ".s"}, new String[]{".h", ".hpp"}, ".o", false, null, - newEnvironment, env); + ".s"}, new String[]{".h", ".hpp"}, ".o", false, false, + null, newEnvironment, env); } protected void addImpliedArgs(final Vector args, final boolean debug, diff --git a/src/main/java/net/sf/antcontrib/cpptasks/os400/IccLinker.java b/src/main/java/net/sf/antcontrib/cpptasks/os400/IccLinker.java index ea10bcc..f271e21 100644 --- a/src/main/java/net/sf/antcontrib/cpptasks/os400/IccLinker.java +++ b/src/main/java/net/sf/antcontrib/cpptasks/os400/IccLinker.java @@ -50,13 +50,13 @@ public final class IccLinker extends CommandLineLinker { CCTask task; private IccLinker() { super("icc", "/bogus", new String[]{".o", ".a", ".lib", ".xds"}, - new String[]{".dll", ".x"}, ".xds", false, null); + new String[]{".dll", ".x"}, ".xds", false, false, null); this.outputPrefix = ""; this.isADatasetLinker = true; } private IccLinker(String outputPrefix, String outputSuffix) { super("icc", "/bogus", new String[]{".o", ".a", ".lib", ".x"}, - new String[]{".dll"}, outputSuffix, false, null); + new String[]{".dll"}, outputSuffix, false, false, null); this.outputPrefix = outputPrefix; this.isADatasetLinker = false; } diff --git a/src/main/java/net/sf/antcontrib/cpptasks/sun/C89CCompiler.java b/src/main/java/net/sf/antcontrib/cpptasks/sun/C89CCompiler.java index 4ac8ac1..00a51ba 100644 --- a/src/main/java/net/sf/antcontrib/cpptasks/sun/C89CCompiler.java +++ b/src/main/java/net/sf/antcontrib/cpptasks/sun/C89CCompiler.java @@ -41,8 +41,8 @@ public class C89CCompiler extends CommandLineCCompiler { } private C89CCompiler(boolean newEnvironment, Environment env) { super("c89", null, new String[]{".c", ".cc", ".cpp", ".cxx", ".c++"}, - new String[]{".h", ".hpp"}, ".o", false, null, newEnvironment, - env); + new String[]{".h", ".hpp"}, ".o", false, false, null, + newEnvironment, env); } protected void addImpliedArgs( final Vector args, diff --git a/src/main/java/net/sf/antcontrib/cpptasks/sun/C89Linker.java b/src/main/java/net/sf/antcontrib/cpptasks/sun/C89Linker.java index 6c41c89..58c5396 100644 --- a/src/main/java/net/sf/antcontrib/cpptasks/sun/C89Linker.java +++ b/src/main/java/net/sf/antcontrib/cpptasks/sun/C89Linker.java @@ -41,7 +41,7 @@ public final class C89Linker extends CommandLineLinker { private String outputPrefix; private C89Linker(String outputPrefix, String outputSuffix) { super("ld", "/bogus", new String[]{".o", ".a", ".lib", ".x"}, - new String[]{}, outputSuffix, false, null); + new String[]{}, outputSuffix, false, false, null); this.outputPrefix = outputPrefix; } protected void addBase(long base, Vector args) { diff --git a/src/main/java/net/sf/antcontrib/cpptasks/sun/ForteCCCompiler.java b/src/main/java/net/sf/antcontrib/cpptasks/sun/ForteCCCompiler.java index 9422e49..7c4511e 100644 --- a/src/main/java/net/sf/antcontrib/cpptasks/sun/ForteCCCompiler.java +++ b/src/main/java/net/sf/antcontrib/cpptasks/sun/ForteCCCompiler.java @@ -50,8 +50,8 @@ public final class ForteCCCompiler extends GccCompatibleCCompiler { */ private ForteCCCompiler(String command, String[] sourceExtensions, String[] headerExtensions) { - super(command, "-V", sourceExtensions, headerExtensions, false, null, - false, null); + super(command, "-V", sourceExtensions, headerExtensions, false, false, + null, false, null); } public void addImpliedArgs(final Vector args, final boolean debug, diff --git a/src/main/java/net/sf/antcontrib/cpptasks/sun/ForteCCLinker.java b/src/main/java/net/sf/antcontrib/cpptasks/sun/ForteCCLinker.java index 47d2155..746fd97 100644 --- a/src/main/java/net/sf/antcontrib/cpptasks/sun/ForteCCLinker.java +++ b/src/main/java/net/sf/antcontrib/cpptasks/sun/ForteCCLinker.java @@ -44,7 +44,7 @@ public final class ForteCCLinker extends AbstractLdLinker { private ForteCCLinker(String command, String[] extensions, String[] ignoredExtensions, String outputPrefix, String outputSuffix) { super(command, "-V", extensions, ignoredExtensions, outputPrefix, - outputSuffix, false, null); + outputSuffix, false, false, null); } public void addImpliedArgs(boolean debug, LinkType linkType, Vector args) { if (debug) { diff --git a/src/main/java/net/sf/antcontrib/cpptasks/ti/ClxxCCompiler.java b/src/main/java/net/sf/antcontrib/cpptasks/ti/ClxxCCompiler.java index c844ac4..dcdf346 100644 --- a/src/main/java/net/sf/antcontrib/cpptasks/ti/ClxxCCompiler.java +++ b/src/main/java/net/sf/antcontrib/cpptasks/ti/ClxxCCompiler.java @@ -71,7 +71,7 @@ public class ClxxCCompiler extends CommandLineCCompiler { private ClxxCCompiler(String command, boolean newEnvironment, Environment env) { super(command, "-h", sourceExtensions, headerExtensions, ".o", false, - null, newEnvironment, env); + false, null, newEnvironment, env); } /* * (non-Javadoc) diff --git a/src/main/java/net/sf/antcontrib/cpptasks/ti/ClxxLibrarian.java b/src/main/java/net/sf/antcontrib/cpptasks/ti/ClxxLibrarian.java index c48815a..a2af623 100644 --- a/src/main/java/net/sf/antcontrib/cpptasks/ti/ClxxLibrarian.java +++ b/src/main/java/net/sf/antcontrib/cpptasks/ti/ClxxLibrarian.java @@ -40,7 +40,7 @@ public class ClxxLibrarian extends CommandLineLinker { } private ClxxLibrarian(String command) { super(command, null, new String[]{".o"}, new String[0], ".lib", false, - null); + false, null); } /* * (non-Javadoc) diff --git a/src/main/java/net/sf/antcontrib/cpptasks/ti/ClxxLinker.java b/src/main/java/net/sf/antcontrib/cpptasks/ti/ClxxLinker.java index bb644a4..b6ddb92 100644 --- a/src/main/java/net/sf/antcontrib/cpptasks/ti/ClxxLinker.java +++ b/src/main/java/net/sf/antcontrib/cpptasks/ti/ClxxLinker.java @@ -52,7 +52,7 @@ public class ClxxLinker extends CommandLineLinker { } private ClxxLinker(String command, String outputSuffix) { super(command, "-h", new String[]{".o", ".lib", ".res"}, new String[]{ - ".map", ".pdb", ".lnk"}, outputSuffix, false, null); + ".map", ".pdb", ".lnk"}, outputSuffix, false, false, null); } /* * (non-Javadoc) diff --git a/src/main/java/net/sf/antcontrib/cpptasks/trolltech/MetaObjectCompiler.java b/src/main/java/net/sf/antcontrib/cpptasks/trolltech/MetaObjectCompiler.java index 25651da..c784713 100644 --- a/src/main/java/net/sf/antcontrib/cpptasks/trolltech/MetaObjectCompiler.java +++ b/src/main/java/net/sf/antcontrib/cpptasks/trolltech/MetaObjectCompiler.java @@ -64,7 +64,7 @@ public final class MetaObjectCompiler private MetaObjectCompiler(final boolean newEnvironment, final Environment env) { super("moc", "-version", new String[] {".h", ".cpp"} - , new String[0], ".moc", false, null, newEnvironment, env); + , new String[0], ".moc", false, false, null, newEnvironment, env); } /** diff --git a/src/main/java/net/sf/antcontrib/cpptasks/trolltech/UserInterfaceCompiler.java b/src/main/java/net/sf/antcontrib/cpptasks/trolltech/UserInterfaceCompiler.java index cc4cf3b..09e08c2 100644 --- a/src/main/java/net/sf/antcontrib/cpptasks/trolltech/UserInterfaceCompiler.java +++ b/src/main/java/net/sf/antcontrib/cpptasks/trolltech/UserInterfaceCompiler.java @@ -64,7 +64,7 @@ public final class UserInterfaceCompiler private UserInterfaceCompiler(final boolean newEnvironment, final Environment env) { super("uic", "-version", new String[] {".ui"} - , new String[0], ".h", false, null, newEnvironment, env); + , new String[0], ".h", false, false, null, newEnvironment, env); } /** |