blob: cc585c6e214efa8586a53a61c002788d1ed093ee (
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
|
/*******************************************************************************
* Copyright (c) 2000, 2015 QNX Software Systems and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* QNX Software Systems - Initial API and implementation
* Red Hat Inc. - Modified from PosixMakeFile to support Automake files
*******************************************************************************/
package org.eclipse.cdt.internal.autotools.ui.editors.automake;
import java.io.IOException;
import org.eclipse.cdt.make.core.makefile.IDirective;
public class Automakefile extends GNUAutomakefile {
public Automakefile() {
super();
}
protected IDirective getDirectiveContainingLine(int line) {
int startLine, endLine;
IDirective[] directives = this.getDirectives();
for (int i = 0; i < directives.length; i++) {
IDirective directive = directives[i];
startLine = directive.getStartLine();
endLine = directive.getEndLine();
if (startLine <= line && endLine >= line)
return directive;
}
return null;
}
public static void main(String[] args) {
try {
String filename = "Makefile.am"; //$NON-NLS-1$
if (args.length == 1) {
filename = args[0];
}
Automakefile makefile = new Automakefile();
makefile.parse(filename);
IDirective[] directives = makefile.getDirectives();
//IDirective[] directives = makefile.getBuiltins();
for (int i = 0; i < directives.length; i++) {
//System.out.println("Rule[" + i +"]");
System.out.print(directives[i]);
}
} catch (IOException e) {
System.out.println(e);
}
}
}
|