diff: new GRADEFLAGS variable in Mmake

Fergus Henderson fjh at cs.mu.oz.au
Fri Nov 21 18:45:36 AEDT 1997


Add support for a new `GRADEFLAGS' variable to Mmake,
so that you can use the more readable (and more portable)
`GRADEFLAGS = --profiling' rather than e.g. `GRADEFLAGS = asm_fast.gc.prof'.

scripts/Mmake.vars.in:
	Add GRADEFLAGS variable, defaulting to `--grade $(GRADE)'.

scripts/Mmake.rules:
	Change various rules to use `$(GRADEFLAGS)' instead of
	`--grade $(GRADE)'.

compiler/modules.m:
	Change various rules in the generated `.dep' files to
	use `$(GRADEFLAGS)' instead of `--grade $(GRADE)'.

doc/user_guide.texi:
	Modify the documentation to reflect the above changes.

cvs diff  compiler/modules.m doc/user_guide.texi scripts/Mmake.rules scripts/Mmake.vars.in
Index: compiler/modules.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/modules.m,v
retrieving revision 1.42
diff -u -r1.42 modules.m
--- modules.m	1997/10/16 04:59:11	1.42
+++ modules.m	1997/11/21 07:26:06
@@ -562,7 +562,8 @@
 			ModuleName, ".dir/", ModuleName, "_000.o: ",
 				ModuleName, ".m\n",
 			"\trm -rf ", ModuleName, ".dir\n",
-			"\t$(MCS) -s$(GRADE) $(MCSFLAGS) ", ModuleName, ".m\n"
+			"\t$(MCS) $(GRADEFLAGS) $(MCSFLAGS) ",
+				ModuleName, ".m\n"
 		]),
 
 		io__close_output(DepStream),
@@ -878,7 +879,7 @@
 	io__write_strings(DepStream, [
 		ModuleName, " : $(", ModuleName, ".os) ",
 		ModuleName, "_init.o\n",
-		"\t$(ML) -s $(GRADE) $(MLFLAGS) -o ", ModuleName, " ",
+		"\t$(ML) $(GRADEFLAGS) $(MLFLAGS) -o ", ModuleName, " ",
 		ModuleName, "_init.o \\\n",
 		"\t$(", ModuleName, ".os) $(MLLIBS)\n\n"
 	]),
@@ -886,7 +887,7 @@
 	io__write_strings(DepStream, [
 		ModuleName, ".split : ", ModuleName, ".split.a ",
 				ModuleName, "_init.o\n",
-		"\t$(ML) -s $(GRADE) $(MLFLAGS) -o ", ModuleName, ".split ",
+		"\t$(ML) $(GRADEFLAGS) $(MLFLAGS) -o ", ModuleName, ".split ",
 			ModuleName, "_init.o \\\n",
 			"\t", ModuleName, ".split.a $(MLLIBS)\n\n"
 	]),
@@ -912,7 +913,7 @@
 
 	io__write_strings(DepStream, [
 		"lib", ModuleName, ".so : $(", ModuleName, ".pic_os)\n",
-		"\t$(ML) --make-shared-lib --grade $(GRADE) $(MLFLAGS) -o ",
+		"\t$(ML) --make-shared-lib $(GRADEFLAGS) $(MLFLAGS) -o ",
 			"lib", ModuleName, ".so \\\n",
 		"\t\t$(", ModuleName, ".pic_os) $(MLLIBS)\n\n"
 	]),
Index: doc/user_guide.texi
===================================================================
RCS file: /home/mercury1/repository/mercury/doc/user_guide.texi,v
retrieving revision 1.106
diff -u -r1.106 user_guide.texi
--- user_guide.texi	1997/11/21 07:35:40	1.106
+++ user_guide.texi	1997/11/21 07:35:45
@@ -1075,11 +1075,12 @@
 @node Building profiled applications
 @section Building profiled applications
 
-To enable profiling, your program must be built in a @samp{.prof} grade.
-For example, if the default grade on your system is @samp{asm_fast.gc}, then
-to compile with profiling enabled, use grade @samp{asm_fast.gc.prof}.  You
-can do this by setting the @samp{GRADE} variable in your Mmake file, e.g. by
-adding the line @samp{GRADE=asm_fast.gc.prof}. 
+To enable profiling, your program must be built with profiling enabled.
+This can be done by passing the @samp{-p} (@samp{--profiling}) option
+to @samp{mmc} (and also to @samp{mgnuc} and @samp{ml}, if you invoke them
+seperately).  If you are using Mmake, then
+you can do this by setting the @samp{GRADEFLAGS} variable in your Mmakefile,
+e.g. by adding the line @samp{GRADEFLAGS=--profiling}. 
 @xref{Compilation model options} for more information about the
 different grades.
 
