]> git.proxmox.com Git - mirror_edk2.git/blobdiff - Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/sun/C89CCompiler.java
Restructuring for better separation of Tool packages.
[mirror_edk2.git] / Tools / Java / Source / Cpptasks / net / sf / antcontrib / cpptasks / sun / C89CCompiler.java
diff --git a/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/sun/C89CCompiler.java b/Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/sun/C89CCompiler.java
new file mode 100644 (file)
index 0000000..6679c23
--- /dev/null
@@ -0,0 +1,109 @@
+/*\r
+ * \r
+ * Copyright 2002-2004 The Ant-Contrib project\r
+ *\r
+ *  Licensed under the Apache License, Version 2.0 (the "License");\r
+ *  you may not use this file except in compliance with the License.\r
+ *  You may obtain a copy of the License at\r
+ *\r
+ *      http://www.apache.org/licenses/LICENSE-2.0\r
+ *\r
+ *  Unless required by applicable law or agreed to in writing, software\r
+ *  distributed under the License is distributed on an "AS IS" BASIS,\r
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ *  See the License for the specific language governing permissions and\r
+ *  limitations under the License.\r
+ */\r
+package net.sf.antcontrib.cpptasks.sun;\r
+import java.io.File;\r
+import java.util.Vector;\r
+\r
+import net.sf.antcontrib.cpptasks.CUtil;\r
+import net.sf.antcontrib.cpptasks.compiler.AbstractCompiler;\r
+import net.sf.antcontrib.cpptasks.compiler.CommandLineCCompiler;\r
+import net.sf.antcontrib.cpptasks.compiler.LinkType;\r
+import net.sf.antcontrib.cpptasks.compiler.Linker;\r
+import net.sf.antcontrib.cpptasks.compiler.Processor;\r
+import net.sf.antcontrib.cpptasks.OptimizationEnum;\r
+\r
+\r
+import org.apache.tools.ant.types.Environment;\r
+/**\r
+ * Adapter for the Sun C89 C++ Compiler\r
+ * \r
+ * @author Hiram Chirino (cojonudo14@hotmail.com)\r
+ */\r
+public class C89CCompiler extends CommandLineCCompiler {\r
+    private static final AbstractCompiler instance = new C89CCompiler(false,\r
+            null);\r
+    public static AbstractCompiler getInstance() {\r
+        return instance;\r
+    }\r
+    private C89CCompiler(boolean newEnvironment, Environment env) {\r
+        super("c89", null, new String[]{".c", ".cc", ".cpp", ".cxx", ".c++"},\r
+                new String[]{".h", ".hpp"}, ".o", false, null, newEnvironment,\r
+                env);\r
+    }\r
+    protected void addImpliedArgs(\r
+               final Vector args, \r
+                       final boolean debug,\r
+            final boolean multithreaded, \r
+                       final boolean exceptions, \r
+                       final LinkType linkType,\r
+                       final Boolean rtti,\r
+                       final OptimizationEnum optimization,\r
+   final Boolean defaultflag) {\r
+        // Specifies that only compilations and assemblies be done.\r
+        args.addElement("-c");\r
+        /*\r
+         * if (exceptions) { args.addElement("/GX"); }\r
+         */\r
+        if (debug) {\r
+            args.addElement("-g");\r
+            args.addElement("-D_DEBUG");\r
+            /*\r
+             * if (multithreaded) { args.addElement("/D_MT"); if (staticLink) {\r
+             * args.addElement("/MTd"); } else { args.addElement("/MDd");\r
+             * args.addElement("/D_DLL"); } } else { args.addElement("/MLd"); }\r
+             */\r
+        } else {\r
+            args.addElement("-DNDEBUG");\r
+            /*\r
+             * if (multithreaded) { args.addElement("/D_MT"); if (staticLink) {\r
+             * args.addElement("/MT"); } else { args.addElement("/MD");\r
+             * args.addElement("/D_DLL"); } } else { args.addElement("/ML"); }\r
+             */\r
+        }\r
+    }\r
+    protected void addWarningSwitch(Vector args, int level) {\r
+        C89Processor.addWarningSwitch(args, level);\r
+    }\r
+    public Processor changeEnvironment(boolean newEnvironment, Environment env) {\r
+        if (newEnvironment || env != null) {\r
+            return new C89CCompiler(newEnvironment, env);\r
+        }\r
+        return this;\r
+    }\r
+    protected void getDefineSwitch(StringBuffer buf, String define, String value) {\r
+        C89Processor.getDefineSwitch(buf, define, value);\r
+    }\r
+    protected File[] getEnvironmentIncludePath() {\r
+        return CUtil.getPathFromEnvironment("INCLUDE", ":");\r
+    }\r
+    protected String getIncludeDirSwitch(String includeDir) {\r
+        return C89Processor.getIncludeDirSwitch(includeDir);\r
+    }\r
+    public Linker getLinker(LinkType type) {\r
+        return C89Linker.getInstance().getLinker(type);\r
+    }\r
+    public int getMaximumCommandLength() {\r
+        return Integer.MAX_VALUE;\r
+    }\r
+    /* Only compile one file at time for now */\r
+    protected int getMaximumInputFilesPerCommand() {\r
+        return 1;\r
+    }\r
+    protected void getUndefineSwitch(StringBuffer buf, String define) {\r
+        C89Processor.getUndefineSwitch(buf, define);\r
+    }\r
+}\r