]>
Commit | Line | Data |
---|---|---|
878ddf1f | 1 | /*\r |
2 | * \r | |
3 | * Copyright 2001-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 | |
17 | package net.sf.antcontrib.cpptasks.userdefine;\r | |
18 | public class UserDefineMapping {\r | |
19 | // list of Arch: EBC, ARM, IA32, X64, IPF, PPC, NT32\r | |
20 | public final static String[] arch = { "EBC", "ARM", "IA32", "X64", "IPF",\r | |
21 | "PPC", "NT32" };\r | |
22 | \r | |
23 | // list of OS: Linux, Windows\r | |
24 | public final static String[] os = { "WINDOWS", "LINUX" };\r | |
25 | \r | |
26 | // list of Vendor: Microsoft, Intel, Cygwin, Gcc\r | |
27 | public final static String[] vendor = { "MSFT", "INTEL", "GCC", "CYGWIN" };\r | |
28 | \r | |
29 | // list of Command Type: CC, LIB, LINK, ASL, ASM, ASMLINK\r | |
30 | public final static String[] commandType = { "CC", "LIB", "LINK", "ASL",\r | |
31 | "ASM", "ASMLINK", "PP" };\r | |
32 | \r | |
33 | //\r | |
34 | // flags mapping (Include compellingIncFileFlag,Path Delimiter, Output file\r | |
35 | // flag,\r | |
36 | // includepathfalge,\r | |
37 | // )\r | |
38 | // Examples: '/I' for MSFT cl.exe while '-I' for GCC\r | |
39 | // '/Fo' for MSFT cl.exe while '-o' for GCC\r | |
40 | //\r | |
41 | public final static String[][] compellingIncFileFlag = {\r | |
42 | { "MSFT_CC", "/FI" }, { "GCC_CC", "-include" },\r | |
43 | { "INTEL_CC", "-FI" }, { "WINDDK_CC", "/FI" },\r | |
44 | { "MSFT_ASM", "/FI" }, { "GCC_ASM", "-include" },\r | |
45 | { "WINDDK_ASM", "/FI" } };\r | |
46 | \r | |
47 | public final static String[][] includePathFlag = { { "MSFT_CC", "/I" },\r | |
48 | { "GCC_CC", "-I" }, { "INTEL_CC", "/I" }, { "WINDDK_CC", "/I" },\r | |
49 | { "MSFT_ASM", "/I" }, { "GCC_ASM", "-I" }, { "WINDDK_CC", "/I" },\r | |
50 | { "MSFT_PP", "/I" }, { "GCC_PP", "-I" }, { "WINDDK_PP", "/I" } };\r | |
51 | \r | |
52 | public final static String[][] outputFileFlag = { { "MSFT_CC", "/Fo" },\r | |
53 | { "GCC_CC", "-o" }, { "INTEL_CC", "/Fo" }, { "WINDDK_CC", "/Fo" },\r | |
54 | { "MSFT_LIB", "/OUT:" }, { "GCC_LIB", "-cr" },\r | |
55 | { "INTEL_LIB", "/OUT:" }, { "WINDDK_LIB", "/OUT:" },\r | |
56 | { "MSFT_LINK", "/OUT:" }, { "GCC_LINK", "-o" },\r | |
57 | { "INTEL_LINK", "/OUT:" }, { "WINDDK_LINK", "/OUT:" },\r | |
58 | { "MSFT_ASM", "/Fo" }, { "GCC_ASM", "-o" },\r | |
59 | { "WINDDK_ASM", "/Fo" },{"WINDDK_IPF_ASM", "-o"} };\r | |
60 | \r | |
61 | public final static String[][] subSystemFlag = {\r | |
62 | { "MSFT_LIB", "/SUBSYSTEM:" }, { "GCC_LIB", "--subsystem=" },\r | |
63 | { "WINDDk_LIB", "/SUBSYSTEM:" }, { "INTEL_LIB", "/SUBSYSTEM:" },\r | |
64 | { "MSFT_LINK", "/SUBSYSTEM:" }, { "GCC_LINK", "--subsystem=" },\r | |
65 | { "INTEL_LINK", "/SUBSYSTEM:" }, { "WINDDK_LINK", "/SUBSYSTEM:" } };\r | |
66 | \r | |
67 | public final static String[][] outputFileSuffix = {\r | |
68 | { "WINDOWS_ASM", ".obj" }, { "WINDOWS_CC", ".obj" },\r | |
69 | { "LINUX_ASM", ".o" }, { "LINUX_CC", ".o" } };\r | |
70 | \r | |
71 | public final static String[][] entryPointFlag = {\r | |
72 | { "MSFT_LINK", "/ENTRY:" }, { "GCC_LINK", "-e" },\r | |
73 | { "INTEL_LINK", "/ENTRY:" },\r | |
74 | { "WINDDK_LINK", "/ENTRY:" } };\r | |
75 | \r | |
76 | public final static String[][] mapFlag = { { "MSFT_LINK", "/MAP:" },\r | |
77 | { "GCC_LINK", "" }, { "INTEL_LINK", "/MAP:" },\r | |
78 | { "WINDDK_LINK", "/MAP:" } };\r | |
79 | \r | |
80 | public final static String[][] pdbFlag = { { "MSFT_LINK", "/PDB:" },\r | |
81 | { "GCC_LINK", "" }, { "INTEL_LINK", "" }, { "WINDDK_LINK", "/PDB:"} };\r | |
82 | \r | |
83 | public static String getIncludePathDelimiter(String vendor,\r | |
84 | String commandType) {\r | |
85 | String key = vendor + "_" + commandType;\r | |
86 | for (int i = 0; i < includePathFlag.length; i++) {\r | |
87 | if (includePathFlag[i][0].equalsIgnoreCase(key)) {\r | |
88 | return includePathFlag[i][1];\r | |
89 | }\r | |
90 | }\r | |
91 | return null;\r | |
92 | }\r | |
93 | \r | |
94 | public static String getOutputFileFlag(String vendor, String arch, String commandType) {\r | |
95 | /*\r | |
96 | * First find outputfileFlag by vendor_arch_commandType\r | |
97 | */\r | |
98 | String key = vendor + "_" + arch + "_" + commandType;\r | |
99 | for (int i = 0; i < outputFileFlag.length; i++) {\r | |
100 | if (outputFileFlag[i][0].equalsIgnoreCase(key)) {\r | |
101 | return outputFileFlag[i][1];\r | |
102 | }\r | |
103 | }\r | |
104 | key = vendor + "_" + commandType;\r | |
105 | for (int i = 0; i < outputFileFlag.length; i++) {\r | |
106 | if (outputFileFlag[i][0].equalsIgnoreCase(key)) {\r | |
107 | return outputFileFlag[i][1];\r | |
108 | }\r | |
109 | }\r | |
110 | return null;\r | |
111 | }\r | |
112 | \r | |
113 | public static String getCompellingIncFileFlag(String vendor,\r | |
114 | String commandType) {\r | |
115 | String key = vendor + "_" + commandType;\r | |
116 | for (int i = 0; i < compellingIncFileFlag.length; i++) {\r | |
117 | if (compellingIncFileFlag[i][0].equalsIgnoreCase(key)) {\r | |
118 | return compellingIncFileFlag[i][1];\r | |
119 | }\r | |
120 | }\r | |
121 | return null;\r | |
122 | }\r | |
123 | \r | |
124 | public static String getSubSystemFlag(String vendor, String commandType) {\r | |
125 | String key = vendor + "_" + commandType;\r | |
126 | for (int i = 0; i < subSystemFlag.length; i++) {\r | |
127 | if (subSystemFlag[i][0].equalsIgnoreCase(key)) {\r | |
128 | return subSystemFlag[i][1];\r | |
129 | }\r | |
130 | }\r | |
131 | return null;\r | |
132 | }\r | |
133 | \r | |
134 | public static String getEntryPointFlag(String vendor, String commandType) {\r | |
135 | String key = vendor + "_" + commandType;\r | |
136 | for (int i = 0; i < entryPointFlag.length; i++) {\r | |
137 | if (entryPointFlag[i][0].equalsIgnoreCase(key)) {\r | |
138 | return entryPointFlag[i][1];\r | |
139 | }\r | |
140 | }\r | |
141 | return null;\r | |
142 | }\r | |
143 | \r | |
144 | public static String getMapFlag(String vendor, String commandType) {\r | |
145 | String key = vendor + "_" + commandType;\r | |
146 | for (int i = 0; i < mapFlag.length; i++) {\r | |
147 | if (mapFlag[i][0].equalsIgnoreCase(key)) {\r | |
148 | return mapFlag[i][1];\r | |
149 | }\r | |
150 | }\r | |
151 | return null;\r | |
152 | }\r | |
153 | \r | |
154 | public static String getPdbFlag(String vendor, String commandType) {\r | |
155 | String key = vendor + "_" + commandType;\r | |
156 | for (int i = 0; i < pdbFlag.length; i++) {\r | |
157 | if (pdbFlag[i][0].equalsIgnoreCase(key)) {\r | |
158 | return pdbFlag[i][1];\r | |
159 | }\r | |
160 | }\r | |
161 | return null;\r | |
162 | }\r | |
163 | \r | |
164 | //\r | |
165 | // Well-known source file suffix and output file suffix relationship\r | |
166 | // sourceExtension(Multiple),\r | |
167 | // headExtension(Multiple) and outputSuffix(Single)\r | |
168 | //\r | |
169 | \r | |
170 | //\r | |
171 | // Default command string such as 'cl' in MSFT while 'gcc' in GCC\r | |
172 | //\r | |
173 | public final static String[][] defaultCommand = { { "GCC", "gcc" },\r | |
174 | { "MSFT_CC", "cl" }, { "MSFT_LIB", "lib" },\r | |
175 | { "MSFT_LINK", "link" }, };\r | |
176 | \r | |
177 | public static String getDefaultCommand(String toolchain) {\r | |
178 | for (int i = 0; i < defaultCommand.length; i++) {\r | |
179 | if (defaultCommand[i][0].equalsIgnoreCase(toolchain)) {\r | |
180 | return defaultCommand[i][1];\r | |
181 | }\r | |
182 | }\r | |
183 | return null;\r | |
184 | }\r | |
185 | \r | |
186 | } |