Skip to main content
aboutsummaryrefslogtreecommitdiffstats
blob: 300f2dd0cffda9f36b1dd868bc055502278123a1 (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
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
/*******************************************************************************
 * Copyright (c) 2000, 2013 QNX Software Systems and others.
 *
 * This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License 2.0
 * which accompanies this distribution, and is available at
 * https://www.eclipse.org/legal/epl-2.0/
 *
 * SPDX-License-Identifier: EPL-2.0
 *
 * Contributors:
 *     QNX Software Systems - Initial API and implementation
 *******************************************************************************/
package org.eclipse.cdt.make.core.makefile;

import java.io.IOException;
import java.io.Reader;
import java.net.URI;


/**
 * IMakefile:
 *
 * Makefile : ( directive ) *
 * directive :   rule | macro_definition | comments | empty
 * rule :  inference_rule | target_rule | special_rule
 * inference_rule : target ':' [ ';' command ] <nl>
 *		 [ ( command ) * ]
 * target_rule : [ ( target ) + ] ':' [ ( prerequisite ) * ] [ ';' command ] <nl> 
 *               [ ( command ) *  ]
 * macro_definition : string '=' ( string )* 
 * comments : ('#' ( string ) <nl>) *
 * empty : <nl>
 * command : <tab> prefix_command string <nl>
 * target : string
 * prefix_command : '-' | '@' | '+'
 * internal_macro :  "$<" | "$*" | "$@" | "$?" | "$%" 
 * 
 * @noextend This class is not intended to be subclassed by clients.
 * @noimplement This interface is not intended to be implemented by clients.
 */
public interface IMakefile extends IParent {

	/**
	 * ITargetRule | IInferenceRule | ISpecialRule
	 */
	IRule[] getRules();

	/**
	 * @return the IRule for target.
	 */
	IRule[] getRules(String target);

	/**
	 * @return IInferenceRule
	 * 
	 */
	IInferenceRule[] getInferenceRules();

	/**
	 * @return the IInferenceRules for target.
	 */
	IInferenceRule[] getInferenceRules(String target);

	/**
	 * @return ITargetRule
	 */
	ITargetRule[] getTargetRules();

	/**
	 * @return the ITargetRules for name.
	 */
	ITargetRule[] getTargetRules(String target);

	/**
	 * @return the IMacroDefinitions.
	 */
	IMacroDefinition[] getMacroDefinitions();

	/**
	 * @return the IMacroDefinitions for name.
	 */
	IMacroDefinition[] getMacroDefinitions(String name);

	/**
	 * @return all the built-in directives.
	 */
	IDirective[] getBuiltins();

	/**
	 * @return all the built-in FunctionDefintions
	 * @since 7.3
	 */
	IBuiltinFunction[] getBuiltinFunctions();
	
	/**
	 * @return all the built-in MacroDefintions
	 */
	IMacroDefinition[] getBuiltinMacroDefinitions();

	/**
	 * @return all the built-in MacroDefintions
	 * @since 7.3
	 */
	IAutomaticVariable[] getAutomaticVariables();
	
	/**
	 * @return the built-in macro definition for name.
	 */
	IMacroDefinition[] getBuiltinMacroDefinitions(String name);

	/**
	 * @return line after expanding any macros.
	 */
	String expandString(String line);

	/**
	 * @return line after expanding any macros.
	 * 
	 * @param line - line to expand
	 * @param recursive -  if true recursively expand.
	 */
	String expandString(String line, boolean recursive);

	/**
	 * @return  the makefile Reader provider used to create this makefile or <code>null</code>
	 */
	IMakefileReaderProvider getMakefileReaderProvider();
	
	/**
	 * Clear all statements and (re)parse the Makefile
	 */
	void parse(String filePath, Reader makefile) throws IOException;
	
	/**
	 * Clear all statements and (re)parse the Makefile
	 */
	void parse(URI fileURI, Reader makefile) throws IOException;
	
	/**
	 * Clear the all statements and (re)parse the Makefile
	 * using the given makefile Reader provider
	 * 
	 * @param makefileReaderProvider provider, or <code>null</code> to use a FileReader
	 */
	void parse(URI fileURI, IMakefileReaderProvider makefileReaderProvider) throws IOException;
	

	/**
	 * @return the <code>URI</code> of this makefile
	 */
	URI getFileURI();
}

Back to the top