Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[cdt-patch] Patch which fixes Bug #77399

Attached find a patch to MMS UI plugin that fixes Bug #77399 (Managed Make Builder mangles subdir.mk if configuration of linked resource was changed)

Best regards,

Alex Chapiro.
Index: GnuMakefileGenerator.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/makegen/gnu/GnuMakefileGenerator.java,v
retrieving revision 1.23
diff -u -r1.23 GnuMakefileGenerator.java
--- GnuMakefileGenerator.java	28 Oct 2004 17:16:53 -0000	1.23
+++ GnuMakefileGenerator.java	1 Nov 2004 17:06:42 -0000
@@ -353,6 +353,21 @@
 		if (outputExtension != "") //$NON-NLS-1$
 	        OptDotExt = DOT + outputExtension; 
 		
+		IConfiguration config = info.getSelectedConfiguration();
+		
+		// For testing only
+/*		if( config.getResourceConfigurations().length > 0) {
+			IResourceConfiguration[] resConfigs = config.getResourceConfigurations();
+			for (int i = 0; i < resConfigs.length; i++) {
+				System.out.println("Name :" + resConfigs[i].getName());				
+			}
+		}	
+*/
+
+//		We need to check whether we have any resource specific build  information.
+		IResourceConfiguration resConfig = null;
+		if( config != null ) resConfig = config.getResourceConfiguration(resource.getFullPath().toString());
+
 		// figure out path to use to resource
 		if(!resourceLocation.toString().startsWith(projectLocation)) {
 			// it IS linked, so use the actual location
@@ -366,26 +381,12 @@
 			resourcePath = relativePath; 
 			
 			// The rule and command to add to the makefile
-			buildRule = relativePath + WILDCARD + OptDotExt + COLON + WHITESPACE + ROOT + SEPARATOR + resourcePath + WILDCARD + DOT + inputExtension;
+			if( resConfig != null) {
+				buildRule = resourcePath + resourceName + OptDotExt + COLON + WHITESPACE + "$(ROOT)/" + resourcePath + resourceName + DOT + inputExtension; //$NON-NLS-1$
+			} else
+				buildRule = relativePath + WILDCARD + OptDotExt + COLON + WHITESPACE + ROOT + SEPARATOR + resourcePath + WILDCARD + DOT + inputExtension;
 		} // end fix for PR 70491
 
-		IConfiguration config = info.getSelectedConfiguration();
-		
-		// For testing only
-/*		if( config.getResourceConfigurations().length > 0) {
-			IResourceConfiguration[] resConfigs = config.getResourceConfigurations();
-			for (int i = 0; i < resConfigs.length; i++) {
-				System.out.println("Name :" + resConfigs[i].getName());				
-			}
-		}	
-*/
-
-//		We need to check whether we have any resource specific build  information.
-		IResourceConfiguration resConfig = null;
-		if( config != null ) resConfig = config.getResourceConfiguration(resource.getFullPath().toString());
-		if( resConfig != null) {
-			buildRule = resourcePath + resourceName + OptDotExt + COLON + WHITESPACE + "$(ROOT)/" + resourcePath + resourceName + DOT + inputExtension; //$NON-NLS-1$
-		}
 		
 		// No duplicates in a makefile
 		if (getRuleList().contains(buildRule)) {
@@ -412,11 +413,15 @@
 //			The command to build
 			
 			String fileName;
+			String outFileName;
 			String rootDir = "../"; //$NON-NLS-1$
-			if (isItLinked)
+			if (isItLinked) {
 				fileName = resourcePath;
-			else
+				outFileName = resourceName;
+			}	else {
 				fileName = rootDir + relativePath + resConfig.getName();
+				outFileName = resourcePath + resourceName;
+			}
 			
 			inputs = new String[1]; inputs[0] = fileName;
 			String[] flags = null;
@@ -428,7 +433,7 @@
 			}
 			IManagedCommandLineGenerator cmdLGen = tools[0].getCommandLineGenerator();
 			cmdLInfo = cmdLGen.generateCommandLineInfo( tools[0], cmd, flags, outflag, outputPrefix,
-					resourcePath + resourceName + OptDotExt, inputs, tools[0].getCommandLinePattern() );
+					outFileName + OptDotExt, inputs, tools[0].getCommandLinePattern() );
 	
 			String buildCmd = cmdLInfo.getCommandLine();
 //			String buildCmd = cmd + WHITESPACE + buildFlags + WHITESPACE + outflag + WHITESPACE + outputPrefix + resourceName + OptDotExt + WHITESPACE + fileName;

Back to the top