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