#
# ToDo: strip out all the .h junk
#
+
+use File::Temp qw/ tempfile tempdir /;;
+
($Pgm = $0) =~ s/.*\/([^\/]+)$/\1/;
$Usage = "usage: $Pgm: not done yet\n";
$fname = &tidy_dir_names($fname);
- ($tempfile = $fname) =~ s/\.[^\.]*$/\.d/;
- $tempfile =~ s|.*/([^/]+)$|$1|g;
+ ($fh, $tempfile) = tempfile(DIR => '.', SUFFIX => '.d');
+ close $fh;
# ${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 $ignore_output");
+ $result = system("${CPP} -MM -MMD $Include_dirs @Defines -x c $fname -o $tempfile $ignore_output");
if ($result != 0) {
# On the cheesy side..we do want to know what went wrong, so
# re-run the command.
- $result = system("${CPP} -MM -MMD $Include_dirs @Defines -x c $fname ");
+ $result = system("${CPP} -MM -MMD $Include_dirs @Defines -x c $fname -o $tempfile");
if ($result != 0) {
unlink($tempfile);
exit($result);