[m-rev.] diff: ALWAYS_MMAKE_TAGS_FILE

Zoltan Somogyi zs at cs.mu.OZ.AU
Fri Jan 14 16:53:32 AEDT 2005


Allow users to ensure that tags files always exist in the relevant directories
by setting the environment variable ALWAYS_MMAKE_TAGS_FILE.

runtime/Mmakefile:
trace/Mmakefile:
library/Mmakefile:
browser/Mmakefile:
compiler/Mmakefile:
profiler/Mmakefile:
deep_profiler/Mmakefile:
	If TAGS_FILE_EXISTS is set to tags_file_exists, then make the default
	action ensure the existence of the tags file. It would be too
	expensive to remake the tags file every time mmake is run, but
	just testing for its existence is cheap enough.

	Fix the formatting of some rules.

Mmake.common.in:
	Set TAGS_FILE_EXISTS to tags_file_exists if the environment variable
	ALWAYS_MMAKE_TAGS_FILE is set.

	Fix some documentation.

Zoltan.

Index: Mmake.common.in
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/Mmake.common.in,v
retrieving revision 1.79
diff -u -r1.79 Mmake.common.in
--- Mmake.common.in	19 Oct 2004 06:01:34 -0000	1.79
+++ Mmake.common.in	13 Jan 2005 11:46:57 -0000
@@ -135,7 +135,7 @@
 # Note that the definition below does _not_ include GRADEFLAGS.
 # So any changes to the grade flags for the standard library or 
 # compiler itself should be done by setting GRADE, not GRADEFLAGS.
-GRADESTRING		= $(shell $(SCRIPTS_DIR)/canonical_grade $(ALL_GRADEFLAGS))
+GRADESTRING = $(shell $(SCRIPTS_DIR)/canonical_grade $(ALL_GRADEFLAGS))
 
 # Options to pass to the Mercury compiler
 MCFLAGS	+= --no-infer-all --halt-at-warn --no-warn-inferred-erroneous
@@ -146,6 +146,8 @@
 # the library's .opt and .trans_opt files as well. However, during development
 # some problems are easier to track down without intermodule optimization
 # complicating things.
+# Some test cases assume that the library is compiled intermodule optimization,
+# so it is not a good idea to disable it in a bootcheck.
 LIBRARY_INTERMODULE = yes
 
 # Do we want to compile the library with --trace minimum?
@@ -189,8 +191,14 @@
 INCLUDE_ADITI_OUTPUT = @ENABLE_ADITI_BACK_END@
 
 # Enable building of the deep profiler?
-# This value of ENABLE_DEEP_PROFILER is either yes or no.
+# The value of ENABLE_DEEP_PROFILER is either yes or no.
 ENABLE_DEEP_PROFILER=@ENABLE_DEEP_PROFILER@
+
+ifdef ALWAYS_MMAKE_TAGS_FILE
+TAGS_FILE_EXISTS = tags_file_exists
+else
+TAGS_FILE_EXISTS =
+endif
 
 #-----------------------------------------------------------------------------#
 
Index: analysis/Mmakefile
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/analysis/Mmakefile,v
retrieving revision 1.2
diff -u -r1.2 Mmakefile
--- analysis/Mmakefile	19 Feb 2003 06:31:22 -0000	1.2
+++ analysis/Mmakefile	13 Jan 2005 11:53:55 -0000
@@ -14,7 +14,7 @@
 # can be found by `mmc --make'.
 include Mercury.options
 
-MAIN_TARGET=library
+MAIN_TARGET=all
 MERCURY_MAIN_MODULES=$(ANALYSIS_LIB_NAME)
 
 #-----------------------------------------------------------------------------#
@@ -52,31 +52,36 @@
 # targets
 
 .PHONY: all
-all : library
+all:	library $(TAGS_FILE_EXISTS)
 
 DEPENDS = $(ANALYSIS_LIB_NAME).depend
 .PHONY: depend
-depend		: $(DEPENDS)
+depend:	$(DEPENDS)
 
 .PHONY: check
-check		: $(ANALYSIS_LIB_NAME).check
+check:	$(ANALYSIS_LIB_NAME).check
 
 .PHONY: all-ints 
 all-ints: ints int3s
 
 .PHONY: ints 
-ints		: $(ANALYSIS_LIB_NAME).ints
+ints:	$(ANALYSIS_LIB_NAME).ints
 
 .PHONY: int3s 
