]> git.proxmox.com Git - mirror_edk2.git/blob - Tools/Source/Cpptasks/net/sf/antcontrib/cpptasks/hp/aCCCompiler.java
Changed spelling to manifest
[mirror_edk2.git] / Tools / Source / Cpptasks / net / sf / antcontrib / cpptasks / hp / aCCCompiler.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.hp;
18 import java.io.File;
19 import java.util.Vector;
20
21 import net.sf.antcontrib.cpptasks.CUtil;
22 import net.sf.antcontrib.cpptasks.compiler.LinkType;
23 import net.sf.antcontrib.cpptasks.compiler.Linker;
24 import net.sf.antcontrib.cpptasks.gcc.GccCompatibleCCompiler;
25 import net.sf.antcontrib.cpptasks.OptimizationEnum;
26
27 import org.apache.tools.ant.types.Environment;
28 /**
29 * Adapter for the HP aC++ C++ compiler
30 *
31 * @author Curt Arnold
32 */
33 public final class aCCCompiler extends GccCompatibleCCompiler {
34 private static final aCCCompiler instance = new aCCCompiler("aCC", false,
35 null);
36 /**
37 * Gets singleton instance of this class
38 */
39 public static aCCCompiler getInstance() {
40 return instance;
41 }
42 private String identifier;
43 private File[] includePath;
44 /**
45 * Private constructor. Use GccCCompiler.getInstance() to get singleton
46 * instance of this class.
47 */
48 private aCCCompiler(String command, boolean newEnvironment, Environment env) {
49 super(command, "-help", false, null, newEnvironment, env);
50 }
51 public void addImpliedArgs(Vector args, boolean debug,
52 boolean multithreaded, boolean exceptions, LinkType linkType,
53 final Boolean rtti,
54 final OptimizationEnum optimization) {
55 args.addElement("-c");
56 if (debug) {
57 args.addElement("-g");
58 }
59 /*
60 * if (multithreaded) { args.addElement("-mt"); }
61 */
62 if (linkType.isSharedLibrary()) {
63 args.addElement("+z");
64 }
65 }
66 public void addWarningSwitch(Vector args, int level) {
67 switch (level) {
68 case 0 :
69 args.addElement("-w");
70 break;
71 case 1 :
72 case 2 :
73 args.addElement("+w");
74 break;
75 /*
76 * case 3: case 4: case 5: args.addElement("+w2"); break;
77 */
78 }
79 }
80 public File[] getEnvironmentIncludePath() {
81 if (includePath == null) {
82 File ccLoc = CUtil.getExecutableLocation("aCC");
83 if (ccLoc != null) {
84 File compilerIncludeDir = new File(
85 new File(ccLoc, "../include").getAbsolutePath());
86 if (compilerIncludeDir.exists()) {
87 includePath = new File[2];
88 includePath[0] = compilerIncludeDir;
89 }
90 }
91 if (includePath == null) {
92 includePath = new File[1];
93 }
94 includePath[includePath.length - 1] = new File("/usr/include");
95 }
96 return includePath;
97 }
98 public Linker getLinker(LinkType linkType) {
99 return aCCLinker.getInstance().getLinker(linkType);
100 }
101 public int getMaximumCommandLength() {
102 return Integer.MAX_VALUE;
103 }
104 }