]> git.proxmox.com Git - mirror_edk2.git/blob - Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/gcc/cross/sparc_sun_solaris2/LdLinker.java
Restructuring for better separation of Tool packages.
[mirror_edk2.git] / Tools / Java / Source / Cpptasks / net / sf / antcontrib / cpptasks / gcc / cross / sparc_sun_solaris2 / LdLinker.java
1 /*
2 *
3 * Copyright 2001-2004 The Ant-Contrib project
4 *
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 */
17 package net.sf.antcontrib.cpptasks.gcc.cross.sparc_sun_solaris2;
18 import java.io.File;
19
20 import net.sf.antcontrib.cpptasks.compiler.LinkType;
21 import net.sf.antcontrib.cpptasks.compiler.Linker;
22 import net.sf.antcontrib.cpptasks.gcc.AbstractLdLinker;
23 /**
24 * Adapter for the 'ld' linker
25 *
26 * @author Curt Arnold
27 */
28 public final class LdLinker extends AbstractLdLinker {
29 private static final String[] discardFiles = new String[0];
30 private static final String[] libtoolObjFiles = new String[]{".fo", ".a",
31 ".lib", ".dll", ".so", ".sl"};
32 private static final String[] objFiles = new String[]{".o", ".a", ".lib",
33 ".dll", ".so", ".sl"};
34 private static final LdLinker dllLinker = new LdLinker(
35 GccCCompiler.CMD_PREFIX + "ld", objFiles, discardFiles, "lib",
36 ".so", false, new LdLinker(GccCCompiler.CMD_PREFIX + "ld",
37 objFiles, discardFiles, "lib", ".so", true, null));
38 private static final LdLinker instance = new LdLinker(
39 GccCCompiler.CMD_PREFIX + "ld", objFiles, discardFiles, "", "",
40 false, null);
41 public static LdLinker getInstance() {
42 return instance;
43 }
44 private File[] libDirs;
45 private LdLinker(String command, String[] extensions,
46 String[] ignoredExtensions, String outputPrefix,
47 String outputSuffix, boolean isLibtool, LdLinker libtoolLinker) {
48 super(command, "-version", extensions, ignoredExtensions, outputPrefix,
49 outputSuffix, isLibtool, libtoolLinker);
50 }
51 public Linker getLinker(LinkType type) {
52 if (type.isStaticLibrary()) {
53 return GccLibrarian.getInstance();
54 }
55 if (type.isSharedLibrary()) {
56 return dllLinker;
57 }
58 return instance;
59 }
60 }