-int3s		: $(ANALYSIS_LIB_NAME).int3s
+int3s:	$(ANALYSIS_LIB_NAME).int3s
 
 #-----------------------------------------------------------------------------#
 
-tags		: $(MTAGS) $($(ANALYSIS_LIB_NAME).ms)
+tags:	$(MTAGS) $($(ANALYSIS_LIB_NAME).ms)
 	$(MTAGS) $($(ANALYSIS_LIB_NAME).ms) ../library/*.m
 
-$(ANALYSIS_LIB_NAME).stats : $(COMPILER_DIR)/source_stats.awk \
-				$($(ANALYSIS_LIB_NAME).ms)
+.PHONY: tags_file_exists
+tags_file_exists:
+	@if test ! -f tags; then echo making tags; \
+	$(MTAGS) $($(ANALYSIS_LIB_NAME).ms) ../library/*.m ; fi
+
+$(ANALYSIS_LIB_NAME).stats: $(COMPILER_DIR)/source_stats.awk \
+		$($(ANALYSIS_LIB_NAME).ms)
 	awk -f $(COMPILER_DIR)/source_stats.awk \
 		`vpath_find $($(ANALYSIS_LIB_NAME).ms)` > $@
 	
Index: browser/Mmakefile
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/browser/Mmakefile,v
retrieving revision 1.42
diff -u -r1.42 Mmakefile
--- browser/Mmakefile	1 Nov 2004 04:46:19 -0000	1.42
+++ browser/Mmakefile	13 Jan 2005 11:54:20 -0000
@@ -33,7 +33,7 @@
 # can be found by `mmc --make'.
 include Mercury.options
 
-MAIN_TARGET=library
+MAIN_TARGET=main
 
 MERCURY_MAIN_LIB_MODULES=$(BROWSER_LIB_NAME) $(MDBCOMP_LIB_NAME)
 MERCURY_MAIN_MODULES=$(MERCURY_MAIN_LIB_MODULES) browse_test declarative_test
@@ -118,11 +118,14 @@
 
 # targets
 
-.PHONY: library
-library: $(LIBS)
+.PHONY: main
+main:	library $(TAGS_FILE_EXISTS)
 
 .PHONY: all
-all: library browse_test declarative_test
+all:	library $(TAGS_FILE_EXISTS) browse_test declarative_test
+
+.PHONY: library
+library: $(LIBS)
 
 .PHONY: depend
 depend:	$(DEPENDS)
@@ -202,6 +205,12 @@
 tags:	$(MTAGS) $($(BROWSER_LIB_NAME).ms) $($(MDBCOMP_LIB_NAME).ms)
 	$(MTAGS) $($(BROWSER_LIB_NAME).ms) $($(MDBCOMP_LIB_NAME).ms) \
 		../library/*.m
+
+.PHONY: tags_file_exists
+tags_file_exists:
+	@if test ! -f tags; then echo making tags; \
+	$(MTAGS) $($(BROWSER_LIB_NAME).ms) $($(MDBCOMP_LIB_NAME).ms) \
+		../library/*.m ; fi
 
 $(BROWSER_LIB_NAME).stats: $(COMPILER_DIR)/source_stats.awk \
 		$($(BROWSER_LIB_NAME).ms)
Index: compiler/Mmakefile
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/Mmakefile,v
retrieving revision 1.78
diff -u -r1.78 Mmakefile
--- compiler/Mmakefile	10 Dec 2003 07:04:22 -0000	1.78
+++ compiler/Mmakefile	13 Jan 2005 11:54:33 -0000
@@ -18,7 +18,7 @@
 export GCC_SRC_DIR
 include Mercury.options
 
-MAIN_TARGET=mercury
+MAIN_TARGET=all
 
 MERCURY_MAIN_MODULES = top_level mlds_to_gcc
 
@@ -170,7 +170,7 @@
 	$(MC) $(ALL_MCFLAGS) -f *.m
 
 .PHONY: all
-all:		mercury
+all:		mercury $(TAGS_FILE_EXISTS)
 
 .PHONY: mercury
 mercury:	mercury_compile
@@ -263,24 +263,29 @@
 #-----------------------------------------------------------------------------#
 
 .PHONY: check
-check		: $(MC_PROG).check
+check:	$(MC_PROG).check
 
 .PHONY: ints 
-ints		: $(MC_PROG).ints
+ints:	$(MC_PROG).ints
 
 #-----------------------------------------------------------------------------#
 
-tags		: $(PREPROCESSED_M_FILES) *.m $(LIBRARY_DIR)/*.m
+tags:	$(PREPROCESSED_M_FILES) *.m $(LIBRARY_DIR)/*.m
 	$(MTAGS) $(MTAGSFLAGS) *.m $(LIBRARY_DIR)/*.m
 
-$(MC_PROG).stats : source_stats.awk $($(MC_PROG).ms)
+.PHONY: tags_file_exists
+tags_file_exists:
+	@if test ! -f tags; then echo making tags ; \
+	$(MTAGS) $(MTAGSFLAGS) *.m $(LIBRARY_DIR)/*.m ; fi
+
+$(MC_PROG).stats: source_stats.awk $($(MC_PROG).ms)
 	awk -f `vpath_find source_stats.awk` \
 		`vpath_find $($(MC_PROG).ms)` > $@
 
 #-----------------------------------------------------------------------------#
 
 .PHONY: dates
-dates		:
+dates:
 	touch $($(MC_PROG).dates)
 
 #-----------------------------------------------------------------------------#
Index: deep_profiler/Mmakefile
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/deep_profiler/Mmakefile,v
retrieving revision 1.12
diff -u -r1.12 Mmakefile
--- deep_profiler/Mmakefile	15 Dec 2004 05:49:11 -0000	1.12
+++ deep_profiler/Mmakefile	13 Jan 2005 11:54:58 -0000
@@ -49,7 +49,7 @@
 depend:	$(DEPEND)
 
 .PHONY: all
-all:	mdprof_cgi mdprof_test
+all:	mdprof_cgi mdprof_test $(TAGS_FILE_EXISTS)
 
 #-----------------------------------------------------------------------------#
 
@@ -84,11 +84,17 @@
 # and believes it to be the tags file we are asking for.
 
 .PHONY: tags
-tags:		.deep.tags
+tags:	.deep.tags
 
-.deep.tags:	$(MTAGS) $(mdprof_cgi.ms) $(mdprof_test.ms) $(LIBRARY_DIR)/*.m
-		$(MTAGS) $(mdprof_cgi.ms) $(mdprof_test.ms) $(LIBRARY_DIR)/*.m
-		touch .deep.tags
+.deep.tags: $(MTAGS) $(mdprof_cgi.ms) $(mdprof_test.ms) $(LIBRARY_DIR)/*.m
+	$(MTAGS) $(mdprof_cgi.ms) $(mdprof_test.ms) $(LIBRARY_DIR)/*.m
+	touch .deep.tags
+
+.PHONY: tags_file_exists
+tags_file_exists:
+	@if test ! -f tags; then echo making tags; \
+	$(MTAGS) $(mdprof_cgi.ms) $(mdprof_test.ms) $(LIBRARY_DIR)/*.m; \
+	touch .deep.tags; fi
 
 #-----------------------------------------------------------------------------#
 
Index: library/Mmakefile
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/library/Mmakefile,v
retrieving revision 1.137
diff -u -r1.137 Mmakefile
--- library/Mmakefile	15 Dec 2004 06:57:40 -0000	1.137
+++ library/Mmakefile	13 Jan 2005 11:39:46 -0000
@@ -34,7 +34,7 @@
 
 MERCURY_MAIN_MODULES = mer_std
 
-MAIN_TARGET=mercury
+MAIN_TARGET=all
 
 VPATH=.
 
@@ -152,18 +152,18 @@
 # targets
 
 .PHONY: all
-all : mercury
+all:	mercury $(TAGS_FILE_EXISTS)
 
 .PHONY: mercury
-mercury : lib_std
+mercury: lib_std
 
 #-----------------------------------------------------------------------------#
 
 .PHONY: depend
-depend		: $(STD_LIB_NAME).depend
+depend:	$(STD_LIB_NAME).depend
 
 .PHONY: check
-check		: $(STD_LIB_NAME).check
+check:	$(STD_LIB_NAME).check
 
 .PHONY: all-ints 
 
@@ -178,31 +178,36 @@
 endif
 
 .PHONY: ints 
-ints		: $(STD_LIB_NAME).ints
+ints:	$(STD_LIB_NAME).ints
 
 .PHONY: int3s 
-int3s		: $(STD_LIB_NAME).int3s
+int3s:	$(STD_LIB_NAME).int3s
 
 .PHONY: opts 
-opts		: $(STD_LIB_NAME).opts
+opts:	$(STD_LIB_NAME).opts
 
 .PHONY: trans_opts 
-trans_opts		: $(STD_LIB_NAME).trans_opts
-$(STD_LIB_NAME).trans_opts	: $($(STD_LIB_NAME).trans_opts)
+trans_opts: $(STD_LIB_NAME).trans_opts
+$(STD_LIB_NAME).trans_opts: $($(STD_LIB_NAME).trans_opts)
 
 #-----------------------------------------------------------------------------#
 
-tags		: $(MTAGS) $($(STD_LIB_NAME).ms)
+tags:	$(MTAGS) $($(STD_LIB_NAME).ms)
 	$(MTAGS) $($(STD_LIB_NAME).ms)
 
-$(STD_LIB_NAME).stats : $(COMPILER_DIR)/source_stats.awk $($(STD_LIB_NAME).ms)
+.PHONY: tags_file_exists
+tags_file_exists:
+	@if test ! -f tags; then echo making tags ; \
+	$(MTAGS) $($(STD_LIB_NAME).ms) ; fi
+
+$(STD_LIB_NAME).stats: $(COMPILER_DIR)/source_stats.awk $($(STD_LIB_NAME).ms)
 	awk -f $(COMPILER_DIR)/source_stats.awk \
 		`vpath_find $($(STD_LIB_NAME).ms)` > $@
 	
 #-----------------------------------------------------------------------------#
 
 .PHONY: dates
-dates		:
+dates:
 	touch $($(STD_LIB_NAME).dates)
 
 #-----------------------------------------------------------------------------#
Index: profiler/Mmakefile
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/profiler/Mmakefile,v
retrieving revision 1.25
diff -u -r1.25 Mmakefile
--- profiler/Mmakefile	9 Dec 2003 14:57:57 -0000	1.25
+++ profiler/Mmakefile	13 Jan 2005 11:55:47 -0000
@@ -14,7 +14,7 @@
 # can be found by `mmc --make'.
 include Mercury.options
 
-MAIN_TARGET=mercury_profile
+MAIN_TARGET=all
 MERCURY_MAIN_MODULES=mercury_profile
 
 #-----------------------------------------------------------------------------#
@@ -25,10 +25,10 @@
 #-----------------------------------------------------------------------------#
 
 .PHONY: depend
-depend : mercury_profile.depend
+depend:	mercury_profile.depend
 
 .PHONY: all
-all : mercury_profile
+all:	mercury_profile $(TAGS_FILE_EXISTS)
 
 #-----------------------------------------------------------------------------#
 
@@ -47,20 +47,25 @@
 #-----------------------------------------------------------------------------#
 
 .PHONY: check
-check		: mercury_profile.check
+check:	mercury_profile.check
 
 .PHONY: ints 
-ints		: mercury_profile.ints
+ints:	mercury_profile.ints
 
 #-----------------------------------------------------------------------------#
 
-tags		: $(MTAGS) $(mercury_profile.ms) $(LIBRARY_DIR)/*.m
+tags:	$(MTAGS) $(mercury_profile.ms) $(LIBRARY_DIR)/*.m
 	$(MTAGS) $(mercury_profile.ms) $(LIBRARY_DIR)/*.m
 
+.PHONY: tags_file_exists
+tags_file_exists:
+	@if test ! -f tags; then echo making tags; \
+	$(MTAGS) $(mercury_profile.ms) $(LIBRARY_DIR)/*.m ; fi
+
 #-----------------------------------------------------------------------------#
 
 .PHONY: dates
-dates		:
+dates:
 	touch $(mercury_profile.dates)
 
 #-----------------------------------------------------------------------------#
Index: runtime/Mmakefile
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/runtime/Mmakefile,v
retrieving revision 1.115
diff -u -r1.115 Mmakefile
--- runtime/Mmakefile	20 Oct 2004 09:45:09 -0000	1.115
+++ runtime/Mmakefile	13 Jan 2005 13:17:19 -0000
@@ -6,7 +6,7 @@
 
 # This is the Mmakefile for the Mercury runtime library
 
-MAIN_TARGET=runtime
+MAIN_TARGET=all
 
 #-----------------------------------------------------------------------------#
 
@@ -278,6 +278,9 @@
 
 #-----------------------------------------------------------------------------#
 
+.PHONY: all
+all:	runtime $(TAGS_FILE_EXISTS)
+
 ifeq ($(findstring java,$(GRADE)),java)        
 #
 # For grade java, there's nothing to do
@@ -358,6 +361,11 @@
 
 tags: $(CFILES) $(HDRS) $(BODY_HDRS) $(LIB_DLL_H)
 	ctags $(CFILES) $(HDRS) $(BODY_HDRS) $(LIB_DLL_H)
+
+.PHONY: tags_file_exists
+tags_file_exists:
+	@if test ! -f tags; then echo making tags; \
+	ctags $(CFILES) $(HDRS) $(BODY_HDRS) $(LIB_DLL_H); fi
 
 #-----------------------------------------------------------------------------#
 
cvs diff: cannot open CVS/Entries for reading: No such file or directory
cvs diff: I know nothing about stage2/Mmakefile
Index: trace/Mmakefile
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/trace/Mmakefile,v
retrieving revision 1.40
diff -u -r1.40 Mmakefile
--- trace/Mmakefile	19 Oct 2004 06:01:38 -0000	1.40
+++ trace/Mmakefile	13 Jan 2005 11:56:49 -0000
@@ -64,7 +64,7 @@
 		    *.par*) echo "-lpthread" ;;				\
 		  esac							\
 		`
-MAIN_TARGET=trace
+MAIN_TARGET=all
 
 # Specify which files to check for namespace cleanliness, and which name
 # prefixes are allowed.
@@ -125,13 +125,22 @@
 
 #-----------------------------------------------------------------------------#
 
+.PHONY: all
 .PHONY: trace
 ifneq ("$(filter il% java%,$(GRADE))","")        
 # there is no tracing in the .NET and Java backends
+
+all:
+
 trace:
+
 else
-trace: lib$(TRACE_LIB_NAME).$A lib$(TRACE_LIB_NAME).$(EXT_FOR_SHARED_LIB)
-trace: $(LIB_DLL_H) $(LIB_GLOBALS_H)
+
+all:	trace $(TAGS_FILE_EXISTS)
+
+trace:	lib$(TRACE_LIB_NAME).$A lib$(TRACE_LIB_NAME).$(EXT_FOR_SHARED_LIB)
+trace:	$(LIB_DLL_H) $(LIB_GLOBALS_H)
+
 endif
 
 lib$(TRACE_LIB_NAME)$(DLL_DEF_LIB).$A: $(OBJS)
@@ -159,10 +168,15 @@
 		$(SHARED_LIBS)
 
 .PHONY: cs
-cs: $(CFILES)
+cs:	$(CFILES)
 
-tags: $(CFILES) $(HDRS)
+tags:	$(CFILES) $(HDRS)
 	ctags $(CFILES) $(HDRS) $(RUNTIME_DIR)/*.c $(RUNTIME_DIR)/*.h
+
+.PHONY: tags_file_exists
+tags_file_exists:
+	@if test ! -f tags; then echo making tags; \
+	ctags $(CFILES) $(HDRS) $(RUNTIME_DIR)/*.c $(RUNTIME_DIR)/*.h ; fi
 
 #-----------------------------------------------------------------------------#
 
Index: util/Mmakefile
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/util/Mmakefile,v
retrieving revision 1.16
diff -u -r1.16 Mmakefile
--- util/Mmakefile	24 Jun 2004 11:25:50 -0000	1.16
+++ util/Mmakefile	13 Jan 2005 11:56:56 -0000
@@ -36,13 +36,18 @@
 
 #-----------------------------------------------------------------------------#
 
-all:	$(PROGS)
+all:	$(PROGS) $(TAGS_FILE_EXISTS)
 
 .c:
 	$(MGNUC) $(GRADEFLAGS) $(ALL_MGNUCFLAGS) -o $@ $< $(GETOPT_SRC)
 
 tags:
 	ctags $(SRC)
+
+.PHONY: tags_file_exists
+tags_file_exists:
+	@if test ! -f tags; then echo making tags; \
+	ctags $(SRC) ; fi
 
 #-----------------------------------------------------------------------------#
 

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