1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-08-30 11:43:33 +02:00

Fix for bugzilla 70491 - Unable to build source files in a linked directory. Now the makefile generator will create an explicit rule for linked resources and convert the path to absolute.

This commit is contained in:
Sean Evoy 2004-08-16 17:09:55 +00:00
parent 066c8a91fc
commit aee11e012b
2 changed files with 30 additions and 6 deletions

View file

@ -386,8 +386,8 @@ Additional special types exist to flag options of special relevance to the build
<attribute name="defaultValue" type="string">
<annotation>
<documentation>
This field is used to record the value of the option that the user has set in the build settings file. For example, if the user has set the verbose flag to true, the project&apos;s build settings file will contain an option reference for the verbose option, with the defaultvalue set to true.
&lt;p&gt;The attribute is also used to override the default option setting for a configuration in a toolchain. For example, a &apos;Debug&apos; configuration may setthe value of a debug flag differently than the default value defined in the tool.
This field is used to record the value of the option that the user has set in the build settings file. For example, if the user has set the verbose flag to true, the project&apos;s build settings file will contain an option reference for the verbose option, with the defaultValue set to true.
&lt;p&gt;The attribute is also used to override the default option setting for a configuration in a toolchain. For example, a &apos;Debug&apos; configuration may set the value of a debug flag differently than the default value defined in the tool.
</documentation>
</annotation>
</attribute>

View file

@ -331,9 +331,33 @@ public class GnuMakefileGenerator implements IManagedBuilderMakefileGenerator {
String depFile = relativePath + resourceName + DOT + DEP_EXT;
getDependencyMakefiles().add(depFile);
}
/*
* fix for PR 70491
* We need to check if the current resource is LINKED, because
* the default CDT doesn't handle this properly. If it IS linked,
* then we must get the actual location of the resource, rather
* than the relative path.
*/
IPath resourceLocation = resource.getLocation();
String projectLocation = project.getLocation().toString();
String resourcePath = null;
String buildRule = null;
// figure out path to use to resource
if(!resourceLocation.toString().startsWith(projectLocation)) {
// it IS linked, so use the actual location
resourcePath = resourceLocation.toString();
// Need a hardcoded rule, not a pattern rule, as a linked file
// can reside in any path
buildRule = relativePath + resourceName + DOT + outputExtension + COLON + WHITESPACE + resourcePath;
} else {
// use the relative path (not really needed to store per se but in the future someone may want this)
resourcePath = relativePath;
// The rule and command to add to the makefile
buildRule = relativePath + WILDCARD + DOT + outputExtension + COLON + WHITESPACE + ROOT + SEPARATOR + resourcePath + WILDCARD + DOT + inputExtension;
} // end fix for PR 70491
// Add the rule and command to the makefile
String buildRule = relativePath + WILDCARD + DOT + outputExtension + COLON + WHITESPACE + ROOT + SEPARATOR + relativePath + WILDCARD + DOT + inputExtension;
// No duplicates in a makefile
if (getRuleList().contains(buildRule)) {
return;
}
@ -347,7 +371,7 @@ public class GnuMakefileGenerator implements IManagedBuilderMakefileGenerator {
outputPrefix = info.getOutputPrefix(outputExtension);
// The command to build
String buildCmd = cmd + WHITESPACE + buildFlags + WHITESPACE + outflag + outputPrefix + OUT_MACRO + WHITESPACE + IN_MACRO;
String buildCmd = cmd + WHITESPACE + buildFlags + WHITESPACE + outflag + WHITESPACE + outputPrefix + OUT_MACRO + WHITESPACE + IN_MACRO;
buffer.append(TAB + AT + ECHO + WHITESPACE + buildCmd + NEWLINE);
buffer.append(TAB + AT + buildCmd);
@ -583,7 +607,7 @@ public class GnuMakefileGenerator implements IManagedBuilderMakefileGenerator {
}
buffer.append(NEWLINE);
buffer.append(TAB + AT + ECHO + WHITESPACE + SINGLE_QUOTE + MESSAGE_START_BUILD + WHITESPACE + OUT_MACRO + SINGLE_QUOTE + NEWLINE);
buffer.append(TAB + cmd + WHITESPACE + flags + WHITESPACE + outflag + OUT_MACRO + WHITESPACE + "$(OBJS) $(USER_OBJS) $(LIBS)" + NEWLINE); //$NON-NLS-1$
buffer.append(TAB + cmd + WHITESPACE + flags + WHITESPACE + outflag + WHITESPACE + OUT_MACRO + WHITESPACE + "$(OBJS) $(USER_OBJS) $(LIBS)" + NEWLINE); //$NON-NLS-1$
buffer.append(TAB + AT + ECHO + WHITESPACE + SINGLE_QUOTE + MESSAGE_FINISH_FILE + WHITESPACE + OUT_MACRO + SINGLE_QUOTE + NEWLINE + NEWLINE);
// Always add a clean target