[m-dev.] for review: improve rules for `make install'

Fergus Henderson fjh at cs.mu.OZ.AU
Tue Oct 26 00:56:15 AEST 1999


Estimated hours taken: 0.75

Mmakefile:
	Change the rules for `install_grades' and
	`install_split_library' to handle `--use-subdirs' properly.

	Also change those rules so that they call
	`scripts/mercury_cleanup_install' if the build fails
	at a point which might leave the directories in an
	inconsistent state.

Workspace: /home/mercury0/fjh/mercury
Index: Mmakefile
===================================================================
RCS file: /home/mercury1/repository/mercury/Mmakefile,v
retrieving revision 1.43
diff -u -d -r1.43 Mmakefile
--- Mmakefile	1999/09/28 14:03:47	1.43
+++ Mmakefile	1999/10/25 14:50:41
@@ -338,9 +338,11 @@
 	cd runtime && rm -rf tmp_dir && mkdir tmp_dir && \
 		{ mv -f *.o *.pic_o *.a *.so tmp_dir || true; }
 	cd library && rm -rf tmp_dir && mkdir tmp_dir && \
-		{ mv -f *.c *.o *.pic_o *.a *.so tmp_dir || true; }
+		{ mv -f *.c *.o *.pic_o *.a *.so \
+			Mercury/cs/*.c Mercury/os/*.o tmp_dir || true; }
 	cd browser && rm -rf tmp_dir && mkdir tmp_dir && \
-		{ mv -f *.c *.o *.pic_o *.a *.so tmp_dir || true; }
+		{ mv -f *.c *.o *.pic_o *.a *.so \
+			Mercury/cs/*.c Mercury/os/*.o tmp_dir || true; }
 	cd trace && rm -rf tmp_dir && mkdir tmp_dir && \
 		{ mv -f *.o *.pic_o *.a *.so tmp_dir || true; }
 	for grade in x $(LIBGRADES); do \
@@ -365,17 +367,23 @@
 		  $(SUBDIR_MMAKE) GRADE=$$grade install_lib ) && \
 		( cd boehm_gc && rm -f *.o *.pic_o *.a *.so ) && \
 		( cd runtime && rm -f *.o *.pic_o *.a *.so ) && \
-		( cd library && rm -f *.c *.o *.pic_o *.a *.so ) && \
-		( cd browser && rm -f *.c *.o *.pic_o *.a *.so ) && \
+		( cd library && rm -f *.c *.o *.pic_o *.a *.so \
+				Mercury/cs/*.c Mercury/os/*.o ) && \
+		( cd browser && rm -f *.c *.o *.pic_o *.a *.so \
+				Mercury/cs/*.c Mercury/os/*.o ) && \
 		( cd trace && rm -f *.o *.pic_o *.a *.so ) && \
 		true \
-		|| exit 1; \
+		|| { scripts/mercury_cleanup_install; exit 1; }; \
 	    fi; \
 	done
 	cd boehm_gc && { mv tmp_dir/* . ; rmdir tmp_dir; true; }
 	cd runtime  && { mv tmp_dir/* . ; rmdir tmp_dir; true; }
-	cd library  && { mv tmp_dir/* . ; rmdir tmp_dir; true; }
-	cd browser  && { mv tmp_dir/* . ; rmdir tmp_dir; true; }
+	cd library  && { [ -d Mercury/cs ] && mv tmp_dir/*.c Mercury/cs; \
+			 [ -d Mercury/os ] && mv tmp_dir/*.o Mercury/os; \
+			 mv tmp_dir/* . ; rmdir tmp_dir; true; }
+	cd browser  && { [ -d Mercury/cs ] && mv tmp_dir/*.c Mercury/cs; \
+			 [ -d Mercury/os ] && mv tmp_dir/*.o Mercury/os; \
+			 mv tmp_dir/* . ; rmdir tmp_dir; true; }
 	cd trace    && { mv tmp_dir/* . ; rmdir tmp_dir; true; }
 
 .PHONY: install_split_library
@@ -383,12 +391,17 @@
 	cd library && \
 	rm -rf tmp_dir && \
 	mkdir tmp_dir && \
-	{ mv -f *.dir *.c *.o *.pic_o *.a *.so tmp_dir || true; } && \
+	{ mv -f *.dir *.c *.o *.pic_o *.a *.so \
+		Mercury/cs/*.c Mercury/os/*.o tmp_dir || true; } && \
 	for grade in $(GRADE) $(LIBGRADES); do \
-	        $(SUBDIR_MMAKE) GRADE=$$grade install_split_library || exit 1; \
-	        rm -rf *.dir *.c *.o *.pic_o *.a *.so; \
+	        $(SUBDIR_MMAKE) GRADE=$$grade install_split_library || \
+			{ scripts/mercury_cleanup_install; exit 1; }; \
+	        rm -rf *.dir *.c *.o *.pic_o *.a *.so \
+			Mercury/cs/*.c Mercury/os/*.o; \
 	done && \
-	{ mv tmp_dir/* . ; rmdir tmp_dir; true; }
+	{ [ -d Mercury/cs ] && mv tmp_dir/cs/*.c Mercury/cs; \
+	  [ -d Mercury/os ] && mv tmp_dir/os/*.o Mercury/os; \
+	  mv tmp_dir/* . ; rmdir tmp_dir; true; }
 
 #-----------------------------------------------------------------------------#
 #

-- 
Fergus Henderson <fjh at cs.mu.oz.au>  |  "I have always known that the pursuit
WWW: <http://www.cs.mu.oz.au/~fjh>  |  of excellence is a lethal habit"
PGP: finger fjh at 128.250.37.3        |     -- the last words of T. S. Garp.
--------------------------------------------------------------------------
mercury-developers mailing list
Post messages to:       mercury-developers at cs.mu.oz.au
Administrative Queries: owner-mercury-developers at cs.mu.oz.au
Subscriptions:          mercury-developers-request at cs.mu.oz.au
--------------------------------------------------------------------------



More information about the developers mailing list