Class CommandLineLinker
java.lang.Object
net.sf.antcontrib.cpptasks.compiler.AbstractProcessor
net.sf.antcontrib.cpptasks.compiler.AbstractLinker
net.sf.antcontrib.cpptasks.compiler.CommandLineLinker
- Direct Known Subclasses:
AbstractArLibrarian
,AbstractLdLinker
,ADSLibrarian
,ADSLinker
,BorlandLibrarian
,BorlandLinker
,C89Linker
,ClxxLibrarian
,ClxxLinker
,CompaqVisualFortranLibrarian
,DevStudioCompatibleLibrarian
,DevStudioCompatibleLinker
,IccLinker
,OpenWatcomLibrarian
,OpenWatcomLinker
,OS390Linker
An abstract Linker implementation that performs the link via an external
command.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate String
private org.apache.tools.ant.types.Environment
private String
private String
private boolean
private String[]
private CommandLineLinker
private boolean
private String
Fields inherited from class net.sf.antcontrib.cpptasks.compiler.AbstractProcessor
DEFAULT_DISCARD_BID, DEFAULT_PROCESS_BID
-
Constructor Summary
ConstructorsConstructorDescriptionCommandLineLinker
(String command, String identifierArg, String[] extensions, String[] ignoredExtensions, String outputSuffix, boolean isLibtool, CommandLineLinker libtoolLinker) Creates a comand line linker invocation -
Method Summary
Modifier and TypeMethodDescriptionprotected abstract void
protected abstract void
protected abstract void
protected abstract void
addImpliedArgs
(boolean debug, LinkType linkType, Vector args) protected abstract void
addIncremental
(boolean incremental, Vector args) protected String[]
addLibrarySets
(CCTask task, LibrarySet[] libsets, Vector preargs, Vector midargs, Vector endargs) protected abstract void
protected abstract void
protected LinkerConfiguration
createConfiguration
(CCTask task, LinkType linkType, ProcessorDef[] baseDefs, LinkerDef specificDef, TargetDef targetPlatform, VersionInfo versionInfo) protected String
decorateLinkerOption
(StringBuffer buf, String arg) Allows drived linker to decorate linker option.protected final String
protected abstract String
getCommandFileSwitch
(String commandFile) Retrieve an identifier that identifies the specific version of the compiler.final CommandLineLinker
protected abstract int
String[]
getOutputFileNames
(String baseName, VersionInfo versionInfo) Output file name (no path components) corresponding to source fileprotected abstract String[]
getOutputFileSwitch
(String outputFile) protected String[]
getOutputFileSwitch
(CCTask task, String outputFile) protected String
getStartupObject
(LinkType linkType) void
link
(CCTask task, File outputFile, String[] sourceFiles, CommandLineLinkerConfiguration config) Performs a link using a command line linkerprotected String[]
prepareArguments
(CCTask task, String outputDir, String outputFile, String[] sourceFiles, CommandLineLinkerConfiguration config) Prepares argument list for exec command.protected String
prepareFilename
(StringBuffer buf, String outputDir, String sourceFile) Processes filename into argument formprotected String[]
prepareResponseFile
(File outputFile, String[] args) Prepares argument list to execute the linker using a response file.protected String
quoteFilename
(StringBuffer buf, String filename) protected int
runCommand
(CCTask task, File workingDir, String[] cmdline) This method is exposed so test classes can overload and test the arguments without actually spawning the compilerprotected final void
setCommand
(String command) Methods inherited from class net.sf.antcontrib.cpptasks.compiler.AbstractLinker
addVersionFiles, bid, changeEnvironment, createConfiguration, getLibraryKey
Methods inherited from class net.sf.antcontrib.cpptasks.compiler.AbstractProcessor
clone, getHeaderExtensions, getIdentifier, getOSArch, getOSName, getSourceExtensions, isDarwin, toString
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface net.sf.antcontrib.cpptasks.compiler.Linker
getLibraryPath, getLibraryPatterns, getLinker, isCaseSensitive
-
Field Details
-
command
-
env
private org.apache.tools.ant.types.Environment env -
identifier
-
identifierArg
-
isLibtool
private boolean isLibtool -
librarySets
-
libtoolLinker
-
newEnvironment
private boolean newEnvironment -
outputSuffix
-
-
Constructor Details
-
Method Details
-
addBase
-
addFixed
-
addImpliedArgs
-
addIncremental
-
addLibrarySets
-
addMap
-
addStack
-
addEntry
-
createConfiguration
protected LinkerConfiguration createConfiguration(CCTask task, LinkType linkType, ProcessorDef[] baseDefs, LinkerDef specificDef, TargetDef targetPlatform, VersionInfo versionInfo) - Specified by:
createConfiguration
in classAbstractLinker
-
decorateLinkerOption
Allows drived linker to decorate linker option. Override by GccLinker to prepend a "-Wl," to pass option to through gcc to linker.- Parameters:
buf
- buffer that may be used and abused in the decoration process, must not be null.arg
- linker argument
-
getCommand
-
getCommandFileSwitch
-
getIdentifier
Description copied from interface:Processor
Retrieve an identifier that identifies the specific version of the compiler. Compilers with the same identifier should produce the same output files for the same input files and command line switches.- Specified by:
getIdentifier
in interfaceProcessor
- Specified by:
getIdentifier
in classAbstractProcessor
-
getLibtoolLinker
-
getMaximumCommandLength
protected abstract int getMaximumCommandLength() -
getOutputFileNames
Description copied from interface:Processor
Output file name (no path components) corresponding to source file- Specified by:
getOutputFileNames
in interfaceProcessor
- Specified by:
getOutputFileNames
in classAbstractLinker
- Parameters:
baseName
- input file- Returns:
- output file name or null if no output file or name not determined by input file
-
getOutputFileSwitch
-
getOutputFileSwitch
-
getStartupObject
-
link
public void link(CCTask task, File outputFile, String[] sourceFiles, CommandLineLinkerConfiguration config) throws org.apache.tools.ant.BuildException Performs a link using a command line linker- Throws:
org.apache.tools.ant.BuildException
-
prepareArguments
protected String[] prepareArguments(CCTask task, String outputDir, String outputFile, String[] sourceFiles, CommandLineLinkerConfiguration config) Prepares argument list for exec command. Will return null if command line would exceed allowable command line buffer.- Parameters:
task
- compilation task.outputFile
- linker output filesourceFiles
- linker input files (.obj, .o, .res)config
- linker configuration- Returns:
- arguments for runTask
-
prepareFilename
Processes filename into argument form -
prepareResponseFile
Prepares argument list to execute the linker using a response file.- Parameters:
outputFile
- linker output fileargs
- output of prepareArguments- Returns:
- arguments for runTask
- Throws:
IOException
-
quoteFilename
-
runCommand
protected int runCommand(CCTask task, File workingDir, String[] cmdline) throws org.apache.tools.ant.BuildException This method is exposed so test classes can overload and test the arguments without actually spawning the compiler- Throws:
org.apache.tools.ant.BuildException
-
setCommand
-