[m-rev.] diff: addition to stand-alone interface example

Julien Fischer juliensf at csse.unimelb.edu.au
Mon Jun 18 15:24:01 AEST 2007


Estimated hours taken: 0.2
Branches: main

Make it easier to build the stand-alone interface example in different grades.

samples/c_interface/standalone_c/Makefile:
 	Add a variable to set the option for setting the grade to build
 	the example in.

Julien.

Index: Makefile
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/samples/c_interface/standalone_c/Makefile,v
retrieving revision 1.1
diff -u -r1.1 Makefile
--- Makefile	22 Feb 2007 06:52:32 -0000	1.1
+++ Makefile	18 Jun 2007 05:21:20 -0000
@@ -40,6 +40,14 @@

  all: c_main

+# This variables holds the options required to set the grade.
+# By default this is empty so the example will build in the default grade.
+# To try, for example, a deep profiling grade, set it to:
+#
+#    GRADEOPT=--grade asm_fast.gc.profdeep
+#
+GRADEOPT=
+
  # Build the example Mercury library, mercury_lib.
  # The dependency on the .init file is merely a convenience.  It's a good
  # one to choose since it will always be regenerated if one of the .m files
@@ -50,7 +58,7 @@
  # library.
  #
  mercury_lib.init: mercury_lib.m
-	mmc --make libmercury_lib
+	mmc $(GRADEOPT) --make libmercury_lib

  # The following rule creates the stand-alone interface to the mercury_lib
  # library, Mercury standard library and Mercury runtime.  Since we haven't
@@ -59,7 +67,7 @@
  # `--mld' option to specify its location.
  #
  mercury_lib_int.o: mercury_lib.init
-	mmc --mercury-linkage static --ml mercury_lib \
+	mmc $(GRADEOPT) --mercury-linkage static --ml mercury_lib \
  		--generate-standalone-interface mercury_lib_int

  # We use the mgnuc script here rather than invoking gcc directly since
@@ -70,16 +78,16 @@
  # the `-I' option.
  #
  c_main.o: c_main.c mercury_lib.init mercury_lib_int.o
-	mgnuc -c c_main.c
+	mgnuc $(GRADEOPT) -c c_main.c

  # For similar reasons we use the ml script rather than invoking ld directly.
  #
  c_main: c_main.o mercury_lib_int.o mercury_lib.init
-	ml --mercury-libs static -o c_main \
+	ml $(GRADEOPT) --mercury-libs static -o c_main \
  		c_main.o libmercury_lib.a mercury_lib_int.o

  .PHONY: realclean
  realclean:
  	-mmc --make mercury_lib.realclean
-	/bin/rm -f mercury_lib_int.[cho] c_main.o c_main
+	/bin/rm -f mercury_lib_int.[cho] c_main.o c_main Deep.data
  	/bin/rm -rf Mercury

--------------------------------------------------------------------------
mercury-reviews mailing list
Post messages to:       mercury-reviews at csse.unimelb.edu.au
Administrative Queries: owner-mercury-reviews at csse.unimelb.edu.au
Subscriptions:          mercury-reviews-request at csse.unimelb.edu.au
--------------------------------------------------------------------------



More information about the reviews mailing list