]> git.proxmox.com Git - mirror_edk2.git/blob - Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/gcc/AbstractArLibrarian.java
Restructuring for better separation of Tool packages.
[mirror_edk2.git] / Tools / Java / Source / Cpptasks / net / sf / antcontrib / cpptasks / gcc / AbstractArLibrarian.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 import java.util.Vector;
20
21 import net.sf.antcontrib.cpptasks.CCTask;
22 import net.sf.antcontrib.cpptasks.compiler.CommandLineLinker;
23 import net.sf.antcontrib.cpptasks.compiler.CommandLineLinkerConfiguration;
24 import net.sf.antcontrib.cpptasks.compiler.LinkType;
25 import net.sf.antcontrib.cpptasks.types.LibraryTypeEnum;
26
27 import org.apache.tools.ant.BuildException;
28 /**
29 * Adapter for the "ar" tool
30 *
31 * @author Adam Murdoch
32 * @author Curt Arnold
33 */
34 public abstract class AbstractArLibrarian extends CommandLineLinker {
35 private/* final */
36 String outputPrefix;
37 private static String[] defaultflags = new String[]{};
38 protected AbstractArLibrarian(String command, String identificationArg,
39 String[] inputExtensions, String[] ignoredExtensions,
40 String outputPrefix, String outputExtension, boolean isLibtool,
41 AbstractArLibrarian libtoolLibrarian) {
42 super(command, identificationArg, inputExtensions, ignoredExtensions,
43 outputExtension, isLibtool, libtoolLibrarian);
44 this.outputPrefix = outputPrefix;
45 }
46 public void addBase(long base, Vector args) {
47 }
48 public void addFixed(Boolean fixed, Vector args) {
49 }
50 public void addImpliedArgs(boolean debug, LinkType linkType, Vector args, Boolean defaultflag) {
51 if(defaultflag != null && defaultflag.booleanValue()){
52 for (int i = 0; i < defaultflags.length; i++) {
53 args.addElement(defaultflags[i]);
54 }
55 }
56 }
57 public void addIncremental(boolean incremental, Vector args) {
58 }
59 public void addMap(boolean map, Vector args) {
60 }
61 public void addStack(int stack, Vector args) {
62 }
63 /* (non-Javadoc)
64 * @see net.sf.antcontrib.cpptasks.compiler.CommandLineLinker#addEntry(int, java.util.Vector)
65 */
66 protected void addEntry(String entry, Vector args) {
67 }
68
69 public String getCommandFileSwitch(String commandFile) {
70 return null;
71 }
72 public File[] getLibraryPath() {
73 return new File[0];
74 }
75 public String[] getLibraryPatterns(String[] libnames, LibraryTypeEnum libType) {
76 return new String[0];
77 }
78 public int getMaximumCommandLength() {
79 return Integer.MAX_VALUE;
80 }
81 public String getOutputFileName(String baseName) {
82 return outputPrefix + super.getOutputFileName(baseName);
83 }
84 public String[] getOutputFileSwitch(String outputFile) {
85 return GccProcessor.getOutputFileSwitch("rvs", outputFile);
86 }
87 public boolean isCaseSensitive() {
88 return true;
89 }
90 public void link(CCTask task, File outputFile, String[] sourceFiles,
91 CommandLineLinkerConfiguration config) throws BuildException {
92 //
93 // if there is an existing library then
94 // we must delete it before executing "ar"
95 if (outputFile.exists()) {
96 if (!outputFile.delete()) {
97 throw new BuildException("Unable to delete "
98 + outputFile.getAbsolutePath());
99 }
100 }
101 //
102 // delegate to CommandLineLinker
103 //
104 super.link(task, outputFile, sourceFiles, config);
105 }
106 }