summaryrefslogtreecommitdiffstats
path: root/org.rtems.cdt/src/org/rtems/cdt/Constants.java
blob: fec286b489134b8e6956d7387d22f4b6e64ea18d (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
/*
 * Copyright (c) 2008 Embedded Brains GmbH and others.
 *
 *   Embedded Brains GmbH
 *   Obere Lagerstr. 30
 *   D-82178 Puchheim
 *   Germany
 *   rtems@embedded-brains.de
 *
 * All rights reserved.  This program and the accompanying materials are made
 * available under the terms of the Eclipse Public License Version 1.0 ("EPL")
 * which accompanies this distribution and is available at
 *
 *   http://www.eclipse.org/legal/epl-v10.html
 *
 * For purposes of the EPL, "Program" will mean the Content.
 *
 * Contributors:
 *
 *   Sebastian Huber (Embedded Brains GmbH) - Initial API and implementation.
 */

package org.rtems.cdt;

import java.util.Map;

import org.eclipse.core.runtime.Platform;

public class Constants {
	public static final String PATH_SEPARATOR = System.getProperty( "path.separator");

	public static final String PATH_VARIABLE_NAME = getPathVariableName();

	public static final String PLATFORM_DEFAULT = "default";

	public static final String PLATFORM_CYGWIN = "cygwin";

	public static final String BSP_PATH_MAKE_VARIABLE = "PROJECT_RELEASE";

	public static final String DEFAULT_BASE_PATH = getDefaultPath();

	public static final String DEFAULT_BSP_PATH = getDefaultPath();

	public static final String DEFAULT_CYGWIN_PATH = "C:\\";

	public static final String DEFAULT_MINGW_PATH = "C:\\";

	public static final String DEFAULT_MSYS_PATH = "C:\\";

	public static final String DEFAULT_DISABLE_TOOL_OPTIONS = "false";

	public static final String KEY_PREFIX = "org.rtems.cdt";

	public static final String PLATFORM_KEY = KEY_PREFIX + ".platform";

	public static final String BASE_PATH_KEY = KEY_PREFIX + ".basePath";

	public static final String BSP_PATH_KEY = KEY_PREFIX + ".bspPath";

	public static final String CYGWIN_PATH_KEY = KEY_PREFIX + ".cygwinPath";

	public static final String MINGW_PATH_KEY = KEY_PREFIX + ".mingwPath";

	public static final String MSYS_PATH_KEY = KEY_PREFIX + ".msysPath";

	public static final String PATH_PREPEND_KEY = KEY_PREFIX + ".pathPrepend";

	public static final String DISABLE_TOOL_OPTIONS_KEY = KEY_PREFIX + ".disableToolOptions";

	public static final String TOOL_KEY_PREFIX = KEY_PREFIX + ".tool";

	public static final String TOOL_ARCHIVER_KEY = TOOL_KEY_PREFIX + ".archiver";

	public static final String TOOL_ASSEMBLER_KEY = TOOL_KEY_PREFIX + ".assembler";

	public static final String COMPILER_KEY_PREFIX = TOOL_KEY_PREFIX + ".compiler";

	public static final String TOOL_COMPILER_C_KEY = COMPILER_KEY_PREFIX + ".c";

	public static final String TOOL_COMPILER_CPP_KEY = COMPILER_KEY_PREFIX + ".cpp";

	public static final String LINKER_KEY_PREFIX = TOOL_KEY_PREFIX + ".linker";

	public static final String TOOL_LINKER_C_KEY = LINKER_KEY_PREFIX + ".c";

	public static final String TOOL_LINKER_CPP_KEY = LINKER_KEY_PREFIX + ".cpp";

	public static final String TOOL_OPTIONS_KEY_POSTFIX = ".options";

	public static final String TOOL_OPTIONS_ARCHIVER_KEY = TOOL_ARCHIVER_KEY + TOOL_OPTIONS_KEY_POSTFIX;

	public static final String TOOL_OPTIONS_ASSEMBLER_KEY = TOOL_ASSEMBLER_KEY + TOOL_OPTIONS_KEY_POSTFIX;

	public static final String TOOL_OPTIONS_COMPILER_C_KEY = TOOL_COMPILER_C_KEY + TOOL_OPTIONS_KEY_POSTFIX;

	public static final String TOOL_OPTIONS_COMPILER_CPP_KEY = TOOL_COMPILER_CPP_KEY + TOOL_OPTIONS_KEY_POSTFIX;

	public static final String TOOL_OPTIONS_LINKER_C_KEY = TOOL_LINKER_C_KEY + TOOL_OPTIONS_KEY_POSTFIX;

	public static final String TOOL_OPTIONS_LINKER_CPP_KEY = TOOL_LINKER_CPP_KEY + TOOL_OPTIONS_KEY_POSTFIX;

	public static final String MARKER_ID_TOOL_DISCOVERY = "tool discovery";
	
	private static String getPathVariableName() {
		Map<String, String> env = System.getenv();
		for (String name : env.keySet()) {
			if (name.equalsIgnoreCase( "PATH")) {
				return name;
			}
		}

		return "PATH";
	}
	
	private static String getDefaultPath() {
		if (Platform.getOS().equals( Platform.OS_WIN32)) {
			return "C:\\";
		} else {
			return "/opt/rtems-4.9";
		}
	}

	private Constants() {
		// Do nothing
	}
}