mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-29 19:45:01 +02:00
Fix bugs with external dependency calculation
This commit is contained in:
parent
55872940c2
commit
b3614c4ad4
1 changed files with 228 additions and 175 deletions
|
@ -289,6 +289,7 @@ public class GnuMakefileGenerator implements IManagedBuilderMakefileGenerator {
|
||||||
private IProject project;
|
private IProject project;
|
||||||
private IResource[] projectResources;
|
private IResource[] projectResources;
|
||||||
private Vector ruleList;
|
private Vector ruleList;
|
||||||
|
private Vector depLineList;
|
||||||
private Vector subdirList;
|
private Vector subdirList;
|
||||||
private IPath topBuildDir;
|
private IPath topBuildDir;
|
||||||
private Set outputExtensionsSet;
|
private Set outputExtensionsSet;
|
||||||
|
@ -1505,87 +1506,90 @@ public class GnuMakefileGenerator implements IManagedBuilderMakefileGenerator {
|
||||||
|
|
||||||
// We can't have duplicates in a makefile
|
// We can't have duplicates in a makefile
|
||||||
if (getRuleList().contains(buildRule)) {
|
if (getRuleList().contains(buildRule)) {
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
getRuleList().add(buildRule);
|
getRuleList().add(buildRule);
|
||||||
}
|
buffer.append(buildRule + NEWLINE);
|
||||||
buffer.append(buildRule + NEWLINE);
|
if (bTargetTool) {
|
||||||
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 + 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;
|
|
||||||
}
|
}
|
||||||
buildCmd = command + WHITESPACE + toolFlags + WHITESPACE + outflag + WHITESPACE + outputPrefix + primaryOutputs + WHITESPACE + IN_MACRO;
|
buffer.append(TAB + AT + ECHO + WHITESPACE + SINGLE_QUOTE + tool.getAnnouncement() + SINGLE_QUOTE + NEWLINE);
|
||||||
}
|
|
||||||
else buildCmd = cmdLInfo.getCommandLine();
|
// Get the command line for this tool invocation
|
||||||
buffer.append(TAB + AT + ECHO + WHITESPACE + buildCmd + NEWLINE);
|
String[] flags;
|
||||||
buffer.append(TAB + AT + buildCmd);
|
try {
|
||||||
|
flags = tool.getToolCommandFlags(null,null);
|
||||||
// TODO
|
} catch( BuildException ex ) {
|
||||||
// NOTE WELL: Dependency file generation is not handled for this type of Tool
|
// TODO report error
|
||||||
|
flags = EMPTY_STRING_ARRAY;
|
||||||
// Echo finished message
|
}
|
||||||
buffer.append(NEWLINE);
|
String command = tool.getToolCommand();
|
||||||
if (bTargetTool) {
|
try{
|
||||||
buffer.append(TAB + AT + ECHO + WHITESPACE + SINGLE_QUOTE + MESSAGE_FINISH_BUILD + WHITESPACE + OUT_MACRO + SINGLE_QUOTE + NEWLINE);
|
//try to resolve the build macros in the tool command
|
||||||
} else {
|
String resolvedCommand = ManagedBuildManager.getBuildMacroProvider().resolveValueToMakefileFormat(command,
|
||||||
buffer.append(TAB + AT + ECHO + WHITESPACE + SINGLE_QUOTE + MESSAGE_FINISH_FILE + WHITESPACE + OUT_MACRO + SINGLE_QUOTE + NEWLINE);
|
EMPTY_STRING,
|
||||||
}
|
WHITESPACE,
|
||||||
buffer.append(TAB + AT + ECHO + WHITESPACE + SINGLE_QUOTE + WHITESPACE + SINGLE_QUOTE + NEWLINE);
|
IBuildMacroProvider.CONTEXT_FILE,
|
||||||
|
new FileContextData(null,null,null,info.getDefaultConfiguration().getToolChain()));
|
||||||
// If there is a post build step, then add a recursive invocation of MAKE to invoke it after the main build
|
if((resolvedCommand = resolvedCommand.trim()).length() > 0)
|
||||||
// Note that $(MAKE) will instantiate in the recusive invocation to the make command that was used to invoke
|
command = resolvedCommand;
|
||||||
// the makefile originally
|
|
||||||
if (bEmitPostBuildStepCall) {
|
} catch (BuildMacroException e){
|
||||||
buffer.append(TAB + MAKE + WHITESPACE + NO_PRINT_DIR + WHITESPACE + POSTBUILD + NEWLINE + NEWLINE);
|
}
|
||||||
}
|
String[] cmdInputs = (String[])inputs.toArray(new String[inputs.size()]);
|
||||||
else {
|
IManagedCommandLineGenerator gen = tool.getCommandLineGenerator();
|
||||||
// Just emit a blank line
|
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);
|
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 we have secondary outputs, output dependency rules without commands
|
||||||
if (enumeratedSecondaryOutputs.size() > 0) {
|
if (enumeratedSecondaryOutputs.size() > 0) {
|
||||||
String primaryOutput = (String)enumeratedPrimaryOutputs.get(0);
|
String primaryOutput = (String)enumeratedPrimaryOutputs.get(0);
|
||||||
for (int i=0; i<enumeratedSecondaryOutputs.size(); i++) {
|
for (int i=0; i<enumeratedSecondaryOutputs.size(); i++) {
|
||||||
String output = (String)enumeratedSecondaryOutputs.get(0);
|
String output = (String)enumeratedSecondaryOutputs.get(0);
|
||||||
buffer.append(output + COLON + WHITESPACE + primaryOutput + NEWLINE);
|
String depLine = output + COLON + WHITESPACE + primaryOutput + NEWLINE;
|
||||||
|
if (!getDepLineList().contains(depLine)) {
|
||||||
|
getDepLineList().add(depLine);
|
||||||
|
buffer.append(depLine);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
buffer.append(NEWLINE);
|
buffer.append(NEWLINE);
|
||||||
}
|
}
|
||||||
|
@ -2177,133 +2181,159 @@ public class GnuMakefileGenerator implements IManagedBuilderMakefileGenerator {
|
||||||
buildRule += WHITESPACE + addlPath.toString();
|
buildRule += WHITESPACE + addlPath.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
// No duplicates in a makefile. If we already have this rule, return
|
// No duplicates in a makefile. If we already have this rule, don't add it or the commands to build the file
|
||||||
if (getRuleList().contains(buildRule)) {
|
if (getRuleList().contains(buildRule)) {
|
||||||
// TODO: Should we assert that this is a pattern rule?
|
// TODO: Should we assert that this is a pattern rule?
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
getRuleList().add(buildRule);
|
getRuleList().add(buildRule);
|
||||||
}
|
|
||||||
|
|
||||||
// Echo starting message
|
// Echo starting message
|
||||||
buffer.append(buildRule + NEWLINE);
|
buffer.append(buildRule + NEWLINE);
|
||||||
buffer.append(TAB + AT + ECHO + WHITESPACE + SINGLE_QUOTE + MESSAGE_START_FILE + WHITESPACE + IN_MACRO + SINGLE_QUOTE + NEWLINE);
|
buffer.append(TAB + AT + ECHO + WHITESPACE + SINGLE_QUOTE + MESSAGE_START_FILE + WHITESPACE + IN_MACRO + SINGLE_QUOTE + NEWLINE);
|
||||||
|
|
||||||
// Generate the command line
|
// Generate the command line
|
||||||
IManagedCommandLineInfo cmdLInfo = null;
|
IManagedCommandLineInfo cmdLInfo = null;
|
||||||
Vector inputs = new Vector();
|
Vector inputs = new Vector();
|
||||||
inputs.add(IN_MACRO);
|
inputs.add(IN_MACRO);
|
||||||
String outflag = null;
|
String outflag = null;
|
||||||
String outputPrefix = null;
|
String outputPrefix = null;
|
||||||
|
|
||||||
if( resConfig != null || fileExplicitMacrosReferenced) {
|
if( resConfig != null || fileExplicitMacrosReferenced) {
|
||||||
buffer.append(TAB + AT + ECHO + WHITESPACE + SINGLE_QUOTE + tool.getAnnouncement() + SINGLE_QUOTE + NEWLINE);
|
buffer.append(TAB + AT + ECHO + WHITESPACE + SINGLE_QUOTE + tool.getAnnouncement() + SINGLE_QUOTE + NEWLINE);
|
||||||
outflag = tool.getOutputFlag();
|
outflag = tool.getOutputFlag();
|
||||||
outputPrefix = tool.getOutputPrefix();
|
outputPrefix = tool.getOutputPrefix();
|
||||||
String[] flags = null;
|
String[] flags = null;
|
||||||
try {
|
try {
|
||||||
flags = tool.getToolCommandFlags(sourceLocation, outputLocation);
|
flags = tool.getToolCommandFlags(sourceLocation, outputLocation);
|
||||||
} catch( BuildException ex ) {
|
} catch( BuildException ex ) {
|
||||||
// TODO add some routines to catch this
|
// TODO add some routines to catch this
|
||||||
flags = EMPTY_STRING_ARRAY;
|
flags = EMPTY_STRING_ARRAY;
|
||||||
}
|
}
|
||||||
// Other additional inputs
|
// Other additional inputs
|
||||||
// Get any additional dependencies specified for the tool in other InputType elements and AdditionalInput elements
|
// Get any additional dependencies specified for the tool in other InputType elements and AdditionalInput elements
|
||||||
IPath[] addlInputPaths = tool.getAdditionalResources();
|
IPath[] addlInputPaths = tool.getAdditionalResources();
|
||||||
for (int i=0; i<addlInputPaths.length; i++) {
|
for (int i=0; i<addlInputPaths.length; i++) {
|
||||||
// Translate the path from project relative to
|
// Translate the path from project relative to
|
||||||
// build directory relative
|
// build directory relative
|
||||||
IPath addlPath = addlInputPaths[i];
|
IPath addlPath = addlInputPaths[i];
|
||||||
if (!(addlPath.toString().startsWith("$("))) { //$NON-NLS-1$
|
if (!(addlPath.toString().startsWith("$("))) { //$NON-NLS-1$
|
||||||
if (!addlPath.isAbsolute()) {
|
if (!addlPath.isAbsolute()) {
|
||||||
IPath tempPath = project.getLocation().append(addlPath);
|
IPath tempPath = project.getLocation().append(addlPath);
|
||||||
if (tempPath != null) {
|
if (tempPath != null) {
|
||||||
addlPath = calculateRelativePath(getTopBuildDir(), tempPath);
|
addlPath = calculateRelativePath(getTopBuildDir(), tempPath);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
inputs.add(addlPath.toString());
|
||||||
}
|
}
|
||||||
inputs.add(addlPath.toString());
|
// Call the command line generator
|
||||||
}
|
IManagedCommandLineGenerator cmdLGen = tool.getCommandLineGenerator();
|
||||||
// Call the command line generator
|
cmdLInfo = cmdLGen.generateCommandLineInfo( tool, cmd, flags, outflag, outputPrefix,
|
||||||
IManagedCommandLineGenerator cmdLGen = tool.getCommandLineGenerator();
|
OUT_MACRO + otherPrimaryOutputs, (String[])inputs.toArray(new String[inputs.size()]), tool.getCommandLinePattern() );
|
||||||
cmdLInfo = cmdLGen.generateCommandLineInfo( tool, cmd, flags, outflag, outputPrefix,
|
|
||||||
OUT_MACRO + otherPrimaryOutputs, (String[])inputs.toArray(new String[inputs.size()]), tool.getCommandLinePattern() );
|
String buildCmd = cmdLInfo.getCommandLine();
|
||||||
|
buffer.append(TAB + AT + ECHO + WHITESPACE + buildCmd + NEWLINE);
|
||||||
String buildCmd = cmdLInfo.getCommandLine();
|
buffer.append(TAB + AT + buildCmd);
|
||||||
buffer.append(TAB + AT + ECHO + WHITESPACE + buildCmd + NEWLINE);
|
} else {
|
||||||
buffer.append(TAB + AT + buildCmd);
|
buffer.append(TAB + AT + ECHO + WHITESPACE + SINGLE_QUOTE + tool.getAnnouncement() + SINGLE_QUOTE + NEWLINE);
|
||||||
} else {
|
String buildFlags = EMPTY_STRING;
|
||||||
buffer.append(TAB + AT + ECHO + WHITESPACE + SINGLE_QUOTE + tool.getAnnouncement() + SINGLE_QUOTE + NEWLINE);
|
try {
|
||||||
String buildFlags = EMPTY_STRING;
|
buildFlags = tool.getToolCommandFlagsString(sourceLocation, outputLocation);
|
||||||
try {
|
} catch (BuildException e) {
|
||||||
buildFlags = tool.getToolCommandFlagsString(sourceLocation, outputLocation);
|
}
|
||||||
} catch (BuildException e) {
|
outflag = info.getOutputFlag(outputExtension);
|
||||||
}
|
outputPrefix = info.getOutputPrefix(outputExtension);
|
||||||
outflag = info.getOutputFlag(outputExtension);
|
String[] flags = buildFlags.split( "\\s" ); //$NON-NLS-1$
|
||||||
outputPrefix = info.getOutputPrefix(outputExtension);
|
// Other additional inputs
|
||||||
String[] flags = buildFlags.split( "\\s" ); //$NON-NLS-1$
|
// Get any additional dependencies specified for the tool in other InputType elements and AdditionalInput elements
|
||||||
// Other additional inputs
|
IPath[] addlInputPaths = tool.getAdditionalResources();
|
||||||
// Get any additional dependencies specified for the tool in other InputType elements and AdditionalInput elements
|
for (int i=0; i<addlInputPaths.length; i++) {
|
||||||
IPath[] addlInputPaths = tool.getAdditionalResources();
|
// Translate the path from project relative to
|
||||||
for (int i=0; i<addlInputPaths.length; i++) {
|
// build directory relative
|
||||||
// Translate the path from project relative to
|
IPath addlPath = addlInputPaths[i];
|
||||||
// build directory relative
|
if (!(addlPath.toString().startsWith("$("))) { //$NON-NLS-1$
|
||||||
IPath addlPath = addlInputPaths[i];
|
if (!addlPath.isAbsolute()) {
|
||||||
if (!(addlPath.toString().startsWith("$("))) { //$NON-NLS-1$
|
IPath tempPath = project.getLocation().append(addlPath);
|
||||||
if (!addlPath.isAbsolute()) {
|
if (tempPath != null) {
|
||||||
IPath tempPath = project.getLocation().append(addlPath);
|
addlPath = calculateRelativePath(getTopBuildDir(), tempPath);
|
||||||
if (tempPath != null) {
|
}
|
||||||
addlPath = calculateRelativePath(getTopBuildDir(), tempPath);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
inputs.add(addlPath.toString());
|
||||||
}
|
}
|
||||||
inputs.add(addlPath.toString());
|
// Call the command line generator
|
||||||
|
cmdLInfo = info.generateToolCommandLineInfo( inputExtension, flags, outflag, outputPrefix,
|
||||||
|
OUT_MACRO + otherPrimaryOutputs, (String[])inputs.toArray(new String[inputs.size()]), sourceLocation, outputLocation );
|
||||||
|
// The command to build
|
||||||
|
String buildCmd = null;
|
||||||
|
if( cmdLInfo == null ) buildCmd = cmd + WHITESPACE + buildFlags + WHITESPACE +
|
||||||
|
outflag + WHITESPACE + outputPrefix + OUT_MACRO + otherPrimaryOutputs + WHITESPACE + IN_MACRO;
|
||||||
|
else buildCmd = cmdLInfo.getCommandLine();
|
||||||
|
buffer.append(TAB + AT + ECHO + WHITESPACE + buildCmd + NEWLINE);
|
||||||
|
buffer.append(TAB + AT + buildCmd);
|
||||||
}
|
}
|
||||||
// Call the command line generator
|
|
||||||
cmdLInfo = info.generateToolCommandLineInfo( inputExtension, flags, outflag, outputPrefix,
|
// Determine if there are any dependencies to calculate
|
||||||
OUT_MACRO + otherPrimaryOutputs, (String[])inputs.toArray(new String[inputs.size()]), sourceLocation, outputLocation );
|
// TODO: Note that there is an assumption built into this method that if the build rule is the same
|
||||||
// The command to build
|
// for a set of resources, the dependency command will also be the same. That is, this method
|
||||||
String buildCmd = null;
|
// will not reach this code if the build rule is the same (see above).
|
||||||
if( cmdLInfo == null ) buildCmd = cmd + WHITESPACE + buildFlags + WHITESPACE +
|
if (doDepGen && depGen.getCalculatorType() == IManagedDependencyGenerator.TYPE_COMMAND) {
|
||||||
outflag + WHITESPACE + outputPrefix + OUT_MACRO + otherPrimaryOutputs + WHITESPACE + IN_MACRO;
|
buffer.append(WHITESPACE + LOGICAL_AND + WHITESPACE + LINEBREAK);
|
||||||
else buildCmd = cmdLInfo.getCommandLine();
|
// Get the dependency rule out of the generator
|
||||||
buffer.append(TAB + AT + ECHO + WHITESPACE + buildCmd + NEWLINE);
|
String depCmd = depGen.getDependencyCommand(resource, info);
|
||||||
buffer.append(TAB + AT + buildCmd);
|
buffer.append(depCmd);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Echo finished message
|
||||||
|
buffer.append(NEWLINE);
|
||||||
|
buffer.append(TAB + AT + ECHO + WHITESPACE + SINGLE_QUOTE + MESSAGE_FINISH_FILE + WHITESPACE + IN_MACRO + SINGLE_QUOTE + NEWLINE);
|
||||||
|
buffer.append(TAB + AT + ECHO + WHITESPACE + SINGLE_QUOTE + WHITESPACE + SINGLE_QUOTE + NEWLINE + NEWLINE);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Determine if there are any dependencies to calculate
|
|
||||||
if (doDepGen && depGen.getCalculatorType() == IManagedDependencyGenerator.TYPE_COMMAND) {
|
|
||||||
buffer.append(WHITESPACE + LOGICAL_AND + WHITESPACE + LINEBREAK);
|
|
||||||
// Get the dependency rule out of the generator
|
|
||||||
String depCmd = depGen.getDependencyCommand(resource, info);
|
|
||||||
buffer.append(depCmd);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Echo finished message
|
|
||||||
buffer.append(NEWLINE);
|
|
||||||
buffer.append(TAB + AT + ECHO + WHITESPACE + SINGLE_QUOTE + MESSAGE_FINISH_FILE + WHITESPACE + IN_MACRO + SINGLE_QUOTE + NEWLINE);
|
|
||||||
buffer.append(TAB + AT + ECHO + WHITESPACE + SINGLE_QUOTE + WHITESPACE + SINGLE_QUOTE + NEWLINE + NEWLINE);
|
|
||||||
|
|
||||||
|
// Determine if there are calculated dependencies
|
||||||
// Add separate dependency lines per file if necessary
|
String calculatedDependencies = null;
|
||||||
boolean addedDepLines = false;
|
boolean addedDepLines = false;
|
||||||
|
String depLine;
|
||||||
if (depGen != null && depGen.getCalculatorType() != IManagedDependencyGenerator.TYPE_COMMAND) {
|
if (depGen != null && depGen.getCalculatorType() != IManagedDependencyGenerator.TYPE_COMMAND) {
|
||||||
Vector addlDepsVector = calculateDependenciesForSource(depGen, tool, relativePath, resource);
|
Vector addlDepsVector = calculateDependenciesForSource(depGen, tool, relativePath, resource);
|
||||||
for (int i=0; i<addlDepsVector.size(); i++) {
|
if (addlDepsVector != null && addlDepsVector.size() > 0) {
|
||||||
buffer.append(primaryOutputName + COLON + WHITESPACE + addlDepsVector.get(i).toString() + NEWLINE);
|
calculatedDependencies = new String();
|
||||||
|
for (int i=0; i<addlDepsVector.size(); i++) {
|
||||||
|
calculatedDependencies += WHITESPACE + addlDepsVector.get(i).toString();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (calculatedDependencies != null) {
|
||||||
|
depLine = primaryOutputName + COLON + calculatedDependencies + NEWLINE;
|
||||||
|
if (!getDepLineList().contains(depLine)) {
|
||||||
|
getDepLineList().add(depLine);
|
||||||
addedDepLines = true;
|
addedDepLines = true;
|
||||||
|
buffer.append(depLine);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add any additional outputs here using dependency lines
|
// Add any additional outputs here using dependency lines
|
||||||
for (int i=1; i<enumeratedPrimaryOutputs.size(); i++) { // Starting a 1 is intentional
|
for (int i=1; i<enumeratedPrimaryOutputs.size(); i++) { // Starting a 1 is intentional
|
||||||
buffer.append(((IPath)enumeratedPrimaryOutputs.get(i)).toString() + COLON + WHITESPACE + primaryOutputName + NEWLINE);
|
depLine = ((IPath)enumeratedPrimaryOutputs.get(i)).toString() + COLON + WHITESPACE + primaryOutputName;
|
||||||
addedDepLines = true;
|
if (calculatedDependencies != null) depLine += calculatedDependencies;
|
||||||
|
depLine += NEWLINE;
|
||||||
|
if (!getDepLineList().contains(depLine)) {
|
||||||
|
getDepLineList().add(depLine);
|
||||||
|
addedDepLines = true;
|
||||||
|
buffer.append(depLine);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
for (int i=0; i<enumeratedSecondaryOutputs.size(); i++) {
|
for (int i=0; i<enumeratedSecondaryOutputs.size(); i++) {
|
||||||
buffer.append(((IPath)enumeratedSecondaryOutputs.get(i)).toString() + COLON + WHITESPACE + primaryOutputName + NEWLINE);
|
depLine = ((IPath)enumeratedSecondaryOutputs.get(i)).toString() + COLON + WHITESPACE + primaryOutputName;
|
||||||
addedDepLines = true;
|
if (calculatedDependencies != null) depLine += calculatedDependencies;
|
||||||
|
depLine += NEWLINE;
|
||||||
|
if (!getDepLineList().contains(depLine)) {
|
||||||
|
getDepLineList().add(depLine);
|
||||||
|
addedDepLines = true;
|
||||||
|
buffer.append(depLine);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (addedDepLines) {
|
if (addedDepLines) {
|
||||||
buffer.append(NEWLINE);
|
buffer.append(NEWLINE);
|
||||||
|
@ -2510,9 +2540,19 @@ public class GnuMakefileGenerator implements IManagedBuilderMakefileGenerator {
|
||||||
case IManagedDependencyGenerator.TYPE_INDEXER:
|
case IManagedDependencyGenerator.TYPE_INDEXER:
|
||||||
case IManagedDependencyGenerator.TYPE_EXTERNAL:
|
case IManagedDependencyGenerator.TYPE_EXTERNAL:
|
||||||
IResource[] res = depGen.findDependencies(resource, project);
|
IResource[] res = depGen.findDependencies(resource, project);
|
||||||
for (int i=0; i<res.length; i++) {
|
if (res != null) {
|
||||||
IPath dep = res[i].getProjectRelativePath();
|
for (int i=0; i<res.length; i++) {
|
||||||
deps.add(dep);
|
IPath dep = null;
|
||||||
|
if (res[i] != null) {
|
||||||
|
IPath addlPath = res[i].getLocation();
|
||||||
|
if (addlPath != null) {
|
||||||
|
dep = calculateRelativePath(getTopBuildDir(), addlPath);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (dep != null) {
|
||||||
|
deps.add(dep);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -2984,6 +3024,19 @@ public class GnuMakefileGenerator implements IManagedBuilderMakefileGenerator {
|
||||||
return ruleList;
|
return ruleList;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* (non-javadoc)
|
||||||
|
* Returns the list of known dependency lines. This keeps me from generating duplicate
|
||||||
|
* lines.
|
||||||
|
*
|
||||||
|
* @return List
|
||||||
|
*/
|
||||||
|
protected Vector getDepLineList() {
|
||||||
|
if (depLineList == null) {
|
||||||
|
depLineList = new Vector();
|
||||||
|
}
|
||||||
|
return depLineList;
|
||||||
|
}
|
||||||
|
|
||||||
/*************************************************************************
|
/*************************************************************************
|
||||||
* R E S O U R C E V I S I T O R M E T H O D S
|
* R E S O U R C E V I S I T O R M E T H O D S
|
||||||
************************************************************************/
|
************************************************************************/
|
||||||
|
|
Loading…
Add table
Reference in a new issue