[m-rev.] diff: simplify X_calls_mercury samples

Simon Taylor stayl at cs.mu.OZ.AU
Fri Dec 21 17:23:28 AEDT 2001



Estimated hours taken: 0.5
Branches: main

Simplify the c_calls_mercury and cplusplus_calls_mercury samples.

c_calls_mercury/mercury_main.m:
cplusplus_calls_mercury/mercury_main.m:
c_calls_mercury/Mmakefile:
cplusplus_calls_mercury/Mmakefile:
	Import mercury_lib.m from mercury_main.m to avoid
	requiring explicit dependencies on mercury_lib.o.

	Remove unnecessary header file dependencies.

Index: c_calls_mercury//Mmakefile
===================================================================
RCS file: /home/mercury1/repository/mercury/samples/c_interface/c_calls_mercury/Mmakefile,v
retrieving revision 1.6
diff -u -u -r1.6 Mmakefile
--- c_calls_mercury//Mmakefile	18 May 2001 14:23:54 -0000	1.6
+++ c_calls_mercury//Mmakefile	21 Dec 2001 05:59:10 -0000
@@ -3,7 +3,7 @@
 #-----------------------------------------------------------------------------#
 MAIN_TARGET=all
 
-depend: mercury_main.depend mercury_lib.depend
+depend: mercury_main.depend
 all: mercury_main
 
 #-----------------------------------------------------------------------------#
@@ -13,15 +13,11 @@
 MLFLAGS=-g
 
 # tell the Mercury linker to link in c_main.o and mercury_lib.o
-MLOBJS=c_main.o $(mercury_lib.os)
+MLOBJS=c_main.o
 
 #-----------------------------------------------------------------------------#
 
 c_main.o: mercury_lib.h c_main.h
-
-# to make mercury_lib.h, just compile mercury_lib.m;
-# the Mercury compiler will create mercury_lib.h as a side-effect.
-mercury_lib.h: $(mercury_lib.os)
 
 # make sure that `mmake clean' removes c_main.o
 clean_local:
Index: c_calls_mercury//mercury_main.m
===================================================================
RCS file: /home/mercury1/repository/mercury/samples/c_interface/c_calls_mercury/mercury_main.m,v
retrieving revision 1.2
diff -u -u -r1.2 mercury_main.m
--- c_calls_mercury//mercury_main.m	10 Sep 1997 11:00:56 -0000	1.2
+++ c_calls_mercury//mercury_main.m	21 Dec 2001 06:00:43 -0000
@@ -8,6 +8,11 @@
 
 :- implementation.
 
+	% Nothing from mercury_lib is used in mercury_main.
+	% The import is needed to make sure mmake includes
+	% mercury_lib in the executable.
+:- import_module mercury_lib.
+
 % import the module which defines the Mercury interface to the
 % C function c_main().
 :- import_module c_main_int.
Index: cplusplus_calls_mercury//Mmakefile
===================================================================
RCS file: /home/mercury1/repository/mercury/samples/c_interface/cplusplus_calls_mercury/Mmakefile,v
retrieving revision 1.6
diff -u -u -r1.6 Mmakefile
--- cplusplus_calls_mercury//Mmakefile	16 Dec 2001 05:22:18 -0000	1.6
+++ cplusplus_calls_mercury//Mmakefile	21 Dec 2001 06:02:53 -0000
@@ -3,7 +3,7 @@
 #-----------------------------------------------------------------------------#
 MAIN_TARGET=all
 
-depend: mercury_main.depend mercury_lib.depend
+depend: mercury_main.depend
 all: mercury_main
 
 #-----------------------------------------------------------------------------#
@@ -30,14 +30,10 @@
 MGNUCFLAGS=-g
 MLFLAGS=-g
 
-# tell the Mercury linker to link in cpp_main.o and mercury_lib.o
-MLOBJS=cpp_main.o mercury_lib.o
+# tell the Mercury linker to link in cpp_main.o
+MLOBJS=cpp_main.o
 
 #-----------------------------------------------------------------------------#
-
-# tell mmake that it needs to make cpp_main.o and mercury_lib.o
-# before it can make mercury_main
-mercury_main: cpp_main.o mercury_lib.o
 
 # we also need to add header file dependencies
 cpp_main.o: cpp_main.h mercury_lib.h
Index: cplusplus_calls_mercury//mercury_main.m
===================================================================
RCS file: /home/mercury1/repository/mercury/samples/c_interface/cplusplus_calls_mercury/mercury_main.m,v
retrieving revision 1.2
diff -u -u -r1.2 mercury_main.m
--- cplusplus_calls_mercury//mercury_main.m	10 Sep 1997 11:01:00 -0000	1.2
+++ cplusplus_calls_mercury//mercury_main.m	21 Dec 2001 06:01:04 -0000
@@ -8,6 +8,11 @@
 
 :- implementation.
 
+	% Nothing from mercury_lib is used in mercury_main.
+	% The import is needed to make sure mmake includes
+	% mercury_lib in the executable.
+:- import_module mercury_lib.
+
 % import the module which defines the Mercury interface to the
 % C++ function cpp_main().
 :- import_module cpp_main_int.
--------------------------------------------------------------------------
mercury-reviews mailing list
post:  mercury-reviews at cs.mu.oz.au
administrative address: owner-mercury-reviews at cs.mu.oz.au
unsubscribe: Address: mercury-reviews-request at cs.mu.oz.au Message: unsubscribe
subscribe:   Address: mercury-reviews-request at cs.mu.oz.au Message: subscribe
--------------------------------------------------------------------------



More information about the reviews mailing list