]> git.proxmox.com Git - mirror_edk2.git/blob - Tools/Source/Cpptasks/net/sf/antcontrib/cpptasks/compiler/CommandLineLinkerConfiguration.java
Changed spelling to manifest
[mirror_edk2.git] / Tools / Source / Cpptasks / net / sf / antcontrib / cpptasks / compiler / CommandLineLinkerConfiguration.java
1 /*
2 *
3 * Copyright 2002-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.compiler;
18 import net.sf.antcontrib.cpptasks.CCTask;
19 import net.sf.antcontrib.cpptasks.LinkerParam;
20 import net.sf.antcontrib.cpptasks.ProcessorParam;
21 import net.sf.antcontrib.cpptasks.TargetInfo;
22
23 import org.apache.tools.ant.BuildException;
24 /**
25 * A configuration for a command line linker
26 *
27 * @author Curt Arnold
28 */
29 public final class CommandLineLinkerConfiguration
30 implements
31 LinkerConfiguration {
32 private/* final */String[][] args;
33 private/* final */String identifier;
34 private String[] libraryNames;
35 private/* final */CommandLineLinker linker;
36 private/* final */boolean map;
37 private/* final */ProcessorParam[] params;
38 private/* final */boolean rebuild;
39 private String startupObject;
40 public CommandLineLinkerConfiguration(CommandLineLinker linker,
41 String identifier, String[][] args, ProcessorParam[] params,
42 boolean rebuild, boolean map, String[] libraryNames,
43 String startupObject) {
44 if (linker == null) {
45 throw new NullPointerException("linker");
46 }
47 if (args == null) {
48 throw new NullPointerException("args");
49 } else {
50 this.args = (String[][]) args.clone();
51 }
52 this.linker = linker;
53 this.params = (ProcessorParam[]) params.clone();
54 this.rebuild = rebuild;
55 this.identifier = identifier;
56 this.map = map;
57 if (libraryNames == null) {
58 this.libraryNames = new String[0];
59 } else {
60 this.libraryNames = (String[]) libraryNames.clone();
61 }
62 this.startupObject = startupObject;
63 }
64 public int bid(String filename) {
65 return linker.bid(filename);
66 }
67 public String[] getEndArguments() {
68 String[] clone = (String[]) args[1].clone();
69 return clone;
70 }
71 /**
72 * Returns a string representation of this configuration. Should be
73 * canonical so that equivalent configurations will have equivalent string
74 * representations
75 */
76 public String getIdentifier() {
77 return identifier;
78 }
79 public String[] getLibraryNames() {
80 String[] clone = (String[]) libraryNames.clone();
81 return clone;
82 }
83 public boolean getMap() {
84 return map;
85 }
86 public String getOutputFileName(String inputFile) {
87 return linker.getOutputFileName(inputFile);
88 }
89 public LinkerParam getParam(String name) {
90 for (int i = 0; i < params.length; i++) {
91 if (name.equals(params[i].getName()))
92 return (LinkerParam) params[i];
93 }
94 return null;
95 }
96 public ProcessorParam[] getParams() {
97 return params;
98 }
99 public String[] getPreArguments() {
100 String[] clone = (String[]) args[0].clone();
101 return clone;
102 }
103 public boolean getRebuild() {
104 return rebuild;
105 }
106 public String getStartupObject() {
107 return startupObject;
108 }
109 public void link(CCTask task, TargetInfo linkTarget) throws BuildException {
110 //
111 // AllSourcePath's include any syslibsets
112 //
113 String[] sourcePaths = linkTarget.getAllSourcePaths();
114 linker.link(task, linkTarget.getOutput(), sourcePaths, this);
115 }
116 public String toString() {
117 return identifier;
118 }
119 }