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 ec1bec9a00e..178df673656 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 @@ -289,6 +289,7 @@ public class GnuMakefileGenerator implements IManagedBuilderMakefileGenerator { private IProject project; private IResource[] projectResources; private Vector ruleList; + private Vector depLineList; private Vector subdirList; private IPath topBuildDir; private Set outputExtensionsSet; @@ -1505,87 +1506,90 @@ public class GnuMakefileGenerator implements IManagedBuilderMakefileGenerator { // We can't have duplicates in a makefile if (getRuleList().contains(buildRule)) { - return true; } else { getRuleList().add(buildRule); - } - buffer.append(buildRule + NEWLINE); - if (bTargetTool) { - buffer.append(TAB + AT + ECHO + WHITESPACE + SINGLE_QUOTE + MESSAGE_START_BUILD + WHITESPACE + OUT_MACRO + SINGLE_QUOTE + NEWLINE); - } - buffer.append(TAB + AT + ECHO + WHITESPACE + SINGLE_QUOTE + tool.getAnnouncement() + SINGLE_QUOTE + NEWLINE); - - // Get the command line for this tool invocation - String[] flags; - try { - flags = tool.getToolCommandFlags(null,null); - } catch( BuildException ex ) { - // TODO report error - flags = EMPTY_STRING_ARRAY; - } - String command = tool.getToolCommand(); - try{ - //try to resolve the build macros in the tool command - String resolvedCommand = ManagedBuildManager.getBuildMacroProvider().resolveValueToMakefileFormat(command, - EMPTY_STRING, - WHITESPACE, - IBuildMacroProvider.CONTEXT_FILE, - new FileContextData(null,null,null,info.getDefaultConfiguration().getToolChain())); - if((resolvedCommand = resolvedCommand.trim()).length() > 0) - command = resolvedCommand; - - } catch (BuildMacroException e){ - } - String[] cmdInputs = (String[])inputs.toArray(new String[inputs.size()]); - IManagedCommandLineGenerator gen = tool.getCommandLineGenerator(); - IManagedCommandLineInfo cmdLInfo = gen.generateCommandLineInfo( tool, command, - flags, outflag, outputPrefix, primaryOutputs, cmdInputs, tool.getCommandLinePattern() ); - // The command to build - String buildCmd = null; - if( cmdLInfo == null ) { - String toolFlags; - try { - toolFlags = tool.getToolCommandFlagsString(null,null); - } catch( BuildException ex ) { - // TODO report error - toolFlags = EMPTY_STRING; + buffer.append(buildRule + NEWLINE); + if (bTargetTool) { + buffer.append(TAB + AT + ECHO + WHITESPACE + SINGLE_QUOTE + MESSAGE_START_BUILD + WHITESPACE + OUT_MACRO + SINGLE_QUOTE + NEWLINE); } - buildCmd = command + WHITESPACE + toolFlags + WHITESPACE + outflag + WHITESPACE + outputPrefix + primaryOutputs + WHITESPACE + IN_MACRO; - } - else buildCmd = cmdLInfo.getCommandLine(); - buffer.append(TAB + AT + ECHO + WHITESPACE + buildCmd + NEWLINE); - buffer.append(TAB + AT + buildCmd); - - // TODO - // NOTE WELL: Dependency file generation is not handled for this type of Tool - - // Echo finished message - buffer.append(NEWLINE); - if (bTargetTool) { - buffer.append(TAB + AT + ECHO + WHITESPACE + SINGLE_QUOTE + MESSAGE_FINISH_BUILD + WHITESPACE + OUT_MACRO + SINGLE_QUOTE + NEWLINE); - } else { - buffer.append(TAB + AT + ECHO + WHITESPACE + SINGLE_QUOTE + MESSAGE_FINISH_FILE + WHITESPACE + OUT_MACRO + SINGLE_QUOTE + NEWLINE); - } - buffer.append(TAB + AT + ECHO + WHITESPACE + SINGLE_QUOTE + WHITESPACE + SINGLE_QUOTE + NEWLINE); - - // If there is a post build step, then add a recursive invocation of MAKE to invoke it after the main build - // Note that $(MAKE) will instantiate in the recusive invocation to the make command that was used to invoke - // the makefile originally - if (bEmitPostBuildStepCall) { - buffer.append(TAB + MAKE + WHITESPACE + NO_PRINT_DIR + WHITESPACE + POSTBUILD + NEWLINE + NEWLINE); - } - else { - // Just emit a blank line + buffer.append(TAB + AT + ECHO + WHITESPACE + SINGLE_QUOTE + tool.getAnnouncement() + SINGLE_QUOTE + NEWLINE); + + // Get the command line for this tool invocation + String[] flags; + try { + flags = tool.getToolCommandFlags(null,null); + } catch( BuildException ex ) { + // TODO report error + flags = EMPTY_STRING_ARRAY; + } + String command = tool.getToolCommand(); + try{ + //try to resolve the build macros in the tool command + String resolvedCommand = ManagedBuildManager.getBuildMacroProvider().resolveValueToMakefileFormat(command, + EMPTY_STRING, + WHITESPACE, + IBuildMacroProvider.CONTEXT_FILE, + new FileContextData(null,null,null,info.getDefaultConfiguration().getToolChain())); + if((resolvedCommand = resolvedCommand.trim()).length() > 0) + command = resolvedCommand; + + } catch (BuildMacroException e){ + } + String[] cmdInputs = (String[])inputs.toArray(new String[inputs.size()]); + IManagedCommandLineGenerator gen = tool.getCommandLineGenerator(); + IManagedCommandLineInfo cmdLInfo = gen.generateCommandLineInfo( tool, command, + flags, outflag, outputPrefix, primaryOutputs, cmdInputs, tool.getCommandLinePattern() ); + // The command to build + String buildCmd = null; + if( cmdLInfo == null ) { + String toolFlags; + try { + toolFlags = tool.getToolCommandFlagsString(null,null); + } catch( BuildException ex ) { + // TODO report error + toolFlags = EMPTY_STRING; + } + buildCmd = command + WHITESPACE + toolFlags + WHITESPACE + outflag + WHITESPACE + outputPrefix + primaryOutputs + WHITESPACE + IN_MACRO; + } + else buildCmd = cmdLInfo.getCommandLine(); + buffer.append(TAB + AT + ECHO + WHITESPACE + buildCmd + NEWLINE); + buffer.append(TAB + AT + buildCmd); + + // TODO + // NOTE WELL: Dependency file generation is not handled for this type of Tool + + // Echo finished message buffer.append(NEWLINE); - } + if (bTargetTool) { + buffer.append(TAB + AT + ECHO + WHITESPACE + SINGLE_QUOTE + MESSAGE_FINISH_BUILD + WHITESPACE + OUT_MACRO + SINGLE_QUOTE + NEWLINE); + } else { + buffer.append(TAB + AT + ECHO + WHITESPACE + SINGLE_QUOTE + MESSAGE_FINISH_FILE + WHITESPACE + OUT_MACRO + SINGLE_QUOTE + NEWLINE); + } + buffer.append(TAB + AT + ECHO + WHITESPACE + SINGLE_QUOTE + WHITESPACE + SINGLE_QUOTE + NEWLINE); + + // If there is a post build step, then add a recursive invocation of MAKE to invoke it after the main build + // Note that $(MAKE) will instantiate in the recusive invocation to the make command that was used to invoke + // the makefile originally + if (bEmitPostBuildStepCall) { + buffer.append(TAB + MAKE + WHITESPACE + NO_PRINT_DIR + WHITESPACE + POSTBUILD + NEWLINE + NEWLINE); + } + else { + // Just emit a blank line + buffer.append(NEWLINE); + } + } // If we have secondary outputs, output dependency rules without commands if (enumeratedSecondaryOutputs.size() > 0) { String primaryOutput = (String)enumeratedPrimaryOutputs.get(0); for (int i=0; i 0) { + calculatedDependencies = new String(); + for (int i=0; i