]>
git.proxmox.com Git - mirror_edk2.git/blob - Tools/Source/Cpptasks/net/sf/antcontrib/cpptasks/userdefine/UserDefineMapping.java
3 * Copyright 2001-2004 The Ant-Contrib project
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
9 * http://www.apache.org/licenses/LICENSE-2.0
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.
17 package net
.sf
.antcontrib
.cpptasks
.userdefine
;
18 public class UserDefineMapping
{
19 // list of Arch: EBC, ARM, IA32, X64, IPF, PPC, NT32
20 public final static String
[] arch
= { "EBC", "ARM", "IA32", "X64", "IPF",
23 // list of OS: Linux, Windows
24 public final static String
[] os
= { "WINDOWS", "LINUX" };
26 // list of Vendor: Microsoft, Intel, Cygwin, Gcc
27 public final static String
[] vendor
= { "MSFT", "INTEL", "GCC", "CYGWIN" };
29 // list of Command Type: CC, LIB, LINK, ASL, ASM, ASMLINK
30 public final static String
[] commandType
= { "CC", "LIB", "LINK", "ASL",
31 "ASM", "ASMLINK", "PP" };
34 // flags mapping (Include compellingIncFileFlag,Path Delimiter, Output file
38 // Examples: '/I' for MSFT cl.exe while '-I' for GCC
39 // '/Fo' for MSFT cl.exe while '-o' for GCC
41 public final static String
[][] compellingIncFileFlag
= {
42 { "MSFT_CC", "/FI" }, { "GCC_CC", "-include" },
43 { "INTEL_CC", "-FI" }, { "WINDDK_CC", "/FI" },
44 { "MSFT_ASM", "/FI" }, { "GCC_ASM", "-include" },
45 { "WINDDK_ASM", "/FI" } };
47 public final static String
[][] includePathFlag
= { { "MSFT_CC", "/I" },
48 { "GCC_CC", "-I" }, { "INTEL_CC", "/I" }, { "WINDDK_CC", "/I" },
49 { "MSFT_ASM", "/I" }, { "GCC_ASM", "-I" }, { "WINDDK_CC", "/I" },
50 { "MSFT_PP", "/I" }, { "GCC_PP", "-I" }, { "WINDDK_PP", "/I" } };
52 public final static String
[][] outputFileFlag
= { { "MSFT_CC", "/Fo" },
53 { "GCC_CC", "-o" }, { "INTEL_CC", "/Fo" }, { "WINDDK_CC", "/Fo" },
54 { "MSFT_LIB", "/OUT:" }, { "GCC_LIB", "-cr" },
55 { "INTEL_LIB", "/OUT:" }, { "WINDDK_LIB", "/OUT:" },
56 { "MSFT_LINK", "/OUT:" }, { "GCC_LINK", "-o" },
57 { "INTEL_LINK", "/OUT:" }, { "WINDDK_LINK", "/OUT:" },
58 { "MSFT_ASM", "/Fo" }, { "GCC_ASM", "-o" },
59 { "WINDDK_ASM", "/Fo" },{"WINDDK_IPF_ASM", "-o"} };
61 public final static String
[][] subSystemFlag
= {
62 { "MSFT_LIB", "/SUBSYSTEM:" }, { "GCC_LIB", "--subsystem=" },
63 { "WINDDk_LIB", "/SUBSYSTEM:" }, { "INTEL_LIB", "/SUBSYSTEM:" },
64 { "MSFT_LINK", "/SUBSYSTEM:" }, { "GCC_LINK", "--subsystem=" },
65 { "INTEL_LINK", "/SUBSYSTEM:" }, { "WINDDK_LINK", "/SUBSYSTEM:" } };
67 public final static String
[][] outputFileSuffix
= {
68 { "WINDOWS_ASM", ".obj" }, { "WINDOWS_CC", ".obj" },
69 { "LINUX_ASM", ".o" }, { "LINUX_CC", ".o" } };
71 public final static String
[][] entryPointFlag
= {
72 { "MSFT_LINK", "/ENTRY:" }, { "GCC_LINK", "-e" },
73 { "INTEL_LINK", "/ENTRY:" },
74 { "WINDDK_LINK", "/ENTRY:" } };
76 public final static String
[][] mapFlag
= { { "MSFT_LINK", "/MAP:" },
77 { "GCC_LINK", "" }, { "INTEL_LINK", "/MAP:" },
78 { "WINDDK_LINK", "/MAP:" } };
80 public final static String
[][] pdbFlag
= { { "MSFT_LINK", "/PDB:" },
81 { "GCC_LINK", "" }, { "INTEL_LINK", "" }, { "WINDDK_LINK", "/PDB:"} };
83 public static String
getIncludePathDelimiter(String vendor
,
85 String key
= vendor
+ "_" + commandType
;
86 for (int i
= 0; i
< includePathFlag
.length
; i
++) {
87 if (includePathFlag
[i
][0].equalsIgnoreCase(key
)) {
88 return includePathFlag
[i
][1];
94 public static String
getOutputFileFlag(String vendor
, String arch
, String commandType
) {
96 * First find outputfileFlag by vendor_arch_commandType
98 String key
= vendor
+ "_" + arch
+ "_" + commandType
;
99 for (int i
= 0; i
< outputFileFlag
.length
; i
++) {
100 if (outputFileFlag
[i
][0].equalsIgnoreCase(key
)) {
101 return outputFileFlag
[i
][1];
104 key
= vendor
+ "_" + commandType
;
105 for (int i
= 0; i
< outputFileFlag
.length
; i
++) {
106 if (outputFileFlag
[i
][0].equalsIgnoreCase(key
)) {
107 return outputFileFlag
[i
][1];
113 public static String
getCompellingIncFileFlag(String vendor
,
114 String commandType
) {
115 String key
= vendor
+ "_" + commandType
;
116 for (int i
= 0; i
< compellingIncFileFlag
.length
; i
++) {
117 if (compellingIncFileFlag
[i
][0].equalsIgnoreCase(key
)) {
118 return compellingIncFileFlag
[i
][1];
124 public static String
getSubSystemFlag(String vendor
, String commandType
) {
125 String key
= vendor
+ "_" + commandType
;
126 for (int i
= 0; i
< subSystemFlag
.length
; i
++) {
127 if (subSystemFlag
[i
][0].equalsIgnoreCase(key
)) {
128 return subSystemFlag
[i
][1];
134 public static String
getEntryPointFlag(String vendor
, String commandType
) {
135 String key
= vendor
+ "_" + commandType
;
136 for (int i
= 0; i
< entryPointFlag
.length
; i
++) {
137 if (entryPointFlag
[i
][0].equalsIgnoreCase(key
)) {
138 return entryPointFlag
[i
][1];
144 public static String
getMapFlag(String vendor
, String commandType
) {
145 String key
= vendor
+ "_" + commandType
;
146 for (int i
= 0; i
< mapFlag
.length
; i
++) {
147 if (mapFlag
[i
][0].equalsIgnoreCase(key
)) {
148 return mapFlag
[i
][1];
154 public static String
getPdbFlag(String vendor
, String commandType
) {
155 String key
= vendor
+ "_" + commandType
;
156 for (int i
= 0; i
< pdbFlag
.length
; i
++) {
157 if (pdbFlag
[i
][0].equalsIgnoreCase(key
)) {
158 return pdbFlag
[i
][1];
165 // Well-known source file suffix and output file suffix relationship
166 // sourceExtension(Multiple),
167 // headExtension(Multiple) and outputSuffix(Single)
171 // Default command string such as 'cl' in MSFT while 'gcc' in GCC
173 public final static String
[][] defaultCommand
= { { "GCC", "gcc" },
174 { "MSFT_CC", "cl" }, { "MSFT_LIB", "lib" },
175 { "MSFT_LINK", "link" }, };
177 public static String
getDefaultCommand(String toolchain
) {
178 for (int i
= 0; i
< defaultCommand
.length
; i
++) {
179 if (defaultCommand
[i
][0].equalsIgnoreCase(toolchain
)) {
180 return defaultCommand
[i
][1];