Skip to main content
aboutsummaryrefslogtreecommitdiffstats
path: root/build
diff options
context:
space:
mode:
authorAlain Magloire2004-09-10 15:24:30 -0400
committerAlain Magloire2004-09-10 15:24:30 -0400
commitabf050d6578a60b9bcfffb36b6b6e985cd733abb (patch)
treeb5a70d01477515d4c4c4814d8d08215c1ddf59ba /build
parent51c39598f141723d179660114c456c96d8ab2ffe (diff)
downloadorg.eclipse.cdt-abf050d6578a60b9bcfffb36b6b6e985cd733abb.tar.gz
org.eclipse.cdt-abf050d6578a60b9bcfffb36b6b6e985cd733abb.tar.xz
org.eclipse.cdt-abf050d6578a60b9bcfffb36b6b6e985cd733abb.zip
set the filename for include directives
Diffstat (limited to 'build')
-rw-r--r--build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/AbstractMakefile.java4
-rw-r--r--build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/Parent.java4
-rw-r--r--build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/gnu/GNUMakefile.java16
-rw-r--r--build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/gnu/Include.java12
4 files changed, 32 insertions, 4 deletions
diff --git a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/AbstractMakefile.java b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/AbstractMakefile.java
index 9dc0d7d7faa..11490afeb01 100644
--- a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/AbstractMakefile.java
+++ b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/AbstractMakefile.java
@@ -45,7 +45,7 @@ public abstract class AbstractMakefile extends Parent implements IMakefile {
public abstract IDirective[] getBuiltins();
public IRule[] getRules() {
- IDirective[] stmts = getDirectives();
+ IDirective[] stmts = getDirectives(true);
List array = new ArrayList(stmts.length);
for (int i = 0; i < stmts.length; i++) {
if (stmts[i] instanceof IRule) {
@@ -111,7 +111,7 @@ public abstract class AbstractMakefile extends Parent implements IMakefile {
}
public IMacroDefinition[] getMacroDefinitions() {
- IDirective[] stmts = getDirectives();
+ IDirective[] stmts = getDirectives(true);
List array = new ArrayList(stmts.length);
for (int i = 0; i < stmts.length; i++) {
if (stmts[i] instanceof IMacroDefinition) {
diff --git a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/Parent.java b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/Parent.java
index d69395c3a62..49f06a2d7df 100644
--- a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/Parent.java
+++ b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/Parent.java
@@ -28,6 +28,10 @@ public abstract class Parent extends Directive implements IParent {
super(parent);
}
+ public IDirective[] getDirectives(boolean expand) {
+ return getDirectives();
+ }
+
public IDirective[] getDirectives() {
children.trimToSize();
return (IDirective[]) children.toArray(new IDirective[0]);
diff --git a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/gnu/GNUMakefile.java b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/gnu/GNUMakefile.java
index f36308f688a..84ed943df77 100644
--- a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/gnu/GNUMakefile.java
+++ b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/gnu/GNUMakefile.java
@@ -18,6 +18,7 @@ import java.io.InputStreamReader;
import java.io.Reader;
import java.net.URL;
import java.util.ArrayList;
+import java.util.Arrays;
import java.util.List;
import java.util.Stack;
import java.util.StringTokenizer;
@@ -765,6 +766,21 @@ public class GNUMakefile extends AbstractMakefile implements IGNUMakefile {
return new InferenceRule(this, new Target(tgt));
}
+ public IDirective[] getDirectives(boolean expand) {
+ if (!expand) {
+ return getDirectives();
+ }
+ IDirective[] dirs = getDirectives();
+ ArrayList list = new ArrayList(Arrays.asList(dirs));
+ for (int i = 0; i < dirs.length; ++i) {
+ if (dirs[i] instanceof Include) {
+ Include include = (Include)dirs[i];
+ list.addAll(Arrays.asList(include.getDirectives()));
+ }
+ }
+ return (IDirective[]) list.toArray(new IDirective[list.size()]);
+ }
+
/* (non-Javadoc)
* @see org.eclipse.cdt.make.internal.core.makefile.AbstractMakefile#getBuiltins()
*/
diff --git a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/gnu/Include.java b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/gnu/Include.java
index 4b7b40ccede..d3a8466fae4 100644
--- a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/gnu/Include.java
+++ b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/gnu/Include.java
@@ -47,7 +47,11 @@ public class Include extends Parent implements IInclude {
// Try the current directory.
try {
gnu.parse(filenames[i]);
- addDirectives(gnu.getStatements());
+ Directive[] subdirs = gnu.getStatements();
+ addDirectives(subdirs);
+ for (int k = 0; k < subdirs.length; ++k) {
+ subdirs[k].setFilename(filenames[i]);
+ }
continue;
} catch (IOException e) {
}
@@ -56,7 +60,11 @@ public class Include extends Parent implements IInclude {
try {
String filename = dirs[j] + GNUMakefile.FILE_SEPARATOR + filenames[i];
gnu.parse(filename);
- addDirectives(gnu.getStatements());
+ Directive[] subdirs = gnu.getStatements();
+ addDirectives(subdirs);
+ for (int k = 0; k < subdirs.length; ++k) {
+ subdirs[k].setFilename(filename);
+ }
break;
} catch (IOException e) {
}

Back to the top