[project @ 2002-07-09 18:02:48 by sof]
authorsof <unknown>
Tue, 9 Jul 2002 18:02:48 +0000 (18:02 +0000)
committersof <unknown>
Tue, 9 Jul 2002 18:02:48 +0000 (18:02 +0000)
gcc versionitis wrt gcc -E -MM .. usage:

2.95.<wurble> is silent on stdout if -MM is used, 2.96 ain't
(even when -o is used..hmm.) 2.95 (on mingw32) even fails if
you try to redirect the output.

So, be more accepting in first trying to run CPP with a redirect,
and if that fails, try without.

glafp-utils/mkdependC/mkdependC.prl

index 26ce208..95ec39a 100644 (file)
@@ -163,10 +163,18 @@ sub slurp_file { # follows an example in the `open' item in perl man page
 
     # ${CPP} better be 'gcc -E', or the -x option will fail...
     # ..and the -MM & -MMD.
-    $result = system("${CPP} -MM -MMD $Include_dirs @Defines -x c $fname >/dev/null");
+    $result = system("${CPP} -MM -MMD $Include_dirs @Defines -x c $fname > /dev/null");
     if ($result != 0) {
-       unlink($tempfile);
-       exit($result);
+        # On the cheesy side..we do want to know what went wrong, so
+       # re-run the command. (This also has the beneficial effect
+       # of fixing a redirection problem with gcc-2.95 builds used with
+       # mingw32.)
+       $result = system("${CPP} -MM -MMD $Include_dirs @Defines -x c $fname ");
+       if ($result != 0) {
+          unlink($tempfile);
+          exit($result);
+        }
     };
 
     local($dep_contents)='';