ProjectName ProjectVersion ProjectVersionInt ProjectPatchLevel
+HscMajorVersion HscMinorVersion CcMajorVersion CcMinorVersion
+
TOP_PWD
bindir libdir libexecdir datadir
: "$TopPwd/${CURRENT_DIR}/${GHC_HSCPP}";
@HsCpp_flags = ();
-$genSPECS_flag = ''; # See ../utils/hscpp/hscpp.prl
$HsC = ( $INSTALLING ) ? "$InstLibExecDirGhc/hsc"
: "$TopPwd/${CURRENT_DIR}/${GHC_HSC}";
\begin{code}
sub setupOptFlags {
- $Oopt_UnfoldingUseThreshold = '-fsimpl-uf-use-threshold3';
$Oopt_MaxSimplifierIterations = '-fmax-simplifier-iterations4';
$Oopt_PedanticBottoms = '-fpedantic-bottoms'; # ON by default
$Oopt_MonadEtaExpansion = '';
$Oopt_FinalStgProfilingMassage = '';
$Oopt_StgStats = '';
$Oopt_SpecialiseUnboxed = '';
- $Oopt_DoSpecialise = ''; # ToDo:LATER: '-fspecialise';
+ $Oopt_DoSpecialise = '-fspecialise';
$Oopt_FoldrBuild = 0; # *Off* by default!
$Oopt_FB_Support = ''; # was '-fdo-arity-expand';
# $Oopt_FoldrBuildWW = 0; # Off by default
# We need to look in ghc/ and glaExts/ when searching for implicitly needed .hi files, but
# we should really *not* look there for explicitly imported modules.
-$GhcVersionInfo = $ProjectVersionInt
$Haskell1Version = 4; # i.e., Haskell 1.4
@Cpp_define = ();
# TEMP: disable x86 if $HaveNativeCodeGen && $TargetPlatform =~ /^(i386|alpha|sparc)-/;
$ProduceHi = '-hifile=';
$HiOnStdout = 0;
+$HiWith = '';
$HiDiff_flag = '';
$Keep_HiDiffs = 0;
# major & minor version numbers; major numbers must always agree;
# minor disagreements yield a warning.
-$HsC_major_version = 33;
-$HsC_minor_version = 0;
-$Cc_major_version = 36;
-$Cc_minor_version = 1;
+$HsC_major_version = $HscMajorVersion;
+$HsC_minor_version = $HscMinorVersion;
+$Cc_major_version = $CcMajorVersion;
+$Cc_minor_version = $CcMinorVersion;
# options: these must always agree
$HsC_consist_options = ''; # we record, in this order:
# '-fsimpl-uf-use-threshold0',
# '-fessential-unfoldings-only',
- $Oopt_UnfoldingUseThreshold,
+ #
+ # The presence of -fclone-binds is *temporary* to work around
+ # the fact that the desugarer in 3.0{2.3} does generate
+ # bindings with identical ids, and the type checker doesn't perform
+ # properly cloned type substitutions. Instead, we make sure that all
+ # binders are cloned first time through the simplifier.
+ #
+ # Will be properly fixed in the `new compiler` I hear, at which point
+ # the cloning can be turned off here.
+ '-fclone-binds',
+
$Oopt_MaxSimplifierIterations,
$Oopt_ShowSimplifierProgress,
']',
# '-fessential-unfoldings-only',
# '-fsimpl-uf-use-threshold0',
+ # See remark re: cloning in defn of minusnotO
+ '-fclone-binds',
+
'-fmax-simplifier-iterations1',
$Oopt_PedanticBottoms,
']',
'-freuse-con',
$Oopt_PedanticBottoms,
$Oopt_MonadEtaExpansion,
- $Oopt_UnfoldingUseThreshold,
$Oopt_MaxSimplifierIterations,
$Oopt_ShowSimplifierProgress,
+ #
+ # The presence of -fclone-binds is *crucial* here as
+ # -ffull-laziness (which we're about to do next) floats
+ # bindings outwards, so we better make sure that this
+ # doesn't result in the floating out of bindings
+ # with identical uniques, i.e., -ffull-laziness needs
+ # to be preceeded by a simplifier pass with -fclone-binds
+ # set.
+ '-fclone-binds',
']',
#LATER: '-fcalc-inlinings1', -- pointless for 2.01
# '-freuse-con',
# $Oopt_PedanticBottoms,
# $Oopt_MonadEtaExpansion,
-# $Oopt_UnfoldingUseThreshold,
# $Oopt_MaxSimplifierIterations,
# $Oopt_ShowSimplifierProgress,
# ']',
'-freuse-con',
$Oopt_PedanticBottoms,
$Oopt_MonadEtaExpansion,
- $Oopt_UnfoldingUseThreshold,
$Oopt_MaxSimplifierIterations,
$Oopt_ShowSimplifierProgress,
']',
# but do reductions if you see them!
$Oopt_PedanticBottoms,
$Oopt_MonadEtaExpansion,
- $Oopt_UnfoldingUseThreshold,
$Oopt_MaxSimplifierIterations,
$Oopt_ShowSimplifierProgress,
']',
'-flet-to-case', # Aha! Only done after strictness analysis
$Oopt_PedanticBottoms,
$Oopt_MonadEtaExpansion,
- $Oopt_UnfoldingUseThreshold,
$Oopt_MaxSimplifierIterations,
$Oopt_ShowSimplifierProgress,
']',
# ( ($OptLevel != 2)
# ? ''
-# : "-fliberate-case -fsimplify [ $Oopt_FB_Support -ffloat-lets-exposing-whnf -ffloat-primops-ok -fcase-of-case -fdo-case-elim -fcase-merge -fdo-eta-reduction -fdo-lambda-eta-expansion -freuse-con -flet-to-case $Oopt_PedanticBottoms $Oopt_MonadEtaExpansion $Oopt_UnfoldingUseThreshold $Oopt_MaxSimplifierIterations $Oopt_ShowSimplifierProgress ]" ),
+# : "-fliberate-case -fsimplify [ $Oopt_FB_Support -ffloat-lets-exposing-whnf -ffloat-primops-ok -fcase-of-case -fdo-case-elim -fcase-merge -fdo-eta-reduction -fdo-lambda-eta-expansion -freuse-con -flet-to-case $Oopt_PedanticBottoms $Oopt_MonadEtaExpansion $Oopt_MaxSimplifierIterations $Oopt_ShowSimplifierProgress ]" ),
# Final clean-up simplification:
# but still do reductions if you see them!
$Oopt_PedanticBottoms,
$Oopt_MonadEtaExpansion,
- $Oopt_UnfoldingUseThreshold,
$Oopt_MaxSimplifierIterations,
$Oopt_ShowSimplifierProgress,
']',
#LATER: '-fcalc-inlinings2', -- pointless for 2.01
# stg2stg passes
- '-fupdate-analysis',
'-flambda-lift',
$Oopt_FinalStgProfilingMassage,
$Oopt_StgStats,
# SPECIAL FLAGS for -O2
($OptLevel == 2) ? (
+ '-fupdate-analysis', # virtually useless; relegated to -O2
'-fsemi-tagging',
) : (),
);
# for a linker, use an explicitly given one, or the going C compiler ...
local($lnkr) = ( $Lnkr ) ? $Lnkr : $CcRegd;
+ if ( ($Specific_output_file eq '') &&
+ ($TargetPlatform eq 'i386-unknown-cygwin32') ) {
+ $Specific_output_file = 'main.exe';
+ print STDERR "Output file not specified, defaulting to \"main.exe\"\n";
+ }
+
local($output) = ($Specific_output_file ne '') ? "-o $Specific_output_file" : '';
- @Files_to_tidy = ($Specific_output_file ne '') ?
- $Specific_output_file :
- ( ($TargetPlatform eq 'i386-unknown-cygwin32') ? 'main.exe' : 'a.out');
- print STDERR "Output file not specified, defaulting to \"main.exe\"\n" if ($Specific_output_file eq '' && $TargetPlatform eq 'i386-unknown-cygwin32');
+ @Files_to_tidy = ($Specific_output_file ne '') ? $Specific_output_file : 'a.out';
local($to_do) = "$lnkr $Verbose @Ld_flags $output @Link_file $TopClosureFile $libdirs @UserLibrary @SysLibrary";
&run_something($to_do, 'Linker');
# from input file (need to know for recomp
# checking purposes)
local($hifile_target);# ditto (but .hi file)
+ local($ofile_c_stub_target);
+ local($ofile_h_stub_target);
\end{code}
Handle the weirdity of input from stdin.
? $Specific_hi_file
: "$ifile_root.$HiSuffix"; # ToDo: odirify?
# NB: may change if $ifile_root isn't module name (??)
+ ($ofile_c_stub_target = $ifile) =~s/\.[^\.\/]+$/_stub.c/;
+ ($ofile_h_stub_target = $ifile) =~s/\.[^\.\/]+$/_stub.h/;
} else {
$ifile = "$Tmp_prefix.hs"; # we know that's where we put the input
$ifile_root = '_stdin';
? $Do_cc
: ( ($HscOut eq '-C=') ? 1 : 0 );
local($do_as) = $Do_as;
- local($hsc_out) = ( $HscOut eq '-C=' ) ? "$Tmp_prefix.hc" : "$Tmp_prefix.s" ;
+ local($hsc_out) = ( $HscOut eq '-C=' ) ? "$Tmp_prefix.hc" : "$Tmp_prefix.s" ;
+ local($hsc_out_c_stub) = ( $HscOut eq '-C=' ) ? "${Tmp_prefix}_stb.c" : "";
+ local($hsc_out_h_stub) = ( $HscOut eq '-C=' ) ? "${Tmp_prefix}_stb.h" : "";
if ($Only_preprocess_hc) { # stop after having run $Cc -E
$do_as=0;
} elsif ($ifile =~ /\.hc$/ || $ifile =~ /_hc$/ ) { # || $ifile =~ /\.$Isuffix$/o) # ToDo: better
$do_hscpp = 0; $do_hsc = 0; $do_cc = 1;
$hsc_out = $ifile;
+ $hsc_out_c_stub = '';
+ $hsc_out_h_stub = '';
} elsif ($ifile =~ /\.c$/) {
$do_hscpp = 0; $do_hsc = 0; $do_cc = 1;
$hsc_out = $ifile; $is_hc_file = 0;
+ $hsc_out_c_stub = '';
+ $hsc_out_h_stub = '';
} elsif ($ifile =~ /\.s$/) {
$do_hscpp = 0; $do_hsc = 0; $do_cc = 0;
$cc_as = $ifile;
\begin{code}
if ($do_hsc) {
&runHscAndProcessInterfaces( $ifile, $hscpp_hsc, $ifile_root,
- $ofile_target, $hifile_target);
+ $ofile_target, $hifile_target,
+ $going_interactive);
+ }
+
+ if (-f $hsc_out_c_stub) {
+ &run_something("cp $hsc_out_c_stub $ofile_c_stub_target", 'Copy foreign export C stubs');
+ }
+
+ if (-f $hsc_out_h_stub) {
+ &run_something("cp $hsc_out_h_stub $ofile_h_stub_target", 'Copy foreign export header file');
}
if ($do_cc) {
&run_something($to_do, 'Ineffective C pre-processor');
} else {
local($includes) = '-I' . join(' -I',@Include_dir);
- $to_do .= "$HsCpp $Verbose $genSPECS_flag @HsCpp_flags -D__HASKELL1__=$Haskell1Version -D__GLASGOW_HASKELL__=$GhcVersionInfo $includes $lit2pgm_hscpp >> $hscpp_hsc";
+ $to_do .= "$HsCpp $Verbose @HsCpp_flags -D__HASKELL1__=$Haskell1Version -D__GLASGOW_HASKELL__=$ProjectVersionInt $includes $lit2pgm_hscpp >> $hscpp_hsc";
push(@Files_to_tidy, $hscpp_hsc );
&run_something($to_do, 'Haskellised C pre-processor');
}
\begin{code}
sub runHscAndProcessInterfaces {
- local($ifile, $hscpp_hsc, $ifile_root, $ofile_target, $hifile_target) = @_;
+ local($ifile, $hscpp_hsc, $ifile_root,
+ $ofile_target, $hifile_target,
+ $going_interactive) = @_;
# $ifile is the original input file
# $hscpp_hsc post-unlit, post-cpp, etc., input file
$source_unchanged = 0;
}
+ # Tell the compiler which version we're using
+ push(@HsC_flags, "-fhi-version=${ProjectVersionInt}");
+
# So if source_unchanged is still "1", we pass on the good news to the compiler
# The -recomp flag can disable this, forcing recompilation
if ($Do_recomp_chkr && $source_unchanged) {
# Run the compiler
- &runHsc($ifile_root, $hsc_out, $hsc_hi, $going_interactive);
+ &runHsc($ifile_root, $hsc_out, $hsc_hi, $hsc_out_c_stub, $hsc_out_h_stub, $going_interactive);
# See if it bailed out early, saying nothing needed doing.
# We work this out by seeing if it created an output .hi file
\begin{code}
sub runHsc {
- local($ifile_root, $hsc_out, $hsc_hi, $going_interactive) = @_;
+ local($ifile_root, $hsc_out, $hsc_hi, $hsc_out_c_stub, $hsc_out_h_stub, $going_interactive) = @_;
# prepend comma to HsP flags (so hsc can tell them apart...)
foreach $a ( @HsP_flags ) { $a = ",$a" unless $a =~ /^,/; }
&makeHiMap() unless $HiMapDone;
- #print STDERR "HiIncludes: $HiIncludeString\n";
push(@HsC_flags, "-himap=$HiIncludeString");
# here, we may produce .hc/.s and/or .hi files
#@Files_to_tidy = ();
if ( $going_interactive ) {
- # don't need .hi unless going to show it on stdout:
+ # don't need .hi unless we're going to show it on stdout:
$ProduceHi = '-nohifile=' if ! $HiOnStdout;
$do_cc = 0; $do_as = 0; $Do_lnkr = 0; # and we won't go any further...
}
# set up for producing output/.hi; note that flag twiddling
# may mean that nothing will actually be produced:
- $output = "$ProduceHi$hsc_hi $HscOut$hsc_out";
- push(@Files_to_tidy, $hsc_hi, $hsc_out );
+ $output = "$ProduceHi$hsc_hi $HscOut$hsc_out -F=$hsc_out_c_stub -FH=$hsc_out_h_stub";
+ push(@Files_to_tidy, $hsc_hi, $hsc_out, $hsc_out_c_stub, $hsc_out_h_stub );
# if we're compiling foo.hs, we want the GC stats to end up in foo.stat
if ( $CollectingGCstats ) {
}
local($to_do);
- $to_do = "$HsC @HsP_flags ,$hscpp_hsc $dump @HsC_flags $CoreLint $StgLint $Verbose $output +RTS @HsC_rts_flags";
+ # Win32 only: If the command processor used by system()
+ # exec()s the application as an ordinary Win32 executable,
+ # we're in trouble here, since the command line is likely
+ # to be > 255 chars long. To work around this situation,
+ # $HsC also understands `at-files', i.e., `@file' on the
+ # command line will cause $HsC to add the contents of `file'
+ # to the command line.
+ #
+ # [ Note: support for `at-files' is not compiled in by default ]
+ $cmd_line_opts_via_at_file=0;
+ if ($cmd_line_opts_via_at_file) {
+
+ local($to_do_opts) = "$Tmp_prefix.opts";
+ open(OPTS, "> $Tmp_prefix.opts") || &tidy_up_and_die(1,"Can't open $Tmp_prefix.opts\n");
+ print OPTS "$dump @HsC_flags $CoreLint $StgLint $Verbose";
+ close(OPTS);
+ $to_do = "$HsC @HsP_flags ,$hscpp_hsc \@$Tmp_prefix.opts $output +RTS @HsC_rts_flags";
+
+ } else {
+
+ $to_do = "$HsC @HsP_flags ,$hscpp_hsc $dump @HsC_flags $CoreLint $StgLint $Verbose $output +RTS @HsC_rts_flags";
+ }
&run_something($to_do, 'Haskell compiler');
# finish business w/ nofibbish time/bytes-alloc stats
foreach $d ( @Import_dir ) {
if ($HiIncludeString) {
- $HiIncludeString = "$HiIncludeString:${d}/%.${HiSuffix}";
+ $HiIncludeString = "$HiIncludeString:${d}%.${HiSuffix}";
} else {
- $HiIncludeString = "$d/%.${HiSuffix}";
+ $HiIncludeString = "$d%.${HiSuffix}";
}
}
foreach $d ( @SysImport_dir ) {
if ($HiIncludeString) {
- $HiIncludeString = "$HiIncludeString:${d}/%.${HiSuffix_prelude}";
+ $HiIncludeString = "$HiIncludeString:${d}%.${HiSuffix_prelude}";
} else {
- $HiIncludeString = "${d}/%.${HiSuffix_prelude}";
+ $HiIncludeString = "${d}%.${HiSuffix_prelude}";
}
}
EOINCL
# user may have asked for #includes to be injected...
print TMP @CcInjects if $#CcInjects >= 0;
+ } else {
+ # Straight .c files may want to know that they're being used
+ # with a particular version of GHC, so we define __GLASGOW_HASKELL__ for their benefit.
+ print TMP "#define __GLASGOW_HASKELL__ ${ProjectVersionInt}\n";
}
# heave in the consistency info
print TMP "static char ghc_cc_ID[] = \"\@(#)cc $ifile\t$Cc_major_version.$Cc_minor_version,$Cc_consist_options\";\n";
- # and #include the real source
print TMP "#include \"$hsc_out\"\n";
close(TMP) || &tidy_up_and_die(1,"Failed writing to $cc_help\n");
if ($Using_dump_file) {
print STDERR "Compilation Errors dumped in $Specific_dump_file\n";
}
-
&tidy_up_and_die($return_val, '');
}
$Using_dump_file = 0;
}
\end{code}
+To add another system library, you'll need to augment the
+Supported_syslibs variable with name and info on your addition
+to the syslib family. The info bit consist of the following:
+
+ - interface file directory
+ see the misc or posix entry for how to distinguish
+ between using installed and build tree directories.
+
+ - directory location of archives
+
+ - location of (way-independent) C support libs.
+ not all libraries need this - if you don't, just
+ give the empty string.
+ - list of syslibs you depend on.
+
+ - additional ghc command line flags that should be used.
+ - additional C compiler command line flags that should be used.
+ - link
+
+
\begin{code}
+
+# Hash to keep track of
+%Syslibs_added = ();
+
sub add_syslib {
local($syslib) = @_;
+
+ # Lifting this out of this sub brings it out of scope - why??
+ %Supported_syslibs =
+ ( exts,
+ [ # where to slurp interface files from
+ ( $INSTALLING
+ ? "$InstLibDirGhc/imports/exts"
+ : "$TopPwd/$CURRENT_DIR/$GHC_LIB_DIR/exts"
+ )
+ , # where to find the archive to use when linking
+ ( $INSTALLING
+ ? "$InstLibDirGhc"
+ : "$TopPwd/$CURRENT_DIR/$GHC_LIB_DIR/exts"
+ )
+ , '' # no cbits
+ , '' # Syslib dependencies
+ , '' # extra ghc opts
+ , '' # extra cc opts
+ , '' # extra ld opts
+ ],
+
+ misc,
+ [ # where to slurp interface files from
+ ( $INSTALLING
+ ? "$InstLibDirGhc/imports/misc"
+ : "$TopPwd/$CURRENT_DIR/$GHC_LIB_DIR/misc"
+ )
+ , # where to find the archive to use when linking
+ ( $INSTALLING
+ ? "$InstLibDirGhc"
+ : "$TopPwd/$CURRENT_DIR/$GHC_LIB_DIR/misc"
+ )
+ , # where to find the cbits archive to use when linking
+ ( $INSTALLING
+ ? "$InstLibDirGhc"
+ : "$TopPwd/$CURRENT_DIR/$GHC_LIB_DIR/misc/cbits"
+ )
+ , 'exts' # Syslib dependencies
+ , '' # extra ghc opts
+ , '' # extra cc opts
+ , ( $TargetPlatform =~ /-solaris2$/ ? '-lnsl -lsocket' : '')
+ ],
+ hbc,
+ [ # where to slurp interface files from
+ ( $INSTALLING
+ ? "$InstLibDirGhc/imports/hbc"
+ : "$TopPwd/CONTRIB/libraries/hbc/src"
+ )
+ , # where to find the archive to use when linking
+ ( $INSTALLING
+ ? "$InstLibDirGhc"
+ : "$TopPwd/CONTRIB/libraries/src/hbc"
+ )
+ , # where to find the cbits archive to use when linking
+ ( $INSTALLING
+ ? "$InstLibDirGhc"
+ : "$TopPwd/CONTRIB/libraries/hbc/cbits"
+ )
+ , 'exts' # Syslib dependencies
+ , '' # extra ghc opts
+ , '' # extra cc opts
+ , ''
+ ],
+ posix,
+ [ # where to slurp interface files from
+ ( $INSTALLING
+ ? "$InstLibDirGhc/imports/posix"
+ : "$TopPwd/$CURRENT_DIR/$GHC_LIB_DIR/posix"
+ )
+ , # where to find the archive to use when linking
+ ( $INSTALLING
+ ? "$InstLibDirGhc"
+ : "$TopPwd/$CURRENT_DIR/$GHC_LIB_DIR/posix"
+ )
+ , # where to find the cbits archive to use when linking
+ ( $INSTALLING
+ ? "$InstLibDirGhc"
+ : "$TopPwd/$CURRENT_DIR/$GHC_LIB_DIR/posix/cbits"
+ )
+ , 'misc' # Syslib dependencies
+ , '' # extra ghc opts
+ , '' # extra cc opts
+ , '' # extra ld opts
+ ],
+ concurrent,
+ [ # where to slurp interface files from
+ ( $INSTALLING
+ ? "$InstLibDirGhc/imports/concurrent"
+ : "$TopPwd/$CURRENT_DIR/$GHC_LIB_DIR/concurrent"
+ )
+ , # where to find the archive to use when linking
+ ( $INSTALLING
+ ? "$InstLibDirGhc"
+ : "$TopPwd/$CURRENT_DIR/$GHC_LIB_DIR/concurrent"
+ )
+ , '' # where to find the cbits archive to use when linking
+ , '' # Syslib dependencies
+ , '' # extra ghc opts
+ , '' # extra cc opts
+ , '' # extra ld opts
+ ],
+ win32,
+ [ # where to slurp interface files from
+ ( $INSTALLING
+ ? "$InstLibDirGhc/imports/win32"
+ : "$TopPwd/hslibs/win32/src"
+ )
+ , # where to find the archive to use when linking
+ ( $INSTALLING
+ ? "$InstLibDirGhc"
+ : "$TopPwd/hslibs/win32/src"
+ )
+ , ''
+ , 'exts' # Syslib dependencies
+ , '' # extra ghc opts
+ , '' # extra cc opts
+ , '-luser32 -lgdi32' # extra ld opts
+ ]
+ );
+
+ # check if it's supported..
- unshift(@SysImport_dir,
- ${INSTALLING} ? "$InstLibDir/imports/$syslib"
- : "$TopPwd/$CURRENT_DIR/$GHC_LIB_DIR/$syslib");
+ if ( !exists $Supported_syslibs{$syslib} ) {
+ print STDERR "$Pgm: no such system library (-syslib): $syslib\n";
+ $Status++;
+ return;
+ }
+
+ # This check is here to avoid syslib loops from
+ # spoiling the party. A side-effect of it is that
+ # it disallows multiple mentions of a syslib on a command-line,
+ # explicit *and* implicit ones (i.e., "-syslib exts -syslib misc"
+ # is not equal to "-syslib exts -syslib misc -syslib exts",
+ # which it needs to be)
+ #
+ # Since our current collection of syslibs don't have any
+ # loops, this test is disabled.
+ #
+ # ToDo: loop avoidance scheme when the need arises
+ #
+ #return if ( exists $Syslibs_added{$syslib} );
+
+ $Syslibs_added{$syslib} = 1;
+
+ local ($hi_dir, $lib_dir, $lib_cbits_dir,
+ $syslib_deps, $syslib_ghc_opts,
+ $syslib_cc_opts, $syslib_ld_opts) = @{ $Supported_syslibs{$syslib} };
+
- push(@SysLibrary_dir,
- ${INSTALLING} ? ("$InstLibDir")
- : ("$TopPwd/$CURRENT_DIR/$GHC_LIB_DIR/$syslib",
- "$TopPwd/$CURRENT_DIR/$GHC_LIB_DIR/$syslib/cbits"));
+ unshift(@SysImport_dir, $hi_dir);
+ push(@SysLibrary_dir, $lib_dir);
+ push(@SysLibrary_dir, $lib_cbits_dir) if ( $lib_cbits_dir ne '');
push(@SysLibrary, "-lHS$syslib");
- push(@SysLibrary, "-lHS${syslib}_cbits")
- unless $syslib eq 'contrib' || $syslib eq 'exts' || $syslib eq 'conc';
- #HACK! they have no cbits
+ push(@SysLibrary, "-lHS${syslib}_cbits") if ( $lib_cbits_dir ne '');
+ push(@SysLibrary, $syslib_ld_opts) if ($syslib_ld_opts ne '');
+
+ # Add on any extra dependencies.
+ foreach $lib (split(' ',$syslib_deps)) {
+ &add_syslib($lib);
+ }
}
\end{code}
next arg; };
# leave out actual C generation (debugging) [also turns off interface gen]
- /^-hi$/ && do { $HiOnStdout = 1; $ProduceHi = '-hifile='; next arg; };
+
+ /^-hi$/ && do { $HiOnStdout = 1; $ProduceHi = '-hifile='; next arg; };
# _do_ generate an interface; usually used as: -noC -hi
+ /^-hi-with-(.*)$/ && do { $HiOnStdout = 1; $HiWith .= " $1" ; $ProduceHi = '-hifile='; next arg; };
+ # limit ourselves to outputting a particular section.
/^-nohi$/ && do { $ProduceHi = '-nohifile='; next arg; };
# don't generate an interface (even if generating C)
#--------- ticky/concurrent/parallel -----------------------------------
# we sort out the details a bit later on
- /^-concurrent$/ && do { $CONCURing = 'c'; &add_syslib('conc'); next arg; };
+ /^-concurrent$/ && do { $CONCURing = 'c'; &add_syslib('concurrent'); next arg; };
# concurrent Haskell; implies -syslib conc
- /^-gransim$/ && do { $GRANing = 'g'; next arg; }; # GranSim
+ /^-gransim$/ && do { $GRANing = 'g'; &add_syslib('concurrent'); next arg; }; # GranSim
/^-ticky$/ && do { $TICKYing = 't'; next arg; }; # ticky-ticky
- /^-parallel$/ && do { $PARing = 'p'; next arg; }; # parallel Haskell
+ /^-parallel$/ && do { $PARing = 'p'; &add_syslib('concurrent'); next arg; }; # parallel Haskell
#-------------- "user ways" --------------------------------------------
/^-l(.*)/ && do { push(@UserLibrary,'-l'.&grab_arg_arg(*Args,'-l', $1)); next arg; };
/^-syslib(.*)/ && do { local($syslib) = &grab_arg_arg(*Args,'-syslib',$1);
- print STDERR "$Pgm: no such system library (-syslib): $syslib\n",
- $Status++ unless $syslib =~ /^(exts|misc|posix)$/;
-
- #
- # The posix library is a `special' in that it relies on
- # the ghc system library (packed strings). Wielding our
- # sledgehammer, the problem is solved by silently including
- # the ghc system library as well.
- # (ToDo: `nub' -syslib list)
- #
&add_syslib($syslib);
- if ( $syslib eq 'posix' ) {
- &add_syslib('misc');
- } elsif ( $syslib eq 'misc' &&
- $TargetName =~ /-solaris2$/ ) {
- # needed for Berkeley socket/nwork stuff.
- push(@SysLibrary, '-lnsl');
- }
next arg; };
#=======================================================================
/^-optP(.*)$/ && do { push(@HsCpp_flags, $1); next arg; };
/^-optCrts(.*)$/&& do { push(@HsC_rts_flags, $1); next arg; };
/^-optC(.*)$/ && do { push(@HsC_flags, $1); next arg; };
+ /^-optp(.*)$/ && do { push(@HsP_flags, $1); next arg; };
/^-optcpp(.*)$/ && do { push(@Cpp_define, $1); $Only_preprocess_hc = ($1 eq "-E"); next arg; };
/^-optc(.*)$/ && do { push(@CcBoth_flags, $1); next arg; };
/^-opta(.*)$/ && do { push(@As_flags, $1); next arg; };
/^-D(.*)/ && do { push(@HsCpp_flags, "'-D".&grab_arg_arg(*Args,'-D',$1)."'"); next arg; };
/^-U(.*)/ && do { push(@HsCpp_flags, "'-U".&grab_arg_arg(*Args,'-U',$1)."'"); next arg; };
- /^-genSPECS/ && do { $Cpp_flag_set = 1;
- $genSPECS_flag = $_;
- next arg; };
-
#---------- post-Haskell "assembler"------------------------------------
/^-ddump-raw-asm$/ && do { $Dump_raw_asm = 1; next arg; };
/^-ddump-asm-splitting-info$/ && do { $Dump_asm_splitting_info = 1; next arg; };
}
next arg; };
+ /^-fallow-overlapping-instances$/ && do { push(@HsC_flags, $_);
+ next arg; };
/^-fglasgow-exts$/
&& do { push(@HsC_flags, $_);
push(@HsP_flags, '-N');
-# push(@HsC_flags, '-fshow-import-specs');
-
# -fglasgow-exts implies -syslib exts
&add_syslib('exts');
# ---------------
- /^(-funfolding-use-threshold)(.*)$/
- && do { $Oopt_UnfoldingUseThreshold = $1 . &grab_arg_arg(*Args,$1, $2);
- next arg; };
+ /^-funfolding-.*$/
+ && do { push(@HsC_flags, $_); next arg };
+
+ /^-funfold-casms-in-hi-file$/
+ && do { push(@HsC_flags, $_); next arg };
/^(-fmax-simplifier-iterations)(.*)$/
&& do { $Oopt_MaxSimplifierIterations = $1 . &grab_arg_arg(*Args,$1, $2);
push(@HsC_antiflags, @StandardWarnings);
next arg; };
+ # --------------- fun stuff ----------------
+
+ /^-freport-compile$/ && do { push(@HsC_flags, $_); next arg; };
+
# --------------- platform specific flags (for gcc mostly) ----------------
/^-mlong-calls$/ && do { # for GCC for HP-PA boxes,