diff --git a/Makefile.am b/Makefile.am
index 145004088a6d6bca4dcc64167a3fd320de73098d..79229168702acd5b3ffd167ecea1e62be66ab15a 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -23,6 +23,12 @@ pkgdata_DATA = $(DEMO).tar.gz
 
 demo-tarball: $(DEMO).tar.gz
 
+$(DEMO).tar.gz: $(DEMO).tar
+	$(GZIP) -9 $<
+
+$(DEMO).tar: $(DEMO)
+	$(TAR) -cf $@ $<
+
 $(DEMO): DEMO
 	mkdir $@ ; cd $@ ; \
 	( cd ../DEMO ; $(TAR) cf - . ) | $(TAR) xf -
@@ -50,7 +56,7 @@ cvs-clean:
 	cp -f NEWS admin/
 	cp -f README admin/
 	cp -f INSTALL admin/
-	chgrp -R albert *
+	chgrp -R albert .
 
 dist-hook:
 	@echo Deleting CVS directories in $(distdir)
@@ -62,33 +68,6 @@ dist-hook:
 	find $(distdir)/DEMO \( -name ellipt -o -name heat -o -name nonlin \) -exec /bin/rm -f {} \;
 	find $(distdir)/DEMO -name Makefile -exec /bin/rm -f {} \;
 
-#
-# Generate all ALBERTA Makefile.am's form a template. I was just fed
-# up with changing 24 different files which looked essentially the
-# same.
-#
-generate-alberta-automakefiles:
-	for DEBUG in 0 1; do \
-	  for EL_INDEX in 0 1; do \
-	    for DIM in 1 2 3; do \
-	      DIM_OF_WORLD=$${DIM}; while test $${DIM_OF_WORLD} -le 3; do \
-		if test $$EL_INDEX -eq 0; then \
-		  LIBCODE=$${DIM}$${DIM_OF_WORLD}_$${DEBUG} ; \
-		else \
-		  LIBCODE=$${DIM}$${DIM_OF_WORLD}_$${DEBUG}1 ; \
-		fi; \
-		if test $$DEBUG -eq 0; then \
-		  EFLAGS=OPTIMISE ; \
-		else \
-		  EFLAGS=DEBUG ; \
-		fi ; \
-		sed -e "s/%DIM%/$$DIM/g" Makefile.am.template -e "s/%DIM_OF_WORLD%/$$DIM_OF_WORLD/g" -e "s/%DEBUG%/$$DEBUG/g" -e "s/%EL_INDEX%/$$EL_INDEX/g" -e "s/%LIBCODE%/$$LIBCODE/g" -e "s/%EFLAGS%/$$EFLAGS/g" > ALBERTA/src/ALBERTA$$LIBCODE/Makefile.am; \
-		DIM_OF_WORLD=$$(( $$DIM_OF_WORLD + 1 )) ; \
-	      done; \
-	    done; \
-	  done; \
-	done
-
 #
 # NOTE: you better have GRAPE installed properly before doing this.
 #
@@ -97,18 +76,10 @@ generate-alberta-automakefiles:
 # otherwise the grape-interface will not be included into the
 # distribution.
 #
-generate-alberta-dist: generate-alberta-automakefiles
+generate-alberta-dist:
+	./generate-alberta-automakefiles.sh
 	autoreconf
-	./configure --enable-alberta-12 --enable-alberta-13 --enable-alberta-23 --enable-el-index --enable-maintainer-mode
+	./configure --enable-alberta-12 --enable-alberta-13 --enable-alberta-23 --enable-el-index --enable-maintainer-mode --prefix=@prefix@
 	make dist
-
 endif
 
-SUFFIXES = .gz .tar .tar.gz
-
-%.tar: %
-	$(TAR) cf $@ $<
-
-%.gz: %
-	$(GZIP) -f -9 $<
-