--- /dev/null
+/*\r
+ * \r
+ * Copyright 2001-2004 The Ant-Contrib project\r
+ *\r
+ * Licensed under the Apache License, Version 2.0 (the "License");\r
+ * you may not use this file except in compliance with the License.\r
+ * You may obtain a copy of the License at\r
+ *\r
+ * http://www.apache.org/licenses/LICENSE-2.0\r
+ *\r
+ * Unless required by applicable law or agreed to in writing, software\r
+ * distributed under the License is distributed on an "AS IS" BASIS,\r
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ * See the License for the specific language governing permissions and\r
+ * limitations under the License.\r
+ */\r
+package net.sf.antcontrib.cpptasks.gcc.cross.sparc_sun_solaris2;\r
+import java.io.File;\r
+\r
+import net.sf.antcontrib.cpptasks.compiler.LinkType;\r
+import net.sf.antcontrib.cpptasks.compiler.Linker;\r
+import net.sf.antcontrib.cpptasks.gcc.AbstractLdLinker;\r
+/**\r
+ * Adapter for the 'ld' linker\r
+ * \r
+ * @author Curt Arnold\r
+ */\r
+public final class LdLinker extends AbstractLdLinker {\r
+ private static final String[] discardFiles = new String[0];\r
+ private static final String[] libtoolObjFiles = new String[]{".fo", ".a",\r
+ ".lib", ".dll", ".so", ".sl"};\r
+ private static final String[] objFiles = new String[]{".o", ".a", ".lib",\r
+ ".dll", ".so", ".sl"};\r
+ private static final LdLinker dllLinker = new LdLinker(\r
+ GccCCompiler.CMD_PREFIX + "ld", objFiles, discardFiles, "lib",\r
+ ".so", false, new LdLinker(GccCCompiler.CMD_PREFIX + "ld",\r
+ objFiles, discardFiles, "lib", ".so", true, null));\r
+ private static final LdLinker instance = new LdLinker(\r
+ GccCCompiler.CMD_PREFIX + "ld", objFiles, discardFiles, "", "",\r
+ false, null);\r
+ public static LdLinker getInstance() {\r
+ return instance;\r
+ }\r
+ private File[] libDirs;\r
+ private LdLinker(String command, String[] extensions,\r
+ String[] ignoredExtensions, String outputPrefix,\r
+ String outputSuffix, boolean isLibtool, LdLinker libtoolLinker) {\r
+ super(command, "-version", extensions, ignoredExtensions, outputPrefix,\r
+ outputSuffix, isLibtool, libtoolLinker);\r
+ }\r
+ public Linker getLinker(LinkType type) {\r
+ if (type.isStaticLibrary()) {\r
+ return GccLibrarian.getInstance();\r
+ }\r
+ if (type.isSharedLibrary()) {\r
+ return dllLinker;\r
+ }\r
+ return instance;\r
+ }\r
+}\r