]> git.proxmox.com Git - mirror_edk2.git/blob - Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/os400/IccCompiler.java
Restructuring for better separation of Tool packages.
[mirror_edk2.git] / Tools / Java / Source / Cpptasks / net / sf / antcontrib / cpptasks / os400 / IccCompiler.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.os400;
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 IBM (R) OS/390 (tm) C++ Compiler
33 *
34 * @author Hiram Chirino (cojonudo14@hotmail.com)
35 */
36 public class IccCompiler extends CommandLineCCompiler {
37 private static final AbstractCompiler instance = new IccCompiler(false,
38 null);
39 public static AbstractCompiler getInstance() {
40 return instance;
41 }
42 private IccCompiler(boolean newEnvironment, Environment env) {
43 super("icc", null, new String[]{".c", ".cc", ".cpp", ".cxx", ".c++",
44 ".s"}, new String[]{".h", ".hpp"}, ".o", false, null,
45 newEnvironment, env);
46 }
47 protected void addImpliedArgs(final Vector args,
48 final boolean debug,
49 final boolean multithreaded,
50 final boolean exceptions,
51 final LinkType linkType,
52 final Boolean rtti,
53 final OptimizationEnum optimization,
54 final Boolean defaultflag) {
55 // Specifies that only compilations and assemblies be done.
56 // Link-edit is not done
57 args.addElement("-c");
58 /*
59 * if (exceptions) { args.addElement("/GX"); }
60 */
61 if (debug) {
62 args.addElement("-g");
63 /*
64 * args.addElement("-D"); args.addElement("_DEBUG"); if
65 * (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 /*
71 * args.addElement("-D"); args.addElement("NEBUG"); if
72 * (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 IccProcessor.addWarningSwitch(args, level);
80 }
81 public Processor changeEnvironment(boolean newEnvironment, Environment env) {
82 if (newEnvironment || env != null) {
83 return new IccCompiler(newEnvironment, env);
84 }
85 return this;
86 }
87 /*
88 * @see CommandLineCompiler#getDefineSwitch(StringBuffer, String, String)
89 */
90 protected void getDefineSwitch(StringBuffer buffer, String define,
91 String value) {
92 buffer.append("-q");
93 buffer.append(define);
94 if (value != null && value.length() > 0) {
95 buffer.append('=');
96 buffer.append(value);
97 }
98 }
99 protected File[] getEnvironmentIncludePath() {
100 return CUtil.getPathFromEnvironment("INCLUDE", ":");
101 }
102 protected String getIncludeDirSwitch(String includeDir) {
103 return IccProcessor.getIncludeDirSwitch(includeDir);
104 }
105 public Linker getLinker(LinkType type) {
106 return IccLinker.getInstance().getLinker(type);
107 }
108 public int getMaximumCommandLength() {
109 return Integer.MAX_VALUE;
110 }
111 /* Only compile one file at time for now */
112 protected int getMaximumInputFilesPerCommand() {
113 return 1;
114 //return Integer.MAX_VALUE;
115 }
116 /*
117 * @see CommandLineCompiler#getUndefineSwitch(StringBuffer, String)
118 */
119 protected void getUndefineSwitch(StringBuffer buffer, String define) {
120 /*
121 * buffer.addElement("-q"); buf.append(define);
122 */
123 }
124 }