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
.ti
;
19 import java
.util
.Vector
;
21 import net
.sf
.antcontrib
.cpptasks
.compiler
.CommandLineLinker
;
22 import net
.sf
.antcontrib
.cpptasks
.compiler
.LinkType
;
23 import net
.sf
.antcontrib
.cpptasks
.compiler
.Linker
;
24 import net
.sf
.antcontrib
.cpptasks
.types
.LibraryTypeEnum
;
27 * Adapter for TI DSP linkers
32 public class ClxxLinker
extends CommandLineLinker
{
33 private static final ClxxLinker cl55DllInstance
= new ClxxLinker("lnk55",
35 private static final ClxxLinker cl55Instance
= new ClxxLinker("lnk55",
37 private static final ClxxLinker cl6xDllInstance
= new ClxxLinker("lnk6x",
39 private static final ClxxLinker cl6xInstance
= new ClxxLinker("lnk6x",
41 public static ClxxLinker
getCl55DllInstance() {
42 return cl55DllInstance
;
44 public static ClxxLinker
getCl55Instance() {
47 public static ClxxLinker
getCl6xDllInstance() {
48 return cl6xDllInstance
;
50 public static ClxxLinker
getCl6xInstance() {
53 private ClxxLinker(String command
, String outputSuffix
) {
54 super(command
, "-h", new String
[]{".o", ".lib", ".res"}, new String
[]{
55 ".map", ".pdb", ".lnk"}, outputSuffix
, false, null);
60 * @see net.sf.antcontrib.cpptasks.compiler.CommandLineLinker#addBase(long,
63 protected void addBase(long base
, Vector args
) {
68 * @see net.sf.antcontrib.cpptasks.compiler.CommandLineLinker#addFixed(java.lang.Boolean,
71 protected void addFixed(Boolean fixed
, Vector args
) {
76 * @see net.sf.antcontrib.cpptasks.compiler.CommandLineLinker#addImpliedArgs(boolean,
77 * net.sf.antcontrib.cpptasks.compiler.LinkType, java.util.Vector)
79 protected void addImpliedArgs(boolean debug
, LinkType linkType
, Vector args
, Boolean defaultflag
) {
80 if (linkType
.isSharedLibrary()) {
81 args
.addElement("-abs");
87 * @see net.sf.antcontrib.cpptasks.compiler.CommandLineLinker#addIncremental(boolean,
90 protected void addIncremental(boolean incremental
, Vector args
) {
95 * @see net.sf.antcontrib.cpptasks.compiler.CommandLineLinker#addMap(boolean,
98 protected void addMap(boolean map
, Vector args
) {
100 args
.addElement("-m");
106 * @see net.sf.antcontrib.cpptasks.compiler.CommandLineLinker#addStack(int,
109 protected void addStack(int stack
, Vector args
) {
112 * @see net.sf.antcontrib.cpptasks.compiler.CommandLineLinker#addEntry(int, java.util.Vector)
114 protected void addEntry(String entry
, Vector args
) {
120 * @see net.sf.antcontrib.cpptasks.compiler.CommandLineLinker#getCommandFileSwitch(java.lang.String)
122 protected String
getCommandFileSwitch(String commandFile
) {
123 return "@" + commandFile
;
128 * @see net.sf.antcontrib.cpptasks.compiler.Linker#getLibraryPath()
130 public File
[] getLibraryPath() {
136 * @see net.sf.antcontrib.cpptasks.compiler.Linker#getLibraryPatterns(java.lang.String[])
138 public String
[] getLibraryPatterns(String
[] libnames
, LibraryTypeEnum libType
) {
140 // TODO: Looks bogus, should be .a or .so's not .o's
142 String
[] libpats
= new String
[libnames
.length
];
143 for (int i
= 0; i
< libnames
.length
; i
++) {
144 libpats
[i
] = libnames
[i
] + ".o";
151 * @see net.sf.antcontrib.cpptasks.compiler.Processor#getLinker(net.sf.antcontrib.cpptasks.compiler.LinkType)
153 public Linker
getLinker(LinkType linkType
) {
159 * @see net.sf.antcontrib.cpptasks.compiler.CommandLineLinker#getMaximumCommandLength()
161 protected int getMaximumCommandLength() {
167 * @see net.sf.antcontrib.cpptasks.compiler.CommandLineLinker#getOutputFileSwitch(java.lang.String)
169 protected String
[] getOutputFileSwitch(String outputFile
) {
170 return new String
[]{"-o", outputFile
};
175 * @see net.sf.antcontrib.cpptasks.compiler.Linker#isCaseSensitive()
177 public boolean isCaseSensitive() {
178 // TODO Auto-generated method stub