[project @ 1999-04-06 09:46:36 by simonm]
[ghc-hetmet.git] / ghc / driver / ghc.lprl
index 98d4e7b..eb9f967 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
@@ -478,6 +484,7 @@ $PROFing = '';              # set to p or e if profiling
 $PROFgroup = '';       # set to group if an explicit -Ggroup specified
 $PROFauto = '';                # set to relevant hsc flag if -auto or -auto-all
 $PROFcaf  = '';                # set to relevant hsc flag if -caf-all
+$PROFdict = '';                # set to relevant hsc flag if -auto-dicts
 $PROFignore_scc = '';  # set to relevant parser flag if explicit sccs ignored
 $UNPROFscc_auto = '';  # set to relevant hsc flag if forcing auto sccs without profiling
 $TICKYing = '';        # set to t if compiling for ticky-ticky profiling
@@ -759,6 +766,7 @@ sub setupOptimiseFlags {
          # See remark re: cloning in defn of minusnotO
          '-fclone-binds',
 
+         '-fdo-case-elim',
          '-fmax-simplifier-iterations1',
          $Oopt_PedanticBottoms,
          ']',
@@ -993,7 +1001,7 @@ sub setupBuildFlags {
    } else {
       push(@HsC_flags, $PROFauto) if $PROFauto;
       push(@HsC_flags, $PROFcaf)  if $PROFcaf;
-      #push(@HsC_flags, $PROFdict) if $PROFdict;
+      push(@HsC_flags, $PROFdict) if $PROFdict;
 
       $Oopt_FinalStgProfilingMassage = '-fmassage-stg-for-profiling';
 
@@ -1172,27 +1180,29 @@ sub setupLinkOpts {
 
   # things that are referenced by the RTS - make sure that we pull 'em in
   unshift(@Ld_flags,
-         ( '-u', "${uscore}PrelBase_IZh_static_info"
-          ,'-u', "${uscore}PrelBase_CZh_static_info"
-          ,'-u', "${uscore}PrelBase_FZh_static_info"
-          ,'-u', "${uscore}PrelBase_DZh_static_info"
-          ,'-u', "${uscore}PrelAddr_AZh_static_info"
-          ,'-u', "${uscore}PrelAddr_WZh_static_info"
-          ,'-u', "${uscore}PrelAddr_I64Zh_static_info"
-          ,'-u', "${uscore}PrelAddr_W64Zh_static_info"
+         ( '-u', "${uscore}PrelBase_Izh_static_info"
+          ,'-u', "${uscore}PrelBase_Czh_static_info"
+          ,'-u', "${uscore}PrelBase_Fzh_static_info"
+          ,'-u', "${uscore}PrelBase_Dzh_static_info"
+          ,'-u', "${uscore}PrelAddr_Azh_static_info"
+          ,'-u', "${uscore}PrelAddr_Wzh_static_info"
+          ,'-u', "${uscore}PrelAddr_I64zh_static_info"
+          ,'-u', "${uscore}PrelAddr_W64zh_static_info"
           ,'-u', "${uscore}PrelStable_StablePtr_static_info"
-         ,'-u', "${uscore}PrelBase_IZh_con_info"
-          ,'-u', "${uscore}PrelBase_CZh_con_info"
-          ,'-u', "${uscore}PrelBase_FZh_con_info"
-          ,'-u', "${uscore}PrelBase_DZh_con_info"
-          ,'-u', "${uscore}PrelAddr_AZh_con_info"
-          ,'-u', "${uscore}PrelAddr_WZh_con_info"
-          ,'-u', "${uscore}PrelAddr_I64Zh_con_info"
-          ,'-u', "${uscore}PrelAddr_W64Zh_con_info"
+         ,'-u', "${uscore}PrelBase_Izh_con_info"
+          ,'-u', "${uscore}PrelBase_Czh_con_info"
+          ,'-u', "${uscore}PrelBase_Fzh_con_info"
+          ,'-u', "${uscore}PrelBase_Dzh_con_info"
+          ,'-u', "${uscore}PrelAddr_Azh_con_info"
+          ,'-u', "${uscore}PrelAddr_Wzh_con_info"
+          ,'-u', "${uscore}PrelAddr_I64zh_con_info"
+          ,'-u', "${uscore}PrelAddr_W64zh_con_info"
           ,'-u', "${uscore}PrelStable_StablePtr_con_info"
           ,'-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 +1213,7 @@ sub setupLinkOpts {
     unshift(@Ld_flags, ('-Xlinker -bbigtoc')); 
   }
 
+
 } # end of setupLinkOpts
 
 \end{code}
@@ -1271,7 +1282,7 @@ if ($LibGmp eq 'not-installed') {
   push(@SysLibrary, "-l$LibGmp");
 }
 
-push(@SysLibrary, '-lm');
+push(@SysLibrary, '-lm') if !( $TargetPlatform =~ /^.*(cygwin32|mingw32)$/ );
 \end{code}
 
 %************************************************************************
@@ -1383,6 +1394,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 +1875,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 +1968,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 +2106,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 +2332,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 +2381,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 +2853,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 +2915,7 @@ arg: while($_ = $Args[0]) {
                                    $Status++;
                                }
                            }
+                           $ProduceHi='-hifile=';
                            next arg; };
 
     # The suffix to use when looking for interface files
@@ -2903,13 +2939,14 @@ arg: while($_ = $Args[0]) {
 
     /^-prof$/ && do { $PROFing = 'p'; next arg; }; # profiling -- details later!
 
-    /^-auto/ && do {
-               # generate auto SCCs on top level bindings
-               # -auto-all = all top level bindings
-               # -auto     = only top level exported bindings
-               $PROFauto = ( /-all/ )
-                           ? '-fauto-sccs-on-all-toplevs'
-                           : '-fauto-sccs-on-exported-toplevs';
+    /^-auto-dicts$/ && do {
+               $PROFdicts = '-fauto-sccs-on-dicts';
+               next arg; };
+    /^-auto-all$/ && do {
+               $PROFauto = '-fauto-sccs-on-all-toplevs';
+               next arg; };
+    /^-auto$/ && do {
+               $PROFauto = '-fauto-sccs-on-exported-toplevs';
                next arg; };
 
     /^-caf-all/ && do { # generate individual CAF SCC annotations
@@ -3018,6 +3055,7 @@ arg: while($_ = $Args[0]) {
     /^-keep-s-files?-too$/     && do { $Keep_s_file_too = 1;  next arg; };
 
     /^-fignore-interface-pragmas$/ && do { push(@HsC_flags, $_); next arg; };
+    /^-fignore-asserts$/           && do { push(@HsC_flags, $_); next arg; };
 
     /^-fno-implicit-prelude$/      && do { $NoImplicitPrelude= 1; push(@HsC_flags, $_); next arg; };
 
@@ -3049,7 +3087,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 +3105,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).
 
@@ -3128,6 +3167,9 @@ arg: while($_ = $Args[0]) {
     /^-fno-let-from-(case|app|strict-let)$/ # experimental, really (WDP 95/10)
                    && do { push(@HsC_flags, $_); next arg; };
 
+    /^-funbox-strict-fields$/
+                  && do { push(@HsC_flags, $_); next arg; };
+
     # --------------- Warnings etc. ------
 
     /^-fwarn-(.*)$/      && do { push(@HsC_flags, $_); next arg; };
@@ -3256,7 +3298,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 ----------------------------------