[rework makefile to use ghc --make and allow profiling and normal builds to coexist, as well as start ghci easily
John Meacham <john@repetae.net>**20051006121811] adddir ./test
move ./HelloWorld.hs ./test/HelloWorld.hs
move ./test.sh ./test/test.sh
hunk ./Makefile 6
+GHCPROFOPTS=   -prof -auto-all -osuf prof.o -hisuf prof.hi
hunk ./Makefile 8
-PACKAGES= -package mtl  -package unix -package QuickCheck  #  -prof -auto-all
+PACKAGES= -package mtl  -package unix -package QuickCheck
hunk ./Makefile 12
+HCI = ghci
hunk ./Makefile 15
-DRIFT= ../DrIFT/src/DrIFT
-
-ALLHS:=$(shell find . Grin Boolean Doc C E  FrontEnd DerivingDrift -maxdepth 1 -follow \( -name \*.hs -or -name \*.lhs \) -and \( \! -name Try\*.hs \) | sed -e 's@^\./@@')
-
hunk ./Makefile 17
-
-# OBJS is defined in 'depend.make'
-# OBJS=$(shell perl ./collect_deps.prl Main.o < depend.make)
-#
+# HSFILES is defined here, it can be updated with 'make depend' whenever a new source file is added
hunk ./Makefile 26
-%.o: %.hs
-	$(HC) -i.  $(HCFLAGS) $(GHCOPTS) -o $@ -c $<
-%.o: %.lhs
-	$(HC) -i.  $(HCFLAGS) $(GHCOPTS) -o $@ -c $<
+jhcp: $(HSFILES)
+	$(HC) $(GHCOPTS) $(EXTRAOPTS) $(GHCPROFOPTS) --make Main.hs -o $@
hunk ./Makefile 29
-%.hi: %.o
-	@:
+jhc: $(HSFILES)
+	$(HC) $(GHCOPTS) $(EXTRAOPTS) --make Main.hs -o $@
hunk ./Makefile 32
-%.hi-boot: %.o-boot
-	@:
+i:
+	ghci $(GHCOPTS) $(EXTRAOPTS) Main.hs
hunk ./Makefile 35
-%.o-boot: %.hs-boot
-	$(HC) $(HCFLAGS) $(GHCOPTS) -c $<
hunk ./Makefile 36
+tags: $(HSFILES)
+	hasktags $(HSFILES)
hunk ./Makefile 39
-jhc: $(OBJS)
-	$(HC) $(GHCOPTS) $(EXTRAOPTS) $(OBJS) -o $@
+regress: jhc
+	time ./regress_test.prl test/Try-Regress.hs
+	time ./regress_test.prl test/Try-Foo.hs
+	time ./regress_test.prl test/Try-Lam.hs
+	time ./regress_test.prl test/Try-Case.hs
hunk ./Makefile 45
-tags: $(ALLHS)
-	hasktags $(ALLHS)
-
-regress: jhc Try-Regress.hs
-	time ./regress_test.prl try/Try-Regress.hs
-	time ./regress_test.prl try/Try-Foo.hs
-	time ./regress_test.prl try/Try-Lam.hs
-	time ./regress_test.prl try/Try-Case.hs
-#	$(MAKE) -C regress
-#	(cd regress; ./regress)
-#
-#
-
hunk ./Makefile 46
-	haddock -h $(filter-out DataConstructors.hs SelfTest.hs %/HsParser.hs FrontEnd/Representation.hs C/Gen.hs , $(OBJS:.o=.hs)) -o hsdocs
+	haddock -h $(filter-out DataConstructors.hs SelfTest.hs %/HsParser.hs FrontEnd/Representation.hs C/Gen.hs , $(HSFILES)) -o hsdocs
hunk ./Makefile 49
-	echo $(ALLHS)
-	echo $(OBJS)
+	echo $(HSFILES)
hunk ./Makefile 52
-depend: depend.make
-
-depend.make: $(BUILTSOURCES) $(ALLHS)
-	$(HC) -M -optdep-f -optdepdepend.make $(HC_OPTS) Main.hs
-	sed -e '/^#.*DELETE: End/q' -i depend.make
-	echo OBJS=`perl ./collect_deps.prl Main.o < depend.make ` >> depend.make
-
-# $(ALLHS)
+depend: $(BUILTSOURCES)
+	$(HC) -M -optdep-f -optdepdep.tmp $(HC_OPTS) $(MAIN)
+	echo HSFILES=`egrep -o '[A-Za-z/.]+.hs' dep.tmp | sed -e 's/^\.\///' | sort` > depend.make
+	rm -f dep.tmp
hunk ./Makefile 58
-	rm -f $(OBJS) jhc *.hs_code.c `find . -name \*.hi -or -name \*.o-boot -or -name \*.hi-boot`
+	rm -f  jhc jhcp *.hs_code.c `find . -name \*.hi -or -name \*.o-boot -or -name \*.hi-boot -or -name \*.o`
hunk ./Makefile 65
+
hunk ./Makefile 99
-.PHONY: depend clean realclean builtfiles clean-ho  regress hsdocs
+.PHONY: depend clean realclean builtfiles clean-ho  regress hsdocs i
hunk ./collect_deps.prl 1
-#!/usr/bin/perl
-
-use strict;
-use Data::Dumper;
-
-my %deps;
-
-while(<STDIN>) {
-    next if /^\s*$/;
-    next if /^\s*#/;
-    next unless /^\s*(\S*)\s*\:\s*(\S*)\s*$/;
-    my ($a,$b) = ($1,$2);
-    $a =~ s/^\.\///;
-    $a =~ s/-boot$//;
-    $b =~ s/^\.\///;
-    $b =~ s/^(\.\/)?(.*)\.[a-z-]+$/$2.o/;
-    push @{$deps{$a}}, $b;
-}
-
-my @todo = @ARGV;
-my %done;
-
-while(my $do = pop @todo) {
-    foreach (@{$deps{$do}}) {
-        push @todo, $_, unless $done{$_};
-    }
-    $done{$do} = 1;
-}
-
-print (join(" ", keys %done), "\n");
-
-#print STDERR Dumper(\%deps);
rmfile ./collect_deps.prl
hunk ./test/test.sh 6
-make && ./jhc $* -v HelloWorld.hs
+make && ./jhc $* -flint -v test/HelloWorld.hs