$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
unshift(@Ld_flags, ('-Xlinker -bbigtoc'));
}
+
} # end of setupLinkOpts
\end{code}
push(@SysLibrary, "-l$LibGmp");
}
-push(@SysLibrary, '-lm');
+push(@SysLibrary, '-lm') if !( $TargetPlatform =~ /^.*(cygwin32|mingw32)$/ );
\end{code}
%************************************************************************
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');
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);
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...
}
local($c_flags) = "@CcBoth_flags";
local($ddebug_flag) = ( $DEBUGging ) ? '-DDEBUG' : '';
- $c_flags .= "-mno-cygwin" if ( $TargetPlatform =~ /-mingw32$/ );
+ $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]
# 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$$";
$Status++;
}
}
+ $ProduceHi='-hifile=';
next arg; };
# The suffix to use when looking for interface files
}
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; };
#---------- Linker (gcc, really) ---------------------------------------
- /^-static$/ && do { push(@HsC_flags, $_); 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 ----------------------------------