[m-dev.] diff: fix Mmakefiles in samples/tests

Fergus Henderson fjh at cs.mu.OZ.AU
Sun Nov 19 15:13:41 AEDT 2000


Estimated hours taken: 3

samples/tests/Mmakefile:
	The old version of this file had a bogus SUBDIRS list
	and a lot of code duplication with Mmake.common.samples.
	I rewrote it to use Mmake.common.samples.

samples/tests/Mmake.common.samples:
	Add some documentation.
	Add some missing dependencies for the dep_local target.
	Automatically set the SUBDIRS variable to the correct value,
	rather than always setting it to empty.
	Fix a couple of other bugs (an `ifeq' should have been `ifneq'
	and in the condition of that test `$(SUBDIRS)' should have
	been `"$(SUBDIRS)"').

samples/tests/Mmake.common:
samples/tests/generate_exp:
	Delete the code for making .exp files using NU-Prolog.

samples/tests/c_interface/c_calls_mercury/Mmakefile:
samples/tests/c_interface/cplusplus_calls_mercury/Mmakefile:
	Fix a bug: add some extra dependencies to ensure that
	it copies the right files before invoking mmc to make
	the dependencies.

Workspace: /home/pgrad/fjh/ws/hg3
Index: samples/tests/c_interface/c_calls_mercury/Mmakefile
===================================================================
RCS file: /home/mercury1/repository/mercury/samples/tests/c_interface/c_calls_mercury/Mmakefile,v
retrieving revision 1.1
diff -u -d -r1.1 Mmakefile
--- samples/tests/c_interface/c_calls_mercury/Mmakefile	2000/02/14 05:28:07	1.1
+++ samples/tests/c_interface/c_calls_mercury/Mmakefile	2000/11/19 03:41:47
@@ -17,8 +17,8 @@
 
 # Add a few dependencies so that it copies the source
 # files correctly.
-mercury_lib.o: mercury_lib.m
-mercury_main.depend: c_main_int.m
+mercury_lib.o mercury_lib.depend mercury_lib.dep: mercury_lib.m
+mercury_main.depend mercury_main.dep: c_main_int.m mercury_main.m
 c_main_int.o: c_main.h
 
 clean_local: clean_2
Index: samples/tests/c_interface/cplusplus_calls_mercury/Mmakefile
===================================================================
RCS file: /home/mercury1/repository/mercury/samples/tests/c_interface/cplusplus_calls_mercury/Mmakefile,v
retrieving revision 1.1
diff -u -d -r1.1 Mmakefile
--- samples/tests/c_interface/cplusplus_calls_mercury/Mmakefile	2000/02/14 05:28:10	1.1
+++ samples/tests/c_interface/cplusplus_calls_mercury/Mmakefile	2000/11/19 04:10:51
@@ -17,8 +17,8 @@
 
 # Add a few dependencies so that it copies the source
 # files correctly.
-mercury_lib.o: mercury_lib.m
-mercury_main.depend: cpp_main_int.m
+mercury_lib.depend mercury_lib.o: mercury_lib.m
+mercury_main.depend: mercury_main.depend cpp_main_int.m
 cpp_main_int.o: cpp_main.h
 
 clean_local: clean_2
Index: samples/tests/generate_exp
===================================================================
RCS file: generate_exp
diff -N generate_exp
--- /tmp/cvsbdUkN4	Sun Nov 19 15:12:27 2000
+++ /dev/null	Thu Mar 30 14:06:13 2000
@@ -1,15 +0,0 @@
-#!/bin/sh
-# Generate the .exp files that are used as a basis of comparison to check
-# the correctness of the code emitted by the Mercury compiler.
-
-. ./handle_options
-
-root=`pwd`
-for dir in benchmarks general
-do
-	cd $dir
-	mmake $jfactor realclean
-	mmake $jfactor depend
-	mmake $jfactor HAVE_NUPROLOG=yes exp
-	cd $root
-done
Index: samples/tests/Mmake.common
===================================================================
RCS file: /home/mercury1/repository/mercury/samples/tests/Mmake.common,v
retrieving revision 1.2
diff -u -d -r1.2 Mmake.common
--- samples/tests/Mmake.common	2000/02/16 07:30:10	1.2
+++ samples/tests/Mmake.common	2000/11/18 21:09:08
@@ -6,18 +6,10 @@
 # file by setting both GRADEFLAGS-foo.
 #
 
-# override this with `mmake HAVE_NUPROLOG=yes'
-# if you want to rebuild the `.exp' files.
-HAVE_NUPROLOG=no
-
 DIFF_OPTS=-c
 
 #-----------------------------------------------------------------------------#
 
-# .PRECIOUS: %.mod %.c %.o %_init.c %.no %.nu %_init.nl %_init.no
-
-%_init.c: Entry
-
 #
 # If there is a `.inp' file, then we pipe that in as the command's input.
 # If there is a `.arg' file, then we use it as the command's argument
@@ -68,6 +60,8 @@
 clean_res:
 	rm -f *.res
 	rm -f *.res2
+
+#-----------------------------------------------------------------------------#
 
 #
 # The `foo' targets make `foo_local' in the current directory before
Index: samples/tests/Mmake.common.samples
===================================================================
RCS file: /home/mercury1/repository/mercury/samples/tests/Mmake.common.samples,v
retrieving revision 1.1
diff -u -d -r1.1 Mmake.common.samples
--- samples/tests/Mmake.common.samples	2000/02/14 05:28:00	1.1
+++ samples/tests/Mmake.common.samples	2000/11/19 04:07:28
@@ -1,3 +1,12 @@
+#-----------------------------------------------------------------------------#
+
+# The Mmake file which includes this one should set the following variables:
+#	THISDIR		relative path of source directory from `samples'
+#	DEPTH		relative path of `samples/test' directory from current
+#			(i.e. . or .. or ../.. or ../../.. etc.)
+#	PROGS		list of Mercury programs to build and test
+#	TESTS		additional tests to run
+#	EXTRA_FILES	additional files to copy from the source directory
 
 #-----------------------------------------------------------------------------#
 
@@ -16,7 +25,7 @@
 OUTS=	$(PROGS:%=%.out) $(TESTS:%=%.out)
 RESS=	$(PROGS:%=%.res) $(TESTS:%=%.res)
 
-dep_local:	$(DEPS)
+dep_local:	extra_files $(SRCS) $(DEPS)
 depend_local:	extra_files $(SRCS) $(DEPENDS)
 check_local:	$(OUTS) $(RESS)
 all_local:	$(PROGS) $(TESTS)
@@ -37,9 +46,10 @@
 realclean:
 	rm -f $(SRCS) $(EXTRA_FILES)
 
-SUBDIRS = 
+SUBMMAKEFILES := $(wildcard */Mmakefile)
+SUBDIRS := $(SUBMMAKEFILES:%/Mmakefile=%)
 
-ifeq ($(SUBDIRS),"")
+ifneq ("$(SUBDIRS)","")
 
 dep_subdirs:
 	for dir in $(SUBDIRS); do \
Index: samples/tests/Mmakefile
===================================================================
RCS file: /home/mercury1/repository/mercury/samples/tests/Mmakefile,v
retrieving revision 1.1
diff -u -d -r1.1 Mmakefile
--- samples/tests/Mmakefile	2000/02/14 05:28:01	1.1
+++ samples/tests/Mmakefile	2000/11/19 03:03:59
@@ -1,37 +1,16 @@
-SUBDIRS = benchmarks general hard_coded invalid misc_tests tabling term valid warnings
-NUPROLOG_SUBDIRS = benchmarks general
+#-----------------------------------------------------------------------------#
 
 main_target: check
 
-# Generate the .exp files that are used as a basis of comparison to check
-# the correctness of the code emitted by the Mercury compiler.
-exp:
-	for dir in $(NUPROLOG_SUBDIRS); do \
-		(cd $$dir && mmake $(MMAKEFLAGS) exp) || exit 1; \
-	done
-
-# run the tests
-check:
-	for dir in $(SUBDIRS); do \
-		(cd $$dir && mmake $(MMAKEFLAGS) check) || exit 1; \
-	done
-
-dep:
-	for dir in $(SUBDIRS); do \
-		(cd $$dir && mmake $(MMAKEFLAGS) dep) || exit 1; \
-	done
+PROGS=
+TESTS=
+EXTRA_FILES=
+DEPTH=.
+THISDIR=.
 
-depend:
-	for dir in $(SUBDIRS); do \
-		(cd $$dir && mmake $(MMAKEFLAGS) depend) || exit 1; \
-	done
+#-----------------------------------------------------------------------------#
 
-realclean:
-	for dir in $(SUBDIRS); do \
-		(cd $$dir && mmake $(MMAKEFLAGS) realclean) || exit 1; \
-	done
+include $(DEPTH)/Mmake.common
+include $(DEPTH)/Mmake.common.samples
 
-clean:
-	for dir in $(SUBDIRS); do \
-		(cd $$dir && mmake $(MMAKEFLAGS) clean) || exit 1; \
-	done
+#-----------------------------------------------------------------------------#

-- 
Fergus Henderson <fjh at cs.mu.oz.au>  |  "I have always known that the pursuit
                                    |  of excellence is a lethal habit"
WWW: <http://www.cs.mu.oz.au/~fjh>  |     -- 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