[project @ 1996-07-25 20:43:49 by partain]
[ghc-hetmet.git] / glafp-utils / scripts / mkdependC.prl
index 272c0a8..e81c148 100644 (file)
@@ -9,7 +9,7 @@
 $Usage  = "usage: $Pgm: not done yet\n";
 
 $Status  = 0; # just used for exit() status
-$Verbose = '';
+$Verbose = 0;
 $Dashdashes_seen = 0;
 
 $Begin_magic_str = "# DO NOT DELETE: Beginning of C dependencies\n";
@@ -21,13 +21,27 @@ $Col_width = 78; # ignored
 $Makefile = '';
 @Src_files = ();
 
+# the following is a hack, so we can use RAWCPP, but there you go;
+# put in just enough #defines that mkdependC will not barf.
+$HostPlatform = '$(HOSTPLATFORM)';
+
+if ( $HostPlatform =~ /^i386-/ ) {
+    push(@Defines, '-D__i386__');
+}
+if ( $HostPlatform =~ /^sparc-/ ) {
+    push(@Defines, '-D__sparc__');
+}
+if ( $HostPlatform =~ /-solaris2$/ ) {
+    push(@Defines, '-D__svr4__');
+}
+
 &mangle_command_line_args();
 
 if ( ! $Makefile && -f 'makefile' ) {
     $Makefile = 'makefile';
 } elsif ( ! $Makefile && -f 'Makefile') {
     $Makefile = 'Makefile';
-} else {
+} elsif ( ! $Makefile) {
     die "$Pgm: no makefile or Makefile found\n";
 }
 
@@ -73,7 +87,6 @@ while (<OMKF>) { # copy the rest through
 }
 close(NMKF);
 close(OMKF);
-chmod 0444, 'Makefile';
 exit 0;
 
 sub mangle_command_line_args {
@@ -90,7 +103,7 @@ sub mangle_command_line_args {
 
        } elsif ($Dashdashes_seen != 1) { # not between -- ... --
            if ( /^-v$/ ) {
-               $Verbose        = '-v';
+               $Verbose++;
            } elsif ( /^-f/ ) {
                $Makefile       = &grab_arg_arg($_);
            } elsif ( /^-o/ ) {