]> git.proxmox.com Git - mirror_edk2.git/blob - Tools/Source/Cpptasks/net/sf/antcontrib/cpptasks/sun/C89CCompiler.java
Changed spelling to manifest
[mirror_edk2.git] / Tools / Source / Cpptasks / net / sf / antcontrib / cpptasks / sun / C89CCompiler.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.sun;
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.AbstractCompiler;
23 import net.sf.antcontrib.cpptasks.compiler.CommandLineCCompiler;
24 import net.sf.antcontrib.cpptasks.compiler.LinkType;
25 import net.sf.antcontrib.cpptasks.compiler.Linker;
26 import net.sf.antcontrib.cpptasks.compiler.Processor;
27 import net.sf.antcontrib.cpptasks.OptimizationEnum;
28
29
30 import org.apache.tools.ant.types.Environment;
31 /**
32 * Adapter for the Sun C89 C++ Compiler
33 *
34 * @author Hiram Chirino (cojonudo14@hotmail.com)
35 */
36 public class C89CCompiler extends CommandLineCCompiler {
37 private static final AbstractCompiler instance = new C89CCompiler(false,
38 null);
39 public static AbstractCompiler getInstance() {
40 return instance;
41 }
42 private C89CCompiler(boolean newEnvironment, Environment env) {
43 super("c89", null, new String[]{".c", ".cc", ".cpp", ".cxx", ".c++"},
44 new String[]{".h", ".hpp"}, ".o", false, null, newEnvironment,
45 env);
46 }
47 protected void addImpliedArgs(
48 final Vector args,
49 final boolean debug,
50 final boolean multithreaded,
51 final boolean exceptions,
52 final LinkType linkType,
53 final Boolean rtti,
54 final OptimizationEnum optimization,
55 final Boolean defaultflag) {
56 // Specifies that only compilations and assemblies be done.
57 args.addElement("-c");
58 /*
59 * if (exceptions) { args.addElement("/GX"); }
60 */
61 if (debug) {
62 args.addElement("-g");
63 args.addElement("-D_DEBUG");
64 /*
65 * if (multithreaded) { args.addElement("/D_MT"); if (staticLink) {
66 * args.addElement("/MTd"); } else { args.addElement("/MDd");
67 * args.addElement("/D_DLL"); } } else { args.addElement("/MLd"); }
68 */
69 } else {
70 args.addElement("-DNDEBUG");
71 /*
72 * if (multithreaded) { args.addElement("/D_MT"); if (staticLink) {
73 * args.addElement("/MT"); } else { args.addElement("/MD");
74 * args.addElement("/D_DLL"); } } else { args.addElement("/ML"); }
75 */
76 }
77 }
78 protected void addWarningSwitch(Vector args, int level) {
79 C89Processor.addWarningSwitch(args, level);
80 }
81 public Processor changeEnvironment(boolean newEnvironment, Environment env) {
82 if (newEnvironment || env != null) {
83 return new C89CCompiler(newEnvironment, env);
84 }
85 return this;
86 }
87 protected void getDefineSwitch(StringBuffer buf, String define, String value) {
88 C89Processor.getDefineSwitch(buf, define, value);
89 }
90 protected File[] getEnvironmentIncludePath() {
91 return CUtil.getPathFromEnvironment("INCLUDE", ":");
92 }
93 protected String getIncludeDirSwitch(String includeDir) {
94 return C89Processor.getIncludeDirSwitch(includeDir);
95 }
96 public Linker getLinker(LinkType type) {
97 return C89Linker.getInstance().getLinker(type);
98 }
99 public int getMaximumCommandLength() {
100 return Integer.MAX_VALUE;
101 }
102 /* Only compile one file at time for now */
103 protected int getMaximumInputFilesPerCommand() {
104 return 1;
105 }
106 protected void getUndefineSwitch(StringBuffer buf, String define) {
107 C89Processor.getUndefineSwitch(buf, define);
108 }
109 }