]> git.proxmox.com Git - mirror_edk2.git/blame - Tools/Source/Cpptasks/net/sf/antcontrib/cpptasks/hp/aCCLinker.java
Changed spelling to manifest
[mirror_edk2.git] / Tools / Source / Cpptasks / net / sf / antcontrib / cpptasks / hp / aCCLinker.java
CommitLineData
878ddf1f 1/*\r
2 * \r
3 * Copyright 2001-2004 The Ant-Contrib project\r
4 *\r
5 * Licensed under the Apache License, Version 2.0 (the "License");\r
6 * you may not use this file except in compliance with the License.\r
7 * You may obtain a copy of the License at\r
8 *\r
9 * http://www.apache.org/licenses/LICENSE-2.0\r
10 *\r
11 * Unless required by applicable law or agreed to in writing, software\r
12 * distributed under the License is distributed on an "AS IS" BASIS,\r
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
14 * See the License for the specific language governing permissions and\r
15 * limitations under the License.\r
16 */\r
17package net.sf.antcontrib.cpptasks.hp;\r
18import java.io.File;\r
19import java.util.Vector;\r
20\r
21import net.sf.antcontrib.cpptasks.CUtil;\r
22import net.sf.antcontrib.cpptasks.compiler.LinkType;\r
23import net.sf.antcontrib.cpptasks.compiler.Linker;\r
24import net.sf.antcontrib.cpptasks.gcc.AbstractLdLinker;\r
25/**\r
26 * Adapter for Sun (r) Forte(tm) C++ Linker\r
27 * \r
28 * @author Curt Arnold\r
29 */\r
30public final class aCCLinker extends AbstractLdLinker {\r
31 private static final String[] discardFiles = new String[0];\r
32 private static final String[] objFiles = new String[]{".o", ".a", ".lib",\r
33 ".dll", ".so", ".sl"};\r
34 private static final aCCLinker arLinker = new aCCLinker("aCC", objFiles,\r
35 discardFiles, "", ".a");\r
36 private static final aCCLinker dllLinker = new aCCLinker("aCC", objFiles,\r
37 discardFiles, "lib", ".sl");\r
38 private static final aCCLinker instance = new aCCLinker("aCC", objFiles,\r
39 discardFiles, "", "");\r
40 public static aCCLinker getInstance() {\r
41 return instance;\r
42 }\r
43 private File[] libDirs;\r
44 private aCCLinker(String command, String[] extensions,\r
45 String[] ignoredExtensions, String outputPrefix, String outputSuffix) {\r
46 super(command, "-help", extensions, ignoredExtensions, outputPrefix,\r
47 outputSuffix, false, null);\r
48 }\r
49 public void addImpliedArgs(boolean debug, LinkType linkType, Vector args) {\r
50 if (debug) {\r
51 args.addElement("-g");\r
52 }\r
53 /*\r
54 * if(linkType.isStaticRuntime()) { args.addElement("-static"); }\r
55 */\r
56 if (linkType.isSharedLibrary()) {\r
57 args.addElement("-b");\r
58 }\r
59 /*\r
60 * if (linkType.isStaticLibrary()) { args.addElement("-Wl,-noshared"); }\r
61 */\r
62 }\r
63 public void addIncremental(boolean incremental, Vector args) {\r
64 /*\r
65 * if (incremental) { args.addElement("-xidlon"); } else {\r
66 * args.addElement("-xidloff"); }\r
67 */\r
68 }\r
69 /**\r
70 * Returns library path.\r
71 * \r
72 */\r
73 public File[] getLibraryPath() {\r
74 if (libDirs == null) {\r
75 File CCloc = CUtil.getExecutableLocation("aCC");\r
76 if (CCloc != null) {\r
77 File compilerLib = new File(new File(CCloc, "../lib")\r
78 .getAbsolutePath());\r
79 if (compilerLib.exists()) {\r
80 libDirs = new File[2];\r
81 libDirs[0] = compilerLib;\r
82 }\r
83 }\r
84 if (libDirs == null) {\r
85 libDirs = new File[1];\r
86 }\r
87 }\r
88 libDirs[libDirs.length - 1] = new File("/usr/lib");\r
89 return libDirs;\r
90 }\r
91 public Linker getLinker(LinkType type) {\r
92 if (type.isStaticLibrary()) {\r
93 return arLinker;\r
94 }\r
95 if (type.isSharedLibrary()) {\r
96 return dllLinker;\r
97 }\r
98 return instance;\r
99 }\r
100}\r