[mpich2-commits] r6727 - mpich2/trunk/maint

gropp at mcs.anl.gov gropp at mcs.anl.gov
Mon May 24 14:52:25 CDT 2010


Author: gropp
Date: 2010-05-24 14:52:25 -0500 (Mon, 24 May 2010)
New Revision: 6727

Modified:
   mpich2/trunk/maint/simplemake.in
Log:
Fix handling of dependency information creation for source files in a different directory

Modified: mpich2/trunk/maint/simplemake.in
===================================================================
--- mpich2/trunk/maint/simplemake.in	2010-05-24 19:21:06 UTC (rev 6726)
+++ mpich2/trunk/maint/simplemake.in	2010-05-24 19:52:25 UTC (rev 6727)
@@ -4365,6 +4365,14 @@
 		$ext =~ s/^.*\.//g;
 		$sourcebasename = $sourcefile;
 		$sourcebasename =~ s/\.\w*$//;
+
+		# The file name for the dependencies output is derived
+		# from the source file.  In some cases, the source file
+		# may be drawn from a different directory; in that case,
+		# we need to remove directory specs from the name
+		$depfilename = $sourcebasename;
+		$depfilename =~ s/.*\///;
+
 		$objfiles = "_$sourcebasename.o $sourcebasename.o";
 		if ($do_sharedlibs || $found_sharedlib) {
 		    $objfiles .= " $sourcebasename.lo _$sourcebasename.lo";
@@ -4385,8 +4393,8 @@
 in the build directory\n";
 			$srcdirloc = '';
 		    }
-		    print FD "\$(DEPS_DIR)/$sourcebasename.d: $srcdirloc$sourcefile$newline";
-		    &PrintVerboseOptionCommand( "\$(MAKE_DEPEND_C) $targetOpts $srcdirloc$sourcefile >\$(DEPS_DIR)/$sourcebasename.d", "-", "MAKE_DEPEND_C $sourcefile > \$(DEPS_DIR)/$sourcebasename.d" );
+		    print FD "\$(DEPS_DIR)/$depfilename.d: $srcdirloc$sourcefile$newline";
+		    &PrintVerboseOptionCommand( "\$(MAKE_DEPEND_C) $targetOpts $srcdirloc$sourcefile >\$(DEPS_DIR)/$depfilename.d", "-", "MAKE_DEPEND_C $sourcefile > \$(DEPS_DIR)/$depfilename.d" );
 		}
 	    }
 	}
@@ -4422,6 +4430,8 @@
 		$ext =~ s/^.*\.//g;
 		$sourcebasename = $sourcefile;
 		$sourcebasename =~ s/\.\w*$//;
+		$depfilename = $sourcebasename;
+		$depfilename =~ s/.*\///;
 		if ($ext eq "c") {
 		    if (! -s $sourcefile) {
 			$srcdirloc = '';
@@ -4434,8 +4444,8 @@
 		    if (!$found_profilelib) {
 			$targetOpts = "";
 		    }
-		    &PrintVerboseOptionCommand( "\$(MAKE_DEPEND_C) $targetOpts $srcdirloc$sourcefile >\$(DEPS_DIR)/$sourcebasename.d", "-", "MAKE_DEPEND_C $sourcefile > \$(DEPS_DIR)/$sourcebasename.d" );
-		    print FD "\techo \"$makeInclude \$(DEPS_DIR)/$sourcebasename.d\" >>\$(DEPS_DIR)/newalldeps$newline";
+		    &PrintVerboseOptionCommand( "\$(MAKE_DEPEND_C) $targetOpts $srcdirloc$sourcefile >\$(DEPS_DIR)/$depfilename.d", "-", "MAKE_DEPEND_C $sourcefile > \$(DEPS_DIR)/$depfilename.d" );
+		    print FD "\techo \"$makeInclude \$(DEPS_DIR)/$depfilename.d\" >>\$(DEPS_DIR)/newalldeps$newline";
 		}
 	    }
 	}
@@ -4451,6 +4461,8 @@
 		$ext =~ s/^.*\.//g;
 		$sourcebasename = $sourcefile;
 		$sourcebasename =~ s/\.\w*$//;
+		$depfilename = $sourcebasename;
+		$depfilename =~ s/.*\///;
 		if ($ext eq "c") {
 		    if (! -s $sourcefile) {
 			$srcdirloc = '';
@@ -4463,8 +4475,8 @@
 		    if (!$found_profilelib) {
 			$targetOpts = "";
 		    }
-		    &PrintVerboseOptionCommand( "\$(MAKE_DEPEND_C) $targetOpts $srcdirloc$sourcefile >\$(DEPS_DIR)/$sourcebasename.d", "-", "MAKE_DEPEND_C $sourcefile > \$(DEPS_DIR)/$sourcebasename.d" );
-		    print FD "\techo \"$makeInclude \$(DEPS_DIR)/$sourcebasename.d\" >>\$(DEPS_DIR)/newalldeps$newline";
+		    &PrintVerboseOptionCommand( "\$(MAKE_DEPEND_C) $targetOpts $srcdirloc$sourcefile >\$(DEPS_DIR)/$depfilename.d", "-", "MAKE_DEPEND_C $sourcefile > \$(DEPS_DIR)/$depfilename.d" );
+		    print FD "\techo \"$makeInclude \$(DEPS_DIR)/$depfilename.d\" >>\$(DEPS_DIR)/newalldeps$newline";
 		}
 	    }
 	}



More information about the mpich2-commits mailing list