diff: Mmakefile simplifications

Fergus Henderson fjh at cs.mu.OZ.AU
Thu Apr 8 22:55:09 AEST 1999


Estimated hours taken: 2

Simplify the Mmakefiles.  Fix a few minor latent bugs.

*/Mmakefile:
	- Factor out some common code by defining a new variable M_ENV
	  which holds settings of environment variables for mmc, mgnuc, etc.
	- For consistency, always override MERCURY_C_ALL_INCL_DIRS rather
	  than passing extra `-I' options to mgnuc.
	- Make sure to always include `$(BOEHM_GC)/include' in the search path,
	  so that it will work if we try to compile with `-O6'.
	- Make sure to always include `--cflags $(ALL_CFLAGS)' in MCS, so
	  that the EXTRA_CFLAGS etc. will get passed down to gcc via mmc.
	- Make sure that the Mmakefiles in all directories set
	  all the MC* variables: MCPI, MCSI, MCOI, MCTOI, etc.

Index: browser/Mmakefile
===================================================================
RCS file: /home/mercury1/repository/mercury/browser/Mmakefile,v
retrieving revision 1.3
diff -u -r1.3 Mmakefile
--- Mmakefile	1999/03/15 00:39:23	1.3
+++ Mmakefile	1999/04/06 17:35:25
@@ -34,30 +34,24 @@
 # Don't change these without good reason - if you want to
 # do a temporary change, change ../Mmake.params.
 
