1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-23 22:52:11 +02:00

Fix for bugzilla 70491 -- Unable to build source files in a linked directory

This commit is contained in:
Sean Evoy 2004-08-16 17:50:55 +00:00
parent 5a650d1e6e
commit af2454ec98

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;
}