[m-dev.] For review: Simplify specification of some per-program flags

Warwick Harvey wharvey at cs.monash.edu.au
Wed Jun 30 12:28:27 AEST 1999


Is it documented anywhere that having a Mercury module name end in "_init"
is a bad idea?  :-)


Estimated hours taken: 2

Specifying GRADEFLAGS and C2INITFLAGS on a per-program basis didn't work
properly for `_init.c' files.  Rather than just specifying `-foo' versions,
one had to specify `-foo_init.c' or `-foo_init' versions instead or as well.
This change corrects this.

scripts/Mmake.vars.in:
	Strip any `_init.c' "suffix" (we assume such a string will only be
	at the end of a file name) from the `$@' automatic variable used in
	the per-target definitions of GRADEFLAGS and C2INITFLAGS.

Index: Mmake.vars.in
===================================================================
RCS file: /home/mercury1/repository/mercury/scripts/Mmake.vars.in,v
retrieving revision 1.24
diff -u -r1.24 Mmake.vars.in
--- Mmake.vars.in	1998/12/06 23:48:56	1.24
+++ Mmake.vars.in	1999/06/30 02:10:47
@@ -185,10 +185,11 @@
 
 TARGET_GRADEFLAGS = \
   $(maybe-base-GRADEFLAGS-$(findstring undefined,$(origin GRADEFLAGS-$*))) \
-  $(maybe-target-GRADEFLAGS-$(findstring undefined,$(origin GRADEFLAGS-$@)))
+  $(maybe-target-GRADEFLAGS-$(findstring undefined,\
+		$(origin GRADEFLAGS-$(subst _init.c,,$@))))
 maybe-base-GRADEFLAGS- = $(GRADEFLAGS-$*)
 maybe-base-GRADEFLAGS-undefined =
-maybe-target-GRADEFLAGS- = $(GRADEFLAGS-$@)
+maybe-target-GRADEFLAGS- = $(GRADEFLAGS-$(subst _init.c,,$@))
 maybe-target-GRADEFLAGS-undefined =
 
 TARGET_MCFLAGS = \
@@ -197,8 +198,9 @@
 maybe-base-MCFLAGS-undefined =
 
 TARGET_C2INITFLAGS = \
-  $(maybe-target-C2INITFLAGS-$(findstring undefined,$(origin C2INITFLAGS-$@)))
-maybe-target-C2INITFLAGS- = $(C2INITFLAGS-$@)
+  $(maybe-target-C2INITFLAGS-$(findstring undefined,\
+		$(origin C2INITFLAGS-$(subst _init.c,,$@))))
+maybe-target-C2INITFLAGS- = $(C2INITFLAGS-$(subst _init.c,,$@))
 maybe-target-C2INITFLAGS-undefined =
 
 TARGET_MGNUCFLAGS = \


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