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