[project @ 1998-04-07 11:16:59 by sof]
authorsof <unknown>
Tue, 7 Apr 1998 11:17:04 +0000 (11:17 +0000)
committersof <unknown>
Tue, 7 Apr 1998 11:17:04 +0000 (11:17 +0000)
-mkdependHS: default is now not to run CPP over input files.
 The option -cpp now enables the use of CPP.

ghc/docs/users_guide/3-02-notes.vsgml
ghc/docs/users_guide/utils.vsgml
ghc/utils/mkdependHS/mkdependHS.prl

index aa56678..0f75d39 100644 (file)
@@ -1,8 +1,8 @@
-<sect1>Release notes for version~3-01---2/97
-<label id="release-3-01">
+<sect1>Release notes for version~3-02---4/97
+<label id="release-3-02">
 <p>
 
-Changes made since 3.00:
+Changes made since 3.01:
 
 <itemize>
 
@@ -14,4 +14,10 @@ tuples in some cases.
 
 <item> Fixed parsing problem: declaring a record with an infix constructor.
 
+<item> When computing the Makefile dependencies, using either
+<tt/ghc -M/ (preferred) or by invoking the <tt/mkdependHS/ script
+directly, <tt/CPP/ will now by default not be run over the input
+files. To have CPP wash your input files, use the command-line option
+<tt/-cpp/.
+
 </itemize>
index 0bc3fe7..2730f56 100644 (file)
@@ -66,6 +66,8 @@ that it doesn't understand are simply ignored; this way you can feed your
 Makefile's standard GHC options to @mkdependHS@ un-filtered.
 <descrip>
 
+<tag>@-cpp@</tag>       Run the C pre-processor over the input files. The
+                       default is not to.
 <tag>@-D<blah>@</tag>  A cpp @#define@; usual meaning.
 
 <tag>@-i<dirs>@</tag>  Add @<dirs>@ (colon-separated) to list of directories
index 2a51a46..4d90e20 100644 (file)
@@ -35,6 +35,7 @@ mkdependHS-specific options (not between --'s):
     -w          No warnings
     -f blah    Use "blah" as the makefile, rather than "makefile"
                or "Makefile".
+    -cpp       Wash the input files through cpp(1).
     -o <osuf>  Use <osuf> as the "object file" suffix ( default: o)
     -s <suf>   Make extra dependencies for files with
                suffix <suf><osuf>; thus, "-o hc -s _a" will
@@ -66,6 +67,7 @@ $Warnings   = 1; # 1 => warn about duplicate interface files
 $Dashdashes_seen = 0;
 
 $Cpp = ${RAWCPP};
+$Cpp_flag_set = 0; # 1 => run cpp over input files.
 
 if ( $ENV{'TMPDIR'} ) { # where to make tmp file names
     $Tmp_prefix = $ENV{'TMPDIR'} . "/mkdependHS$$";
@@ -235,6 +237,8 @@ sub mangle_command_line_args {
 
        } elsif ( /^-D(.*)/ ) { # recognized wherever they occur
            push(@Defines, $_);
+       } elsif ( /^-cpp$/ ) { # recognized wherever they occur
+           $Cpp_flag_set =1; 
        } elsif ( /^-i$/ ) {
            $Import_dirs = ''; # import path cleared!
        } elsif ( /^-i(.*)/ ) {
@@ -367,10 +371,15 @@ sub slurp_file_for_imports {
     # we mangle #include's so they will also leave something
     # behind to indicate the dependency on _them_
     
-    print STDERR "${SED} -e '/^# *include/{p;s/^# *include/!include/;};s/'\\''//g;s/\"//g' $file_to_read | $Cpp $Include_dirs -I$last_seen_dir @Defines |\n" if $Verbose;
+    local ($open_cmd);
+    if ($Cpp_flag_set) {
+       $open_cmd = "${SED} -e '/^# *include/{p;s/^# *include/!include/;};s/'\\''//g;s/\"//g' $file_to_read | $Cpp $Include_dirs -I$last_seen_dir @Defines |";
+    } else {
+       $open_cmd = $file_to_read;
+    }
+    print STDERR "$open_cmd\n" if $Verbose;
 
-    open(SRCFILE, "${SED} -e '/^# *include/{p;s/^# *include/!include/;};s/'\\''//g;s/\"//g' $file_to_read | $Cpp $Include_dirs -I$last_seen_dir @Defines |")
-       || die "$Pgm: Can't open $file_to_read: $!\n";
+    open(SRCFILE, $open_cmd) || die "$Pgm: Can't open $file_to_read: $!\n";
 
     while (<SRCFILE>) {
         #