@@ -1725,7 +1726,9 @@
 or @samp{symbol MR_runtime_grade multiply defined}.)
 
 The options below must be passed to @samp{mgnuc} and @samp{ml} as well
-as to @samp{mmc}.
+as to @samp{mmc}.  If you are using Mmake, then you should specify
+these options in the @samp{GRADEFLAGS} variable rather than specifying
+them in @samp{MCFLAGS}, @samp{MGNUCFLAGS}, and @samp{MLFLAGS}.
 
 @table @asis
 @item @code{-s @var{grade}}
Index: scripts/Mmake.rules
===================================================================
RCS file: /home/mercury1/repository/mercury/scripts/Mmake.rules,v
retrieving revision 1.44
diff -u -r1.44 Mmake.rules
--- Mmake.rules	1997/11/21 07:10:59	1.44
+++ Mmake.rules	1997/11/21 07:24:32
@@ -101,36 +101,36 @@
 
 .m.c:
 	rm -f $*.c
-	$(MCG) --grade $(GRADE) $(MCGFLAGS) $< > $*.err 2>&1
+	$(MCG) $(GRADEFLAGS) $(MCGFLAGS) $< > $*.err 2>&1
 
 .c.o:
-	$(MGNUC) --grade $(GRADE) $(MGNUCFLAGS) -c $< -o $@
+	$(MGNUC) $(GRADEFLAGS) $(MGNUCFLAGS) -c $< -o $@
 
 # .c.pic_o:
-# 	$(MGNUC) --grade $(GRADE) $(MGNUCFLAGS) $(CFLAGS_FOR_PIC) -c $< -o $@
+# 	$(MGNUC) $(GRADEFLAGS) $(MGNUCFLAGS) $(CFLAGS_FOR_PIC) -c $< -o $@
 
 .c.s:
-	$(MGNUC) --grade $(GRADE) $(MGNUCFLAGS) -S $< -o $@
+	$(MGNUC) $(GRADEFLAGS) $(MGNUCFLAGS) -S $< -o $@
 
 .c.pic_s:
-	$(MGNUC) --grade $(GRADE) $(MGNUCFLAGS) $(CFLAGS_FOR_PIC) -S $< -o $@
+	$(MGNUC) $(GRADEFLAGS) $(MGNUCFLAGS) $(CFLAGS_FOR_PIC) -S $< -o $@
 
 .c.i:
-	$(MGNUC) --grade $(GRADE) $(MGNUCFLAGS) -E $< > $@
+	$(MGNUC) $(GRADEFLAGS) $(MGNUCFLAGS) -E $< > $@
 
 .m.o:
 	$(MMAKE_MAKE_CMD) $(MAKEOVERRIDES) $*.c
-	$(MGNUC) --grade $(GRADE) $(MGNUCFLAGS) -c $*.c -o $@
+	$(MGNUC) $(GRADEFLAGS) $(MGNUCFLAGS) -c $*.c -o $@
 	$(RM_C) $*.c
 
 .o.pic_o:
 	$(MMAKE_MAKE_CMD) $(MAKEOVERRIDES) $*.c
-	$(MGNUC) --grade $(GRADE) $(MGNUCFLAGS) $(CFLAGS_FOR_PIC) -c $*.c -o $@
+	$(MGNUC) $(GRADEFLAGS) $(MGNUCFLAGS) $(CFLAGS_FOR_PIC) -c $*.c -o $@
 	$(RM_C) $*.c
 
 %.dir/*.o: %.m
 	rm -f $@
-	$(MCS) --grade $(GRADE) $(MCSFLAGS) $<
+	$(MCS) $(GRADEFLAGS) $(MCSFLAGS) $<
 
 #-----------------------------------------------------------------------------#
 
Index: scripts/Mmake.vars.in
===================================================================
RCS file: /home/mercury1/repository/mercury/scripts/Mmake.vars.in,v
retrieving revision 1.11
diff -u -r1.11 Mmake.vars.in
--- Mmake.vars.in	1997/11/21 07:11:00	1.11
+++ Mmake.vars.in	1997/11/21 07:13:46
@@ -25,6 +25,8 @@
 DEFAULT_GRADE	= $(MERCURY_DEFAULT_GRADE)
 GRADE		= $(DEFAULT_GRADE)
 
+GRADEFLAGS	= --grade $(GRADE) $(EXTRA_GRADEFLAGS)
+
 MC		= mmc
 MCS		= $(MC) --split-c-files --compile-only
 MCG		= $(MC) --compile-to-c

-- 
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.



More information about the developers mailing list