#
# perl script expect the following variables to be prepended:
#
-# RAWCPP TMPDIR TOP_PWD
+# RAWCPP TMPDIR TOP_PWD HscIfaceFileVersion
# libdir libexecdir datadir INSTALLING
-# ProjectVersionInt SED
+# SED
#
# tries to work like mkdependC - capable of dealing with:
#
Regard <file> as not "stable"; i.e., generate dependencies
on it (if any). This option is normally used in conjunction
with the --exclude-directory option.
-
+
EOUSAGE
$Status = 0; # just used for exit() status
$Unlit = ($INSTALLING) ? "${InstLibExecDirGhc}/unlit"
: "${TopPwd}/ghc/utils/unlit/unlit";
+$HiBootVersion = $HscIfaceFileVersion;
+$hi_boot_with_version = 0;
+
$Begin_magic_str = "# DO NOT DELETE: Beginning of Haskell dependencies\n";
$End_magic_str = "# DO NOT DELETE: End of Haskell dependencies\n";
@Obj_suffix = ("o");
$Makefile = '';
@Src_files = ();
$Include_prelude = 0;
+@Defines = ();
# Delete temp. file if script is halted.
sub quit_upon_signal { print STDERR "Deleting $Tmp_prefix.hs .. \n"; unlink "$Tmp_prefix.hs"; }
exit(1);
}
-push(@Defines,
- ( #OLD: "-D__HASKELL1__=$Haskell_1",
- "-D__GLASGOW_HASKELL__=$ProjectVersionInt"));
-
@Import_dirs = split(/:/,$Import_dirs);
@Include_dirs = split(/\s+/,$Include_dirs); # still has -I's in it
$_ = <OMKF>;
}
# insert dependencies
-print "\n$Begin_magic_str", @Depend_lines, $End_magic_str || die "Failed to write out dependencies ($!)";
+print "$Begin_magic_str", @Depend_lines, $End_magic_str || die "Failed to write out dependencies ($!)";
while (<OMKF>) { # copy the rest through
print $_ || die "Failed to write out dependencies ($!)";
local ($open_cmd);
if ($Cpp_flag_set) {
# $open_cmd = "${SED} -e '/^# *include/{p;s/^# *include/!include/;};s/'\\''//g;s/\"//g' $file_to_read | $Cpp $Include_dirs -I$last_seen_dir @Defines |";
- &run_something("${SED} -e '/^# *include/{p;s/^# *include/!include/;};s/'\\''//g;s/\"//g' $file_to_read | $Cpp $Include_dirs -I$last_seen_dir @Defines 2>&1 > ${file_to_read}.i", $orig_src_file, 'cpp');
+ &run_something("${SED} -e '/^# *include/{p;s/^# *include/!include/;};s/'\\''//g;s/\"//g' $file_to_read | $Cpp $Include_dirs -I$last_seen_dir @Defines - 2>&1 > ${file_to_read}.i", $orig_src_file, 'cpp');
$read_from_file="${file_to_read}.i";
$cleanup=1;
} else {
close(SRCFILE) || exit(1);
# remove temporary file, if any.
if ($cleanup) {
- # truncate() may not be implemented, so we
- # play it safe here.
- local(*TRUNC);
- open(TRUNC,"> $read_from_file") && close(TRUNC);
+ unlink("$read_from_file");
}
}
local($source_dep);
if ( $source ) {
- $source_dep = "$int_file.hi-boot";
+ # if a version specific .hi-boot file exist, use it.
+ if ( -f "$int_file.hi-boot-${HiBootVersion}" ) {
+ $source_dep = "$int_file.hi-boot-${HiBootVersion}";
+ } else {
+ $source_dep = "$int_file.hi-boot";
+ }
} else {
local($str)="";
foreach $obj (@Obj_suffix) {
}
if ( $source ) {
+ $name_to_check = "$import_dir/$modname.hi-boot-${HiBootVersion}";
+ print STDERR "trying... $name_to_check\n" if $Verbose >= 2; # very verbose
+ return($name_to_check) if -f $name_to_check;
+
$name_to_check = "$import_dir/$modname.hi-boot";
print STDERR "trying... $name_to_check\n" if $Verbose >= 2; # very verbose
return($name_to_check) if -f $name_to_check;