]> git.proxmox.com Git - mirror_edk2.git/blob - Tools/Source/Cpptasks/net/sf/antcontrib/cpptasks/gcc/LdLinker.java
Initial import.
[mirror_edk2.git] / Tools / Source / Cpptasks / net / sf / antcontrib / cpptasks / gcc / 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;
18 import java.io.File;
19
20 import net.sf.antcontrib.cpptasks.compiler.LinkType;
21 import net.sf.antcontrib.cpptasks.compiler.Linker;
22 /**
23 * Adapter for the 'ld' linker
24 *
25 * @author Curt Arnold
26 */
27 public final class LdLinker extends AbstractLdLinker {
28 private static final String[] discardFiles = new String[0];
29 private static final String[] objFiles = new String[]{".o", ".a", ".lib",
30 ".dll", ".so", ".sl"};
31 private static final LdLinker dllLinker = new LdLinker("ld", objFiles,
32 discardFiles, "lib", ".so", false, new LdLinker("ld", objFiles,
33 discardFiles, "lib", ".so", true, null));
34 private static final LdLinker instance = new LdLinker("ld", objFiles,
35 discardFiles, "", "", false, null);
36 private static final String[] libtoolObjFiles = new String[]{".fo", ".a",
37 ".lib", ".dll", ".so", ".sl"};
38 public static LdLinker getInstance() {
39 return instance;
40 }
41 private File[] libDirs;
42 private LdLinker(String command, String[] extensions,
43 String[] ignoredExtensions, String outputPrefix,
44 String outputSuffix, boolean isLibtool, LdLinker libtoolLinker) {
45 super(command, "-version", extensions, ignoredExtensions, outputPrefix,
46 outputSuffix, isLibtool, libtoolLinker);
47 }
48 public Linker getLinker(LinkType type) {
49 if (type.isStaticLibrary()) {
50 return GccLibrarian.getInstance();
51 }
52 if (type.isSharedLibrary()) {
53 return dllLinker;
54 }
55 return instance;
56 }
57 }