-MCD	=	MERCURY_INT_DIR=$(LIBRARY_DIR) \
-		MERCURY_ALL_C_INCL_DIRS="-I$(TRACE_DIR) -I$(RUNTIME_DIR)" \
-			$(MC) --generate-dependencies
-MCI	=	MERCURY_INT_DIR=$(LIBRARY_DIR) \
-		MERCURY_ALL_C_INCL_DIRS="-I$(TRACE_DIR) -I$(RUNTIME_DIR)" \
-			$(MC) --make-interface
-MCOI	=	MERCURY_INT_DIR=$(LIBRARY_DIR) \
-		MERCURY_ALL_C_INCL_DIRS="-I$(TRACE_DIR) -I$(RUNTIME_DIR)" \
-			$(MC) --make-opt-int
-MCTOI	=	MERCURY_INT_DIR=$(LIBRARY_DIR) \
-		MERCURY_ALL_C_INCL_DIRS="-I$(TRACE_DIR) -I$(RUNTIME_DIR)" \
-			$(MC) --make-trans-opt
-MCG	=	MERCURY_INT_DIR=$(LIBRARY_DIR) \
-		MERCURY_ALL_C_INCL_DIRS="-I$(TRACE_DIR) -I$(RUNTIME_DIR)" \
-			$(MC) --compile-to-c
-MCS	=	MERCURY_INT_DIR=$(LIBRARY_DIR) \
-		MERCURY_ALL_C_INCL_DIRS="-I$(TRACE_DIR) -I$(RUNTIME_DIR)" \
-			$(MC) --split-c-files -c \
-			--cflags "-I$(TRACE_DIR) -I$(RUNTIME_DIR)" \
-			--cflags "-I$(BOEHM_GC_DIR) $(EXTRA_CFLAGS)"
-MGNUC	=	MERCURY_ALL_C_INCL_DIRS="-I$(TRACE_DIR) -I$(RUNTIME_DIR)" \
-			$(SCRIPTS_DIR)/mgnuc
-MGNUCFLAGS =	-I$(TRACE_DIR) -I$(RUNTIME_DIR) -I$(BOEHM_GC_DIR) \
-			$(EXTRA_MGNUCFLAGS) $(DLL_CFLAGS) $(EXTRA_CFLAGS)
+M_ENV	=	MERCURY_INT_DIR=$(LIBRARY_DIR) \
+		MERCURY_ALL_C_INCL_DIRS="\
+			-I$(TRACE_DIR) \
+			-I$(RUNTIME_DIR) \
+			-I$(BOEHM_GC_DIR) \
+			-I$(BOEHM_GC_DIR)/include \
+		"
+
+MCD	=	$(M_ENV) $(MC) --generate-dependencies
+MCI	=	$(M_ENV) $(MC) --make-interface
+MCPI	=	$(M_ENV) $(MC) --make-private-interface
+MCSI	=	$(M_ENV) $(MC) --make-short-interface
+MCOI	=	$(M_ENV) $(MC) --make-opt-int
+MCTOI	=	$(M_ENV) $(MC) --make-trans-opt
+MCG	=	$(M_ENV) $(MC) --compile-to-c
+MCS	=	$(M_ENV) $(MC) --split-c-files -c --cflags "$(ALL_CFLAGS)"
+MGNUC	=	$(M_ENV) $(SCRIPTS_DIR)/mgnuc
+MGNUCFLAGS =	$(EXTRA_MGNUCFLAGS) $(DLL_CFLAGS) $(EXTRA_CFLAGS)
 LDFLAGS	=	-L$(LIBRARY_DIR) -L$(RUNTIME_DIR) -L$(BOEHM_GC_DIR)
 LDLIBS	=	-l$(STD_LIB_NAME) -l$(RT_LIB_NAME) \
 		` case "$(GRADE)" in 					\
Index: bytecode/Mmakefile
===================================================================
RCS file: /home/mercury1/repository/mercury/bytecode/Mmakefile,v
retrieving revision 1.11
diff -u -r1.11 Mmakefile
--- Mmakefile	1998/01/29 13:56:22	1.11
+++ Mmakefile	1999/04/06 17:27:05
@@ -13,10 +13,13 @@
 
 #-----------------------------------------------------------------------------#
 
-INCPATH		= -I$(RUNTIME_DIR) -I$(BOEHM_GC_DIR) -I.
+INCPATH		= -I$(RUNTIME_DIR) \
+		  -I$(BOEHM_GC_DIR) \
+		  -I$(BOEHM_GC_DIR)/include \
+		  -I.
 LIBPATH		= -L$(RUNTIME_DIR) -L$(BOEHM_GC_DIR)
 CFLAGS		= -g $(EXTRA_CFLAGS) -D_POSIX_SOURCE $(INCPATH) -DDEBUGGING
-MGNUC		= MERCURY_C_INCL_DIR=. $(SCRIPTS_DIR)/mgnuc
+MGNUC		= MERCURY_ALL_C_INCL_DIRS="$(INCPATH)" $(SCRIPTS_DIR)/mgnuc
 MGNUCFLAGS	= $(CFLAGS) 
 
 MAKEDEPEND	= makedepend
Index: compiler/Mmakefile
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/Mmakefile,v
retrieving revision 1.15
diff -u -r1.15 Mmakefile
--- Mmakefile	1999/03/15 00:39:25	1.15
+++ Mmakefile	1999/04/06 17:27:25
@@ -19,21 +19,23 @@
 # Don't change these without good reason - if you want to
 # do a temporary change, change ../Mmake.params
 
-MCD	=	MERCURY_INT_DIR=. $(MC) --generate-dependencies
-MCI	=	MERCURY_INT_DIR=$(LIBRARY_DIR) $(MC) --make-interface
-MCSI	=	MERCURY_INT_DIR=$(LIBRARY_DIR) $(MC) --make-short-interface
-MCOI	=	MERCURY_INT_DIR=$(LIBRARY_DIR) $(MC) \
-			--make-optimization-interface
-MCTOI	=	MERCURY_INT_DIR=$(LIBRARY_DIR) $(MC) \
-			--make-transitive-optimization-interface
-MCG	=	MERCURY_ALL_C_INCL_DIRS="-I$(TRACE_DIR) -I$(RUNTIME_DIR)" \
-		MERCURY_INT_DIR=$(LIBRARY_DIR) $(MC) --compile-to-c
-MCS	=	MERCURY_ALL_C_INCL_DIRS="-I$(TRACE_DIR) -I$(RUNTIME_DIR)" \
-		MERCURY_INT_DIR=$(LIBRARY_DIR) \
-		$(MC) --cflags -I$(BOEHM_GC_DIR) --split-c-files -c 
-MGNUC	=	MERCURY_ALL_C_INCL_DIRS="-I$(TRACE_DIR) -I$(RUNTIME_DIR)" \
-			$(SCRIPTS_DIR)/mgnuc
-MGNUCFLAGS =	$(EXTRA_MGNUCFLAGS) -I$(BOEHM_GC_DIR) $(EXTRA_CFLAGS)
+M_ENV	=	MERCURY_INT_DIR=$(LIBRARY_DIR) \
+		MERCURY_ALL_C_INCL_DIRS="\
+			-I$(TRACE_DIR) \
+			-I$(RUNTIME_DIR) \
+			-I$(BOEHM_GC_DIR) \
+			-I$(BOEHM_GC_DIR)/include \
+		"
+MCD	=	$(M_ENV) $(MC) --generate-dependencies
+MCI	=	$(M_ENV) $(MC) --make-interface
+MCPI	=	$(M_ENV) $(MC) --make-private-interface
+MCSI	=	$(M_ENV) $(MC) --make-short-interface
+MCOI	=	$(M_ENV) $(MC) --make-optimization-interface
+MCTOI	=	$(M_ENV) $(MC) --make-transitive-optimization-interface
+MCG	=	$(M_ENV) $(MC) --compile-to-c
+MCS	=	$(M_ENV) $(MC) --split-c-files -c --cflags $(ALL_CFLAGS)
+MGNUC	=	$(M_ENV) $(SCRIPTS_DIR)/mgnuc
+MGNUCFLAGS =	$(EXTRA_MGNUCFLAGS) $(EXTRA_CFLAGS)
 C2INIT =	MERCURY_MOD_LIB_MODS="$(BROWSER_DIR)/$(BROWSER_LIB_NAME).init $(LIBRARY_DIR)/$(STD_LIB_NAME).init $(RUNTIME_DIR)/$(RT_LIB_NAME).init" \
 		MERCURY_MKINIT=$(UTIL_DIR)/mkinit $(SCRIPTS_DIR)/c2init
 ML	=	MERCURY_C_LIB_DIR=. $(SCRIPTS_DIR)/ml
Index: library/Mmakefile
===================================================================
RCS file: /home/mercury1/repository/mercury/library/Mmakefile,v
retrieving revision 1.36
diff -u -r1.36 Mmakefile
--- Mmakefile	1999/03/15 08:48:12	1.36
+++ Mmakefile	1999/04/06 17:29:49
@@ -44,35 +44,30 @@
 
 endif
 
-MCD	=	MERCURY_INT_DIR=. \
-		MERCURY_ALL_C_INCL_DIRS="-I$(TRACE_DIR) -I$(RUNTIME_DIR)" \
-			$(MC) --generate-dependencies $(INTERMODULE_OPTS)
-MCI	=	MERCURY_INT_DIR=. \
-		MERCURY_ALL_C_INCL_DIRS="-I$(TRACE_DIR) -I$(RUNTIME_DIR)" \
-			$(MC) --make-interface $(INTERMODULE_OPTS) \
+M_ENV	=	MERCURY_INT_DIR=. \
+		MERCURY_ALL_C_INCL_DIRS="\
+			-I$(TRACE_DIR) \
+			-I$(RUNTIME_DIR) \
+			-I$(BOEHM_GC_DIR) \
+			-I$(BOEHM_GC_DIR)/include \
+		"
+MCD	=	$(M_ENV) $(MC) --generate-dependencies $(INTERMODULE_OPTS)
+MCI	=	$(M_ENV) $(MC) --make-interface $(INTERMODULE_OPTS) \
 			$(ENABLE_TERM_OPTS)
-MCOI	=	MERCURY_INT_DIR=. \
-		MERCURY_ALL_C_INCL_DIRS="-I$(TRACE_DIR) -I$(RUNTIME_DIR)" \
-			$(MC) --make-opt-int $(INTERMODULE_OPTS) \
+MCPI	=	$(M_ENV) $(MC) --make-private-interface $(INTERMODULE_OPTS) \
 			$(ENABLE_TERM_OPTS)
-MCTOI	=	MERCURY_INT_DIR=. \
-		MERCURY_ALL_C_INCL_DIRS="-I$(TRACE_DIR) -I$(RUNTIME_DIR)" \
-			$(MC) --make-trans-opt $(INTERMODULE_OPTS) \
+MCSI	=	$(M_ENV) $(MC) --make-short-interface $(INTERMODULE_OPTS) \
 			$(ENABLE_TERM_OPTS)
-MCG	=	MERCURY_INT_DIR=. \
-		MERCURY_ALL_C_INCL_DIRS="-I$(TRACE_DIR) -I$(RUNTIME_DIR)" \
-			$(MC) --compile-to-c $(INTERMODULE_OPTS) \
+MCOI	=	$(M_ENV) $(MC) --make-opt-int $(INTERMODULE_OPTS) \
+			$(ENABLE_TERM_OPTS)
+MCTOI	=	$(M_ENV) $(MC) --make-trans-opt $(INTERMODULE_OPTS) \
+			$(ENABLE_TERM_OPTS)
+MCG	=	$(M_ENV) $(MC) --compile-to-c $(INTERMODULE_OPTS) \
 			$(CHECK_TERM_OPTS)
-MCS	=	MERCURY_INT_DIR=. \
-		MERCURY_ALL_C_INCL_DIRS="-I$(TRACE_DIR) -I$(RUNTIME_DIR)" \
-			$(MC) --split-c-files -c \
-			--cflags "-I$(TRACE_DIR) -I$(RUNTIME_DIR)" \
-			--cflags "-I$(BOEHM_GC_DIR) $(EXTRA_CFLAGS)" \
+MCS	=	$(M_ENV) $(MC) --split-c-files -c --cflags "$(ALL_CFLAGS)" \
 			$(INTERMODULE_OPTS) $(CHECK_TERM_OPTS)
-MGNUC	=	MERCURY_ALL_C_INCL_DIRS="-I$(TRACE_DIR) -I$(RUNTIME_DIR)" \
-			$(SCRIPTS_DIR)/mgnuc
-MGNUCFLAGS =	-I$(TRACE_DIR) -I$(RUNTIME_DIR) -I$(BOEHM_GC_DIR) \
-			$(EXTRA_MGNUCFLAGS) $(DLL_CFLAGS) $(EXTRA_CFLAGS)
+MGNUC	=	$(M_ENV) $(SCRIPTS_DIR)/mgnuc
+MGNUCFLAGS =	$(EXTRA_MGNUCFLAGS) $(DLL_CFLAGS) $(EXTRA_CFLAGS)
 LDFLAGS	=	-L$(BOEHM_GC_DIR) -L$(RUNTIME_DIR)
 LDLIBS	=	-l$(RT_LIB_NAME) \
 		` case "$(GRADE)" in 					\
