[project @ 1999-03-25 13:08:17 by simonm]
[ghc-hetmet.git] / ghc / driver / ghc.lprl
index 39d5976..9e1a61b 100644 (file)
@@ -287,6 +287,7 @@ these are turned off by -Wnot.
                     '-fwarn-unused-imports');
 @MinusWallOpts           = (@MinusWOpts, 
                     '-fwarn-unused-matches',
+                    '-fwarn-type-defaults',
                     '-fwarn-name-shadowing',
                     '-fwarn-missing-signatures');
 \end{code}
@@ -378,8 +379,8 @@ $Haskell1Version = 5; # i.e., Haskell 1.4
 @HsSourceCppOpts = 
        ( "-D__HASKELL1__=$Haskell1Version"
        , "-D__GLASGOW_HASKELL__=$ProjectVersionInt"
-       # not yet -- SDM
-       # , "-D__CONCURRENT_HASKELL__"
+       , "-D__HASKELL98__"
+       , "-D__CONCURRENT_HASKELL__"
        );
 
 @UserLibrary_dir= ();  #-L things;...
@@ -402,7 +403,7 @@ $TopClosureFile # defaults to 1.2 one; will be mangled later
 
 # make depend for Haskell
 $MkDependHS
-       = ( $INSTALLING ) ? "$InstBinDirGhc/mkdependHS"
+       = ( $INSTALLING ) ? "$InstLibExecDirGhc/mkdependHS"
                          : "$TopPwd/$CURRENT_DIR/$GHC_UTILS_DIR/mkdependHS/mkdependHS";
 # Fill in later
 @MkDependHS_flags = ();
@@ -459,6 +460,11 @@ $Only_preprocess_hc = 0;  # ditto
 $Only_generate_deps = 0;  # "
 $PostprocessCcOutput = 0;
 
+# Win32 only:
+#    static /= 0 => produce code for DLLs (when compiling/linking.)
+$Static = 1;
+$Static = 0 if ($TargetPlatform =~ /-mingw32$/);
+
 # native code-gen or via C?
 $HaveNativeCodeGen = $GhcWithNativeCodeGen;
 $HscOut = '-C='; # '-C=' ==> .hc output; '-S=' ==> .s output; '-N=' ==> neither
@@ -759,6 +765,7 @@ sub setupOptimiseFlags {
          # See remark re: cloning in defn of minusnotO
          '-fclone-binds',
 
+         '-fdo-case-elim',
          '-fmax-simplifier-iterations1',
          $Oopt_PedanticBottoms,
          ']',
@@ -1193,6 +1200,8 @@ sub setupLinkOpts {
           ,'-u', "${uscore}PrelBase_False_static_closure"
           ,'-u', "${uscore}PrelBase_True_static_closure"
           ,'-u', "${uscore}PrelPack_unpackCString_closure"
+          ,'-u', "${uscore}PrelException_stackOverflow_closure"
+          ,'-u', "${uscore}PrelException_heapOverflow_closure"
        ));
   if (!$NoHaskellMain) {
    unshift (@Ld_flags,'-u', "${uscore}PrelMain_mainIO_closure");
@@ -1203,6 +1212,7 @@ sub setupLinkOpts {
     unshift(@Ld_flags, ('-Xlinker -bbigtoc')); 
   }
 
+
 } # end of setupLinkOpts
 
 \end{code}
@@ -1271,7 +1281,7 @@ if ($LibGmp eq 'not-installed') {
   push(@SysLibrary, "-l$LibGmp");
 }
 
-push(@SysLibrary, '-lm');
+push(@SysLibrary, '-lm') if !( $TargetPlatform =~ /^.*(cygwin32|mingw32)$/ );
 \end{code}
 
 %************************************************************************
@@ -1383,6 +1393,20 @@ if ($Do_lnkr) {
     local($output) = ($Specific_output_file ne '') ? "-o $Specific_output_file" : '';
     @Files_to_tidy = ($Specific_output_file ne '') ? $Specific_output_file : 'a.out'; 
 
+    #
+    # Win32 DLLs - link with import libraries, not the real archives.
+    # 
+    if ( $TargetPlatform =~ /-mingw32$/ && !$Static ) {
+       foreach $a ( @SysLibrary ) {
+         next if ($a eq '-lm');
+          $a = "${a}_imp" if ($a =~ /^-l/);
+       }
+       push(@Link_file, ( $INSTALLING ) ? "$InstLibDirGhc/Main.o"
+                                        : "$TopPwd/$CURRENT_DIR/$GHC_RUNTIME_DIR/Main.o");
+       push(@Link_file, ( $INSTALLING ) ? "$InstLibDirGhc/PrelMain.o"
+                                        : "$TopPwd/$CURRENT_DIR/$GHC_LIB_DIR/PrelMain.o");
+       push(@Ld_flags,  "-mno-cygwin");
+    }
     local($to_do) = "$lnkr $Verbose @Ld_flags $output @Link_file $TopClosureFile $libdirs @UserLibrary @SysLibrary";
     &run_something($to_do, 'Linker');
 
@@ -1850,6 +1874,10 @@ sub runHscAndProcessInterfaces {
        push(@HsC_flags, '-fsource-unchanged'); 
     }  
 
+    # Indicate whether we're static or not.
+    # This will only ever 
+    push(@HsC_flags, '-static') if $Static;
+
     # Run the compiler
 
     &runHsc($ifile_root, $hsc_out, $hsc_hi, $hsc_out_c_stub, $hsc_out_h_stub, $going_interactive);
@@ -1939,7 +1967,7 @@ sub runHsc {
 
     if ( $going_interactive ) {
        # don't need .hi unless we're going to show it on stdout:
-       $ProduceHi = '-nohifile=' if ! $HiOnStdout;
+       $ProduceHi = '-nohifile=' if ! ($HiOnStdout || $Specific_hi_file ne '' );
        $do_cc = 0; $do_as = 0; $Do_lnkr = 0; # and we won't go any further...
     }
 
@@ -2077,6 +2105,8 @@ sub runGcc {
     local($c_flags) = "@CcBoth_flags";
     local($ddebug_flag) = ( $DEBUGging ) ? '-DDEBUG' : '';
 
+    $c_flags .= " -mno-cygwin" if ( $TargetPlatform =~ /-mingw32$/ );
+
     # "input" files to use that are not in some weird directory;
     # to help C compilers grok .hc files [ToDo: de-hackify]
     local($cc_help)   = "ghc$$.c";
@@ -2301,6 +2331,10 @@ sub process_ghc_timings {
 
         $GCs = $1 if /^\s*([0-9,]+) (collections? in generation 0|garbage collections? performed)/;
 
+       if ( /^\s+([0-9]+)\s+Mb total memory/ ) {
+           $TotMem = $1;
+        }
+
        # The presence of -? in the following pattern is only there to
        # accommodate 0.29 && <= 2.05 RTS'
        if ( /^\s*INIT\s+time\s*(\d+\.\d\d)s\s*\(\s*-?(\d+\.\d\d)s elapsed\)/ ) {
@@ -2346,7 +2380,7 @@ sub process_ghc_timings {
 
     # print out what we found
     print STDERR "<<$SysSpecificTiming: ",
-       "$BytesAlloc bytes, $GCs GCs, $AvgResidency/$MaxResidency avg/max bytes residency ($ResidencySamples samples), $InitTime INIT ($InitElapsed elapsed), $MutTime MUT ($MutElapsed elapsed), $GcTime GC ($GcElapsed elapsed)",
+       "$BytesAlloc bytes, $GCs GCs, $AvgResidency/$MaxResidency avg/max bytes residency ($ResidencySamples samples), ${TotMem}M in use, $InitTime INIT ($InitElapsed elapsed), $MutTime MUT ($MutElapsed elapsed), $GcTime GC ($GcElapsed elapsed)",
        " :$SysSpecificTiming>>\n";
 
     # OK, party over
@@ -2818,8 +2852,8 @@ arg: while($_ = $Args[0]) {
     # stop after generating .o files
 
     /^-link-chk$/    && do { $LinkChk = 1; next arg; };
-    /^-no-link-chk$/ && do { $LinkChk = 0; next arg; };
     # don't do consistency-checking after a link
+    /^-no-link-chk$/ && do { $LinkChk = 0; next arg; };
 
     /^-tmpdir$/ && do { $Tmp_prefix = &grab_arg_arg(*Args,'-tmpdir', '');
                        $Tmp_prefix = "$Tmp_prefix/ghc$$";
@@ -2880,6 +2914,7 @@ arg: while($_ = $Args[0]) {
                                    $Status++;
                                }
                            }
+                           $ProduceHi='-hifile=';
                            next arg; };
 
     # The suffix to use when looking for interface files
@@ -3049,7 +3084,7 @@ arg: while($_ = $Args[0]) {
                        }
                        next arg; };
 
-    /^-fno-asm-mangling$/ && do { $DoAsmMangling = 0; next arg; };
+    /^-fno-asm-mangling$/   && do { $DoAsmMangling = 0; next arg; };
 
     /^-fallow-overlapping-instances$/ && do { push(@HsC_flags, $_); next arg; };
     /^-fallow-undecidable-instances$/ && do { push(@HsC_flags, $_); next arg; };
@@ -3067,6 +3102,7 @@ arg: while($_ = $Args[0]) {
     /^-fno-speciali[sz]e$/
                && do { $Oopt_DoSpecialise = ''; next arg; };
 
+    /^-fcompiling-prelude$/ && do { push(@HsC_flags, $_); next arg; };
 
 # Now the foldr/build options, which are *on* by default (for -O).
 
@@ -3256,7 +3292,7 @@ arg: while($_ = $Args[0]) {
 
     #---------- Linker (gcc, really) ---------------------------------------
 
-    /^-static$/                && do { push(@Ld_flags, $_); next arg; };
+    /^-static$/                && do { $Static=1; push(@Ld_flags, $_); next arg; };
     /^-no-hs-main$/    && do { $NoHaskellMain=1; next arg;    };
 
     #---------- mixed cc and linker magic ----------------------------------