]> git.proxmox.com Git - mirror_edk2.git/blob - Tools/Source/Cpptasks/net/sf/antcontrib/cpptasks/compiler/AbstractLinker.java
Changed spelling to manifest
[mirror_edk2.git] / Tools / Source / Cpptasks / net / sf / antcontrib / cpptasks / compiler / AbstractLinker.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.compiler;
18 import java.io.File;
19
20 import net.sf.antcontrib.cpptasks.CCTask;
21 import net.sf.antcontrib.cpptasks.LinkerDef;
22 import net.sf.antcontrib.cpptasks.ProcessorDef;
23 import net.sf.antcontrib.cpptasks.TargetDef;
24
25
26 import org.apache.tools.ant.types.Environment;
27 /**
28 * An abstract Linker implementation.
29 *
30 * @author Adam Murdoch
31 */
32 public abstract class AbstractLinker extends AbstractProcessor
33 implements
34 Linker {
35 public AbstractLinker(String[] objExtensions, String[] ignoredExtensions) {
36 super(objExtensions, ignoredExtensions);
37 }
38 /**
39 * Returns the bid of the processor for the file.
40 *
41 * A linker will bid 1 on any unrecognized file type.
42 *
43 * @param inputFile
44 * filename of input file
45 * @return bid for the file, 0 indicates no interest, 1 indicates that the
46 * processor recognizes the file but doesn't process it (header
47 * files, for example), 100 indicates strong interest
48 */
49 public int bid(String inputFile) {
50 int bid = super.bid(inputFile);
51 switch (bid) {
52 //
53 // unrecognized extension, take the file
54 //
55 case 0 :
56 return 1;
57 //
58 // discard the ignored extensions
59 //
60 case 1 :
61 return 0;
62 }
63 return bid;
64 }
65 public Processor changeEnvironment(boolean newEnvironment, Environment env) {
66 return this;
67 }
68 abstract protected LinkerConfiguration createConfiguration(CCTask task,
69 LinkType linkType, ProcessorDef[] baseConfigs,
70 LinkerDef specificConfig, TargetDef targetPlatform);
71 public ProcessorConfiguration createConfiguration(CCTask task,
72 LinkType linkType, ProcessorDef[] baseConfigs,
73 ProcessorDef specificConfig,
74 TargetDef targetPlatform) {
75 if (specificConfig == null) {
76 throw new NullPointerException("specificConfig");
77 }
78 return createConfiguration(task, linkType, baseConfigs,
79 (LinkerDef) specificConfig, targetPlatform);
80 }
81 public String getLibraryKey(File libfile) {
82 return libfile.getName();
83 }
84 public abstract String getOutputFileName(String fileName);
85 }