From 7867099287697f04cdc64cad3313f3cc424e5d80 Mon Sep 17 00:00:00 2001 From: Andrew Gvozdev Date: Sat, 2 Jul 2011 00:41:56 -0400 Subject: [PATCH] bug 312835: CDT build settings which are set at the folder level are ignored in certain situations. Based on patch from MJ --- .../makegen/gnu/GnuMakefileGenerator.java | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/makegen/gnu/GnuMakefileGenerator.java b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/makegen/gnu/GnuMakefileGenerator.java index 45e6bf1bbfb..f73baa7605a 100644 --- a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/makegen/gnu/GnuMakefileGenerator.java +++ b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/makegen/gnu/GnuMakefileGenerator.java @@ -1207,16 +1207,17 @@ public class GnuMakefileGenerator implements IManagedBuilderMakefileGenerator2 { buffer.append(COMMENT_SYMBOL + WHITESPACE + ManagedMakeMessages.getResourceString(SRC_LISTS) + NEWLINE); buffer.append("-include sources.mk" + NEWLINE); //$NON-NLS-1$ - // add an include for each subdir - buffer.append("-include subdir.mk" + NEWLINE); //$NON-NLS-1$ - - for (IResource res : getSubdirList()) { - IContainer subDir = (IContainer)res; + // Add includes for each subdir in child-subdir-first order (required for makefile rule matching to work). + List subDirList = new ArrayList(); + for (IContainer subDir : getSubdirList()) { IPath projectRelativePath = subDir.getProjectRelativePath(); - if(!projectRelativePath.toString().equals("")) //$NON-NLS-1$ - buffer.append("-include " + escapeWhitespaces(projectRelativePath.toString()) + SEPARATOR + "subdir.mk"+ NEWLINE); //$NON-NLS-1$ //$NON-NLS-2$ + subDirList.add(0, projectRelativePath.toString()); } + for (String dir : subDirList) { + buffer.append("-include " + escapeWhitespaces(dir) + SEPARATOR + "subdir.mk"+ NEWLINE); //$NON-NLS-1$ //$NON-NLS-2$ + } + buffer.append("-include subdir.mk" + NEWLINE); //$NON-NLS-1$ buffer.append("-include objects.mk" + NEWLINE + NEWLINE); //$NON-NLS-1$