]>
git.proxmox.com Git - mirror_edk2.git/blob - Tools/Source/Cpptasks/net/sf/antcontrib/cpptasks/hp/aCCLinker.java
3 * Copyright 2001-2004 The Ant-Contrib project
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
9 * http://www.apache.org/licenses/LICENSE-2.0
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.
17 package net
.sf
.antcontrib
.cpptasks
.hp
;
19 import java
.util
.Vector
;
21 import net
.sf
.antcontrib
.cpptasks
.CUtil
;
22 import net
.sf
.antcontrib
.cpptasks
.compiler
.LinkType
;
23 import net
.sf
.antcontrib
.cpptasks
.compiler
.Linker
;
24 import net
.sf
.antcontrib
.cpptasks
.gcc
.AbstractLdLinker
;
26 * Adapter for Sun (r) Forte(tm) C++ Linker
30 public final class aCCLinker
extends AbstractLdLinker
{
31 private static final String
[] discardFiles
= new String
[0];
32 private static final String
[] objFiles
= new String
[]{".o", ".a", ".lib",
33 ".dll", ".so", ".sl"};
34 private static final aCCLinker arLinker
= new aCCLinker("aCC", objFiles
,
35 discardFiles
, "", ".a");
36 private static final aCCLinker dllLinker
= new aCCLinker("aCC", objFiles
,
37 discardFiles
, "lib", ".sl");
38 private static final aCCLinker instance
= new aCCLinker("aCC", objFiles
,
39 discardFiles
, "", "");
40 public static aCCLinker
getInstance() {
43 private File
[] libDirs
;
44 private aCCLinker(String command
, String
[] extensions
,
45 String
[] ignoredExtensions
, String outputPrefix
, String outputSuffix
) {
46 super(command
, "-help", extensions
, ignoredExtensions
, outputPrefix
,
47 outputSuffix
, false, null);
49 public void addImpliedArgs(boolean debug
, LinkType linkType
, Vector args
) {
51 args
.addElement("-g");
54 * if(linkType.isStaticRuntime()) { args.addElement("-static"); }
56 if (linkType
.isSharedLibrary()) {
57 args
.addElement("-b");
60 * if (linkType.isStaticLibrary()) { args.addElement("-Wl,-noshared"); }
63 public void addIncremental(boolean incremental
, Vector args
) {
65 * if (incremental) { args.addElement("-xidlon"); } else {
66 * args.addElement("-xidloff"); }
70 * Returns library path.
73 public File
[] getLibraryPath() {
74 if (libDirs
== null) {
75 File CCloc
= CUtil
.getExecutableLocation("aCC");
77 File compilerLib
= new File(new File(CCloc
, "../lib")
79 if (compilerLib
.exists()) {
80 libDirs
= new File
[2];
81 libDirs
[0] = compilerLib
;
84 if (libDirs
== null) {
85 libDirs
= new File
[1];
88 libDirs
[libDirs
.length
- 1] = new File("/usr/lib");
91 public Linker
getLinker(LinkType type
) {
92 if (type
.isStaticLibrary()) {
95 if (type
.isSharedLibrary()) {