Index: profiler/Mmakefile
===================================================================
RCS file: /home/mercury1/repository/mercury/profiler/Mmakefile,v
retrieving revision 1.9
diff -u -r1.9 Mmakefile
--- Mmakefile	1998/10/23 17:53:38	1.9
+++ Mmakefile	1999/04/06 17:30:58
@@ -19,14 +19,23 @@
 # Don't change these without good reason - if you want to
 # do a temporary change, change ../Mmake.params
 
-MCD	=	MERCURY_INT_DIR=. $(MC) --generate-dependencies
-MCI	=	MERCURY_INT_DIR=$(LIBRARY_DIR) $(MC) --make-interface
-MCG	=	MERCURY_C_INCL_DIR=$(RUNTIME_DIR) \
-		MERCURY_INT_DIR=$(LIBRARY_DIR) $(MC) --compile-to-c
-MCS	=	MERCURY_C_INCL_DIR=$(RUNTIME_DIR) \
-		MERCURY_INT_DIR=$(LIBRARY_DIR) $(MC) --split-c-files -c
-MGNUC	=	MERCURY_C_INCL_DIR=$(RUNTIME_DIR) $(SCRIPTS_DIR)/mgnuc
-MGNUCFLAGS =	$(EXTRA_MGNUCFLAGS) -I$(BOEHM_GC_DIR) $(EXTRA_CFLAGS)
+M_ENV	=	MERCURY_INT_DIR=$(LIBRARY_DIR)  \
+		MERCURY_ALL_C_INCL_DIRS="\
+			-I$(TRACE_DIR) \
+			-I$(RUNTIME_DIR) \
+			-I$(BOEHM_GC_DIR) \
+			-I$(BOEHM_GC_DIR)/include \
+		"
+MCD	=	$(M_ENV) $(MC) --generate-dependencies
+MCI	=	$(M_ENV) $(MC) --make-interface
+MCPI	=	$(M_ENV) $(MC) --make-private-interface
+MCSI	=	$(M_ENV) $(MC) --make-short-interface
+MCOI	=       $(M_ENV) $(MC) --make-optimization-interface
+MCTOI	=       $(M_ENV) $(MC) --make-transitive-optimization-interface
+MCG	=	$(M_ENV) $(MC) --compile-to-c
+MCS	=	$(M_ENV) $(MC) --split-c-files -c --cflags "$(ALL_CFLAGS)"
+MGNUC	=	$(M_ENV) $(SCRIPTS_DIR)/mgnuc
+MGNUCFLAGS =	$(EXTRA_MGNUCFLAGS) $(EXTRA_CFLAGS)
 C2INIT =        MERCURY_MOD_LIB_MODS="$(BROWSER_DIR)/$(BROWSER_LIB_NAME).init $(LIBRARY_DIR)/$(STD_LIB_NAME).init $(RUNTIME_DIR)/$(RT_LIB_NAME).init" \
                 MERCURY_MKINIT=$(UTIL_DIR)/mkinit $(SCRIPTS_DIR)/c2init
 ML	=	MERCURY_C_LIB_DIR=. $(SCRIPTS_DIR)/ml
Index: runtime/Mmakefile
===================================================================
RCS file: /home/mercury1/repository/mercury/runtime/Mmakefile,v
retrieving revision 1.44
diff -u -r1.44 Mmakefile
--- Mmakefile	1999/03/15 00:39:29	1.44
+++ Mmakefile	1999/04/06 15:23:29
@@ -13,9 +13,13 @@
 
 #-----------------------------------------------------------------------------#
 
-CFLAGS		= -I$(MERCURY_DIR)/runtime -I$(MERCURY_DIR)/boehm_gc -g \
-		  $(DLL_CFLAGS) $(EXTRA_CFLAGS)
-MGNUC		= MERCURY_C_INCL_DIR=. $(SCRIPTS_DIR)/mgnuc
+CFLAGS		= -g $(DLL_CFLAGS) $(EXTRA_CFLAGS)
+MGNUC		= MERCURY_ALL_C_INCL_DIRS=" \
+			-I$(RUNTIME_DIR) \
+			-I$(BOEHM_GC_DIR) \
+			-I$(BOEHM_GC_DIR)/include \
+			" \
+		  $(SCRIPTS_DIR)/mgnuc 
 MGNUCFLAGS	= --no-ansi $(EXTRA_MGNUCFLAGS) $(CFLAGS)
 MOD2C		= $(SCRIPTS_DIR)/mod2c
 
Index: trace/Mmakefile
===================================================================
RCS file: /home/mercury1/repository/mercury/trace/Mmakefile,v
retrieving revision 1.7
diff -u -r1.7 Mmakefile
--- Mmakefile	1999/03/30 05:45:52	1.7
+++ Mmakefile	1999/04/06 17:47:21
@@ -14,12 +14,16 @@
 
 #-----------------------------------------------------------------------------#
 
-CFLAGS		= -I$(MERCURY_DIR)/browser -I$(MERCURY_DIR)/library \
-		  -I$(MERCURY_DIR)/runtime -I$(MERCURY_DIR)/boehm_gc \
-		  -g $(DLL_CFLAGS)
-MGNUC		= MERCURY_C_INCL_DIR=. $(SCRIPTS_DIR)/mgnuc
+M_ENV		= MERCURY_ALL_C_INCL_DIRS="\
+			-I$(BROWSER_DIR) \
+			-I$(LIBRARY_DIR) \
+			-I$(RUNTIME_DIR) \
+			-I$(BOEHM_GC_DIR) \
+			-I$(BOEHM_GC_DIR)/include \
+		  "
+CFLAGS		= -g $(DLL_CFLAGS) $(EXTRA_CFLAGS)
+MGNUC		= $(M_ENV) $(SCRIPTS_DIR)/mgnuc
 MGNUCFLAGS	= --no-ansi
-MOD2C		= $(SCRIPTS_DIR)/mod2c
 
 #-----------------------------------------------------------------------------#
 

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