1 | /* |
---|
2 | * Copyright (c) 2008 Embedded Brains GmbH and others. |
---|
3 | * |
---|
4 | * Embedded Brains GmbH |
---|
5 | * Obere Lagerstr. 30 |
---|
6 | * D-82178 Puchheim |
---|
7 | * Germany |
---|
8 | * rtems@embedded-brains.de |
---|
9 | * |
---|
10 | * All rights reserved. This program and the accompanying materials are made |
---|
11 | * available under the terms of the Eclipse Public License Version 1.0 ("EPL") |
---|
12 | * which accompanies this distribution and is available at |
---|
13 | * |
---|
14 | * http://www.eclipse.org/legal/epl-v10.html |
---|
15 | * |
---|
16 | * For purposes of the EPL, "Program" will mean the Content. |
---|
17 | * |
---|
18 | * Contributors: |
---|
19 | * |
---|
20 | * Sebastian Huber (Embedded Brains GmbH) - Initial API and implementation. |
---|
21 | */ |
---|
22 | |
---|
23 | package org.rtems.cdt; |
---|
24 | |
---|
25 | import java.util.Map; |
---|
26 | |
---|
27 | import org.eclipse.core.runtime.Platform; |
---|
28 | |
---|
29 | public class Constants { |
---|
30 | public static final String PATH_SEPARATOR = System.getProperty( "path.separator"); |
---|
31 | |
---|
32 | public static final String PATH_VARIABLE_NAME = getPathVariableName(); |
---|
33 | |
---|
34 | public static final String PLATFORM_DEFAULT = "default"; |
---|
35 | |
---|
36 | public static final String PLATFORM_CYGWIN = "cygwin"; |
---|
37 | |
---|
38 | public static final String BSP_PATH_MAKE_VARIABLE = "PROJECT_RELEASE"; |
---|
39 | |
---|
40 | public static final String DEFAULT_BASE_PATH = getDefaultPath(); |
---|
41 | |
---|
42 | public static final String DEFAULT_BSP_PATH = getDefaultPath(); |
---|
43 | |
---|
44 | public static final String DEFAULT_CYGWIN_PATH = "C:\\"; |
---|
45 | |
---|
46 | public static final String DEFAULT_MINGW_PATH = "C:\\"; |
---|
47 | |
---|
48 | public static final String DEFAULT_MSYS_PATH = "C:\\"; |
---|
49 | |
---|
50 | public static final String DEFAULT_DISABLE_TOOL_OPTIONS = "false"; |
---|
51 | |
---|
52 | public static final String KEY_PREFIX = "org.rtems.cdt"; |
---|
53 | |
---|
54 | public static final String PLATFORM_KEY = KEY_PREFIX + ".platform"; |
---|
55 | |
---|
56 | public static final String BASE_PATH_KEY = KEY_PREFIX + ".basePath"; |
---|
57 | |
---|
58 | public static final String BSP_PATH_KEY = KEY_PREFIX + ".bspPath"; |
---|
59 | |
---|
60 | public static final String CYGWIN_PATH_KEY = KEY_PREFIX + ".cygwinPath"; |
---|
61 | |
---|
62 | public static final String MINGW_PATH_KEY = KEY_PREFIX + ".mingwPath"; |
---|
63 | |
---|
64 | public static final String MSYS_PATH_KEY = KEY_PREFIX + ".msysPath"; |
---|
65 | |
---|
66 | public static final String PATH_PREPEND_KEY = KEY_PREFIX + ".pathPrepend"; |
---|
67 | |
---|
68 | public static final String DISABLE_TOOL_OPTIONS_KEY = KEY_PREFIX + ".disableToolOptions"; |
---|
69 | |
---|
70 | public static final String TOOL_KEY_PREFIX = KEY_PREFIX + ".tool"; |
---|
71 | |
---|
72 | public static final String TOOL_ARCHIVER_KEY = TOOL_KEY_PREFIX + ".archiver"; |
---|
73 | |
---|
74 | public static final String TOOL_ASSEMBLER_KEY = TOOL_KEY_PREFIX + ".assembler"; |
---|
75 | |
---|
76 | public static final String COMPILER_KEY_PREFIX = TOOL_KEY_PREFIX + ".compiler"; |
---|
77 | |
---|
78 | public static final String TOOL_COMPILER_C_KEY = COMPILER_KEY_PREFIX + ".c"; |
---|
79 | |
---|
80 | public static final String TOOL_COMPILER_CPP_KEY = COMPILER_KEY_PREFIX + ".cpp"; |
---|
81 | |
---|
82 | public static final String LINKER_KEY_PREFIX = TOOL_KEY_PREFIX + ".linker"; |
---|
83 | |
---|
84 | public static final String TOOL_LINKER_C_KEY = LINKER_KEY_PREFIX + ".c"; |
---|
85 | |
---|
86 | public static final String TOOL_LINKER_CPP_KEY = LINKER_KEY_PREFIX + ".cpp"; |
---|
87 | |
---|
88 | public static final String TOOL_OPTIONS_KEY_POSTFIX = ".options"; |
---|
89 | |
---|
90 | public static final String TOOL_OPTIONS_ARCHIVER_KEY = TOOL_ARCHIVER_KEY + TOOL_OPTIONS_KEY_POSTFIX; |
---|
91 | |
---|
92 | public static final String TOOL_OPTIONS_ASSEMBLER_KEY = TOOL_ASSEMBLER_KEY + TOOL_OPTIONS_KEY_POSTFIX; |
---|
93 | |
---|
94 | public static final String TOOL_OPTIONS_COMPILER_C_KEY = TOOL_COMPILER_C_KEY + TOOL_OPTIONS_KEY_POSTFIX; |
---|
95 | |
---|
96 | public static final String TOOL_OPTIONS_COMPILER_CPP_KEY = TOOL_COMPILER_CPP_KEY + TOOL_OPTIONS_KEY_POSTFIX; |
---|
97 | |
---|
98 | public static final String TOOL_OPTIONS_LINKER_C_KEY = TOOL_LINKER_C_KEY + TOOL_OPTIONS_KEY_POSTFIX; |
---|
99 | |
---|
100 | public static final String TOOL_OPTIONS_LINKER_CPP_KEY = TOOL_LINKER_CPP_KEY + TOOL_OPTIONS_KEY_POSTFIX; |
---|
101 | |
---|
102 | public static final String MARKER_ID_TOOL_DISCOVERY = "tool discovery"; |
---|
103 | |
---|
104 | private static String getPathVariableName() { |
---|
105 | Map<String, String> env = System.getenv(); |
---|
106 | for (String name : env.keySet()) { |
---|
107 | if (name.equalsIgnoreCase( "PATH")) { |
---|
108 | return name; |
---|
109 | } |
---|
110 | } |
---|
111 | |
---|
112 | return "PATH"; |
---|
113 | } |
---|
114 | |
---|
115 | private static String getDefaultPath() { |
---|
116 | if (Platform.getOS().equals( Platform.OS_WIN32)) { |
---|
117 | return "C:\\"; |
---|
118 | } else { |
---|
119 | return "/opt/rtems-4.9"; |
---|
120 | } |
---|
121 | } |
---|
122 | |
---|
123 | private Constants() { |
---|
124 | // Do nothing |
---|
125 | } |
---|
126 | } |
---|