3 ($Pgm = $0) =~ s/.*\/([^\/]+)$/\1/;
4 $Usage = "\n" . <<EOUSAGE;
6 $Pgm [-? or -help] [-k] [-n] [-v] [-t] dir/module-target(s)
8 This script runs `make' to build the requested target, WITHOUT
9 including the dependencies generated by `mkdependHS' (i.e., all those
10 derived from import declarations).
12 With a -t flag, it also sets the modification time of the resulting
13 .hi file (one target only, please) to some EARLY date, so that changes
14 to that interface will not trigger much useless recompilation.
16 Typical uses, for module "Bar" in directory "foo":
18 (1) You've changed "Bar" and you want to recompile it; you know that
19 other module interfaces are stable, so you'd rather do without all
20 of `make''s prognostications:
24 (2) You've ADDED a new function to "Bar"; you want to recompile that
25 module, BUT NOT TRIGGER LOTS OF FURTHER COMPILATION because of the
26 "changed" interface file:
30 USE AT YOUR OWN RISK: you can make a big mess with this script!
33 $Makefile = 'Makefile';
34 $Tmpfile = "/tmp/Makefile$$";
35 chop($Arch = `uname -a`);
36 $SleazyTouch = '/usr/5bin/touch';
42 print STDERR "rm $Tmpfile\n" if $Verbose;
46 $SIG{'INT'} = 'rm_temp_file';
47 $SIG{'QUIT'} = 'rm_temp_file';
50 $DirMod = ''; # the dir/module-file to make
53 while ($_ = $ARGV[0]) {
55 if (/^-\?$/ || /^-help$/) {
69 print STDERR "$Pgm: unknown option: $_\n\n$Usage";
71 } elsif (/^([A-Z_]+)=(.+)/) {
72 $MakeFlags .= " $1=\"$2\"";
74 } elsif ($Do_touch) { # the module file
76 if ( /([^\/]+\/[^\/\.]+)\.[a-z]+/ ) {
79 print STDERR "$Pgm: argument not of the form: directory/Module.suffix: $_\n\n$Usage";
82 } else { # accumulate as "Target"...
87 if ($Do_touch && $Target =~ / /) {
88 print STDERR "$Pgm: too many arguments\n\n$Usage";
92 open(INF, "<$Makefile") || die "Can't open $Makefile for input\n";
94 open(OUTF,">$Tmpfile") || die "Can't open $Tmpfile for output\n";
99 # copy through until ...
100 while ( $_ && ! /^# DO NOT DELETE: Beginning of Haskell dependencies/ ) {
105 # now copy through 'til the end, omitting the %.{o,s,hc} : %.hi dependencies
107 print $_ if ! /^\S+ : \S+\.hi$/;
114 if ($Arch ne "sun3") {
115 $Make = 'make JMAKE=jmake LIT2PGM=lit2pgm LIT2LATEX=lit2latex LIT2TEXI=lit2texi MKDEPENDLIT=mkdependlit MAKEINFO=makeinfo POSTMAKEINFO=postmakeinfo';
119 print STDERR "$Make $MakeFlags -f $Tmpfile $Target; rm $Tmpfile\n" if $Verbose;
121 system( "$Make $MakeFlags -f $Tmpfile $Target; rm $Tmpfile" );
124 print STDERR "$SleazyTouch -m 01010101 $DirMod\.hi\n" if $Verbose;
125 system( "$SleazyTouch -m 01010101 $DirMod\.hi" );