Files
mercury/Mmakefile
Zoltan Somogyi 9ec86d6a6d The objective of this diff is to switch from a table of solver events built
Estimated hours taken: 32
Branches: main

The objective of this diff is to switch from a table of solver events built
into the compiler (and eventually the debugger) into a table of events
defined by a file provided by the user to the compiler, which the compiler
then records in the executable for use by the debugger.

The current design, for speed of implementation, uses temporary files parsed
by a bison-generated parser. Since the compiler needs to be able to invoke
the parser even if it is compiled in a non-debug grade, the parser is in
a new library, the eventspec library, that is always linked into the Mercury
compiler and is always linked into any Mercury program with debugging enabled
(but is of course linked only once into a Mercury compiler which has debugging
enabled).

Modify the debugger to give it the ability to print the attributes of
user-defined events (for now, only the non-synthesized attributes).
Implement a new debugger command, "user", which goes to the next user-defined
event.

configure.in:
	Require flex and and bison to be available.

doc/user_guide.texi:
	Document user defined events and the new debugger capabilities.

doc/mdb_categories:
	Include "user" in the list of forward movement commands.

	Fix some earlier omissions in that list.

runtime/mercury_stack_layout.h:
	Include an event number in the user-defined event structure.

	Include a string representing an event set specification in module
	layout structures.

runtime/mercury_stack_layout.h:
runtime/mercury_trace_base.[ch]:
runtime/mercury_types.h
	Switch from solver events to user events in names.

runtime/mercury_trace_term.[ch]:
	Provide a representation of flat terms, for use in representing
	the calls that generate synthesized attributes.

	Ensure that exported field names have an MR_ prefix.

browser/cterm.m:
	Conform to the change to runtime/mercury_trace_term.h.

scripts/c2init.in:
scripts/ml.in:
	Include the eventspec library in programs compiled with debugging
	enabled.

compiler/Mmakefile:
	Include the eventspec library in the compiler.

compiler/options.m:
	Add a new option, --event-spec-file-name, that allows the user to
	specify the set of user-defined events the program may use.

compiler/handle_options.m:
	Set this optimization from an environment variable (which may be
	set by the mmc script) if the new option is not explicitly given.

compiler/prog_data.m:
	Define the data structures for the compiler's representation of the
	event set specification.

	Move some definitions around to group them more logically.

compiler/hlds_module.m:
	Include the event set specification as a new field in the module_info.

compiler/prog_event.m:
	Add the code for invoking the parser in the eventspec library,
	and for converting the simple term output by the parser to the
	compiler own representation, which contains more information
	(to wit, the types of the function attributes) and which has had
	a whole bunch of semantic checks done on it (e.g. whether synthesized
	attributes depend on themselves or on nonexistent attributes).

	Provide a function to generate a canonicalized version of the event
	specification file.

compiler/module_qual.m:
compiler/equiv_type.m:
	Process event spec specifications as well as items, to module qualify
	the names of the types of event arguments, and expanding out
	equivalence types.

	In equiv_type.m, rename some variables to make clear what kind of info
	they represent.

compiler/mercury_compile.m:
	Process the event set specification file if one has been selected:
	read it in, module qualify it, expand its equivalence types, and add
	to the module_info.

compiler/compile_target_code.m:
	Include the event_spec library when linking debuggable executables.

compiler/call_gen.m:
compiler/continuation_info.m:
compiler/trace_gen.m:
compiler/trace_params.m:
mdbcomp/prim_data.m:
mdbcomp/trace_counts.m:
runtime/mercury_goto.h:
	Generate user-defined events instead of solver events.

compiler/layout.m:
compiler/layout_out.m:
compiler/stack_layout.m:
	Include a canonicalized version of the event specification file
	in the module layout if the module has any user-defined events.

compiler/code_info.m:
compiler/llds_out.m:
compiler/modes.m:
compiler/modules.m:
compiler/opt_debug.m:
compiler/typecheck.m:
	Conform to the changes above.

compiler/passes_aux.m:
	Rename a predicate to avoid an ambiguity.

trace/Mmakefile:
	Add the definition and rules required to build the eventspec library.

trace/mercury_event_scanner.l:
trace/mercury_event_parser.y:
	A scanner and a parser for reading in event spec specifications.

trace/mercury_event_spec_missing.h:
	Provide the declarations that should be (but aren't) provided by
	flex and bison.

trace/mercury_event_spec.[ch]:
	The main module of the eventspec library. Provides functions to read
	in event set specifications from a file, and to write them out as a
	Mercury term in the form needed by the compiler.

trace/mercury_trace_tables.c:
	If the module layouts being registered include event set
	specifications, then check their consistency. Make the specification
	and the consistency indication available to other modules.

trace/mercury_trace_internal.c:
	During initialization, if the modules contain a consistent set of event
	set specifications, then read that specification into the debugger.
	(We don't yet make use of this information.)

	Add an extra mdb command, "user", which goes forward to the next
	user-defined event.

trace/mercury_trace.[ch]:
trace/mercury_trace_cmd_forward.[ch]:
	Implement the new mdb command.

trace/mercury_trace_vars.[ch]:
	For user-defined events, include the attributes' values among the
	values that can be printed or browsed.

trace/mercury_trace_cmd_browsing.c:
trace/mercury_trace_declarative.c:
	Minor changes.

scripts/scripts/prepare_tmp_dir_grade_part:
	Copy the .y and .l files to the tmp dir we use for installs.

tools/bootcheck:
	Copy the .y and .l files of the trace directory to stage 2.

tools/lmc.in:
	Include the eventspec library when linking debuggable executables.

tests/debugger/user_event.{m,inp,exp}:
tests/debugger/user_event_spec:
	New test case to test the new functionality.

tests/debugger/Mercury.options:
tests/debugger/Mmakefile:
	Enable the new test case.

tests/debugger/completion.exp:
	Expect the new "user" mdb command in the completion output.
2006-11-24 03:48:30 +00:00

771 lines
22 KiB
Plaintext

#-----------------------------------------------------------------------------#
# Copyright (C) 1995-2006 The University of Melbourne.
# This file may only be copied under the terms of the GNU General
# Public Licence - see the file COPYING in the Mercury distribution.
#-----------------------------------------------------------------------------#
# Mmakefile - the top-level Mmake file for the Mercury implementation
# We need to explicitly include scripts/Mmake.vars here, even though `mmake'
# includes that file automatically, to make sure that we get the right
# version of that file. The settings in that file include values set
# by parameters to configure (e.g. --prefix), and we need to make sure
# that we pick up the values from the Mmake.vars that we're going to install,
# rather than from the old version of mmake that we're installing with,
# which may have been configured with a different --prefix.
include scripts/Mmake.vars
MAIN_TARGET=all
MERCURY_DIR=.
include Mmake.common
#-----------------------------------------------------------------------------#
SUBDIRS = \
scripts \
util \
boehm_gc \
runtime \
robdd \
library \
trace \
mdbcomp \
browser \
analysis \
compiler \
doc \
slice \
profiler \
deep_profiler \
tools
MMAKEFLAGS =
SUBDIR_MMAKE = PATH=../scripts:../util:$$PATH \
MMAKE_VPATH=. \
MMAKE_DIR=../scripts \
../scripts/mmake $(MMAKEFLAGS)
SUBSUBDIR_MMAKE = PATH=../../scripts:../../util:$$PATH \
MMAKE_VPATH=. \
MMAKE_DIR=../../scripts \
../../scripts/mmake $(MMAKEFLAGS)
GENERATED_DOCS = README INSTALL WORK_IN_PROGRESS TODO
# If you change these, you will also need to change the files indicated
# in scripts/c2init.in.
RT_LIB_NAME = mer_rt
STD_LIB_NAME = mer_std
TRACE_LIB_NAME = mer_trace
EVENTSPEC_LIB_NAME = mer_eventspec
MDBCOMP_LIB_NAME = mer_mdbcomp
BROWSER_LIB_NAME = mer_browser
ANALYSIS_LIB_NAME = mer_analysis
#-----------------------------------------------------------------------------#
# `mmake dep' ensures that the .dep files exist;
# `mmake depend' forces them to be remade to ensure that they are up-to-date.
.PHONY: dep
dep: dep_library dep_mdbcomp dep_browser dep_analysis dep_compiler \
dep_slice dep_profiler dep_deep_profiler
.PHONY: dep_library
dep_library: library/$(deps_subdir)$(STD_LIB_NAME).dep
library/$(deps_subdir)$(STD_LIB_NAME).dep:
+cd library && $(SUBDIR_MMAKE) depend
.PHONY: dep_mdbcomp
dep_mdbcomp: \
mdbcomp/$(deps_subdir)$(MDBCOMP_LIB_NAME).dep
mdbcomp/$(deps_subdir)$(MDBCOMP_LIB_NAME).dep:
+cd mdbcomp && $(SUBDIR_MMAKE) $(MDBCOMP_LIB_NAME).depend
.PHONY: dep_browser
dep_browser: \
browser/$(deps_subdir)$(BROWSER_LIB_NAME).dep
.PHONY: dep_browser_all
dep_browser_all: \
browser/$(deps_subdir)$(BROWSER_LIB_NAME).dep \
browser/$(deps_subdir)browse_test.dep \
browser/$(deps_subdir)declarative_test.dep
browser/$(deps_subdir)$(BROWSER_LIB_NAME).dep:
+cd browser && $(SUBDIR_MMAKE) $(BROWSER_LIB_NAME).depend
browser/$(deps_subdir)browse_test.dep:
+cd browser && $(SUBDIR_MMAKE) browse_test.depend
browser/$(deps_subdir)declarative_test.dep:
+cd browser && $(SUBDIR_MMAKE) declarative_test.depend
.PHONY: dep_analysis
dep_analysis: analysis/$(deps_subdir)$(ANALYSIS_LIB_NAME).dep
analysis/$(deps_subdir)$(ANALYSIS_LIB_NAME).dep:
+cd analysis && $(SUBDIR_MMAKE) depend
.PHONY: dep_compiler
dep_compiler: compiler/$(deps_subdir)top_level.dep
compiler/$(deps_subdir)top_level.dep: library/$(deps_subdir)$(STD_LIB_NAME).dep
+cd compiler && $(SUBDIR_MMAKE) depend
.PHONY: dep_slice
dep_slice: slice/$(deps_subdir)mcov.dep \
slice/$(deps_subdir)mslice.dep \
slice/$(deps_subdir)mdice.dep \
slice/$(deps_subdir)mtc_union.dep \
slice/$(deps_subdir)mtc_diff.dep
slice/$(deps_subdir)mcov.dep \
slice/$(deps_subdir)mslice.dep \
slice/$(deps_subdir)mdice.dep \
slice/$(deps_subdir)mtc_union.dep \
slice/$(deps_subdir)mtc_diff.dep:
+cd slice && $(SUBDIR_MMAKE) depend
.PHONY: dep_profiler
dep_profiler: profiler/$(deps_subdir)mercury_profile.dep
profiler/$(deps_subdir)mercury_profile.dep: \
library/$(deps_subdir)$(STD_LIB_NAME).dep
+cd profiler && $(SUBDIR_MMAKE) depend
.PHONY: dep_deep_profiler
ifeq ("$(ENABLE_DEEP_PROFILER)","yes")
dep_deep_profiler: deep_profiler/$(deps_subdir)mdprof_cgi.dep \
deep_profiler/$(deps_subdir)mdprof_test.dep \
deep_profiler/$(deps_subdir)mdprof_dump.dep \
deep_profiler/$(deps_subdir)mdprof_feedback.dep
else
dep_deep_profiler:
endif
deep_profiler/$(deps_subdir)mdprof_cgi.dep: \
library/$(deps_subdir)$(STD_LIB_NAME).dep
+cd deep_profiler && $(SUBDIR_MMAKE) mdprof_cgi.depend
deep_profiler/$(deps_subdir)mdprof_test.dep: \
library/$(deps_subdir)$(STD_LIB_NAME).dep
+cd deep_profiler && $(SUBDIR_MMAKE) mdprof_test.depend
deep_profiler/$(deps_subdir)mdprof_dump.dep: \
library/$(deps_subdir)$(STD_LIB_NAME).dep
+cd deep_profiler && $(SUBDIR_MMAKE) mdprof_dump.depend
deep_profiler/$(deps_subdir)mdprof_feedback.dep: \
library/$(deps_subdir)$(STD_LIB_NAME).dep
+cd deep_profiler && $(SUBDIR_MMAKE) mdprof_feedback.depend
# depend_library MUST be done before depend_compiler and depend_profiler
.PHONY: depend
depend: depend_library depend_mdbcomp depend_browser \
depend_analysis depend_compiler \
depend_slice depend_profiler depend_deep_profiler
.PHONY: depend_library
depend_library:
+cd library && $(SUBDIR_MMAKE) depend
.PHONY: depend_mdbcomp
depend_mdbcomp:
+cd mdbcomp && $(SUBDIR_MMAKE) depend
.PHONY: depend_browser
depend_browser:
+cd browser && $(SUBDIR_MMAKE) depend
.PHONY: depend_analysis
depend_analysis:
+cd analysis && $(SUBDIR_MMAKE) depend
.PHONY: depend_compiler
depend_compiler:
+cd compiler && $(SUBDIR_MMAKE) depend
.PHONY: depend_slice
depend_slice:
+cd slice && $(SUBDIR_MMAKE) depend
.PHONY: depend_profiler
depend_profiler:
+cd profiler && $(SUBDIR_MMAKE) depend
.PHONY: depend_deep_profiler
depend_deep_profiler:
+cd deep_profiler && $(SUBDIR_MMAKE) depend
#-----------------------------------------------------------------------------#
.PHONY: all
all: $(GENERATED_DOCS) mercury-compiler.spec $(SUBDIRS)
.PHONY: util
util: scripts
+cd util && $(SUBDIR_MMAKE)
.PHONY: scripts
scripts:
+cd scripts && $(SUBDIR_MMAKE)
.PHONY: boehm_gc
boehm_gc: scripts
+gc_grade=`scripts/ml --grade $(GRADE) --print-gc-grade`; \
cd boehm_gc && $(SUBDIR_MMAKE) GC_GRADE=$$gc_grade
.PHONY: runtime
runtime: scripts boehm_gc
+cd runtime && $(SUBDIR_MMAKE)
.PHONY: robdd
robdd: scripts boehm_gc
cd robdd && $(SUBDIR_MMAKE)
.PHONY: library
library: dep_library scripts util boehm_gc runtime
+cd library && $(SUBDIR_MMAKE)
.PHONY: mdbcomp
mdbcomp: dep_mdbcomp scripts util boehm_gc runtime library
+cd mdbcomp && $(SUBDIR_MMAKE)
.PHONY: browser
browser: dep_browser scripts util boehm_gc runtime library mdbcomp
+cd browser && $(SUBDIR_MMAKE)
.PHONY: analysis
analysis: dep_analysis scripts util boehm_gc runtime library mdbcomp browser \
trace
+cd analysis && $(SUBDIR_MMAKE)
.PHONY: runtime
trace: scripts boehm_gc runtime library mdbcomp browser
+cd trace && $(SUBDIR_MMAKE)
.PHONY: compiler
compiler: dep_compiler scripts util boehm_gc runtime library \
mdbcomp browser trace analysis
+cd compiler && $(SUBDIR_MMAKE)
.PHONY: libmmc
libmmc: dep_compiler scripts util boehm_gc runtime library \
mdbcomp browser trace analysis
+cd compiler && $(SUBDIR_MMAKE) libmmc
.PHONY: doc
doc: scripts util
+cd doc && $(SUBDIR_MMAKE)
.PHONY: slice
slice: dep_slice scripts util boehm_gc runtime library \
mdbcomp browser trace
+cd slice && $(SUBDIR_MMAKE)
.PHONY: profiler
profiler: dep_profiler scripts util boehm_gc runtime library \
mdbcomp browser trace
+cd profiler && $(SUBDIR_MMAKE)
.PHONY: deep_profiler
deep_profiler: dep_deep_profiler scripts util boehm_gc runtime library \
mdbcomp browser trace
+cd deep_profiler && $(SUBDIR_MMAKE)
#-----------------------------------------------------------------------------#
.PHONY: tags
tags: tags_compiler tags_library tags_mdbcomp tags_browser tags_analysis \
tags_slice tags_profiler tags_deep_profiler
.PHONY: tags_compiler
tags_compiler:
+cd compiler && $(SUBDIR_MMAKE) tags
.PHONY: tags_library
tags_library:
+cd library && $(SUBDIR_MMAKE) tags
.PHONY: tags_mdbcomp
tags_mdbcomp:
+cd mdbcomp && $(SUBDIR_MMAKE) tags
.PHONY: tags_browser
tags_browser:
+cd browser && $(SUBDIR_MMAKE) tags
.PHONY: tags_analysis
tags_analysis:
+cd analysis && $(SUBDIR_MMAKE) tags
.PHONY: tags_slice
tags_slice:
+cd slice && $(SUBDIR_MMAKE) tags
.PHONY: tags_profiler
tags_profiler:
+cd profiler && $(SUBDIR_MMAKE) tags
.PHONY: tags_deep_profiler
tags_deep_profiler:
+cd deep_profiler && $(SUBDIR_MMAKE) tags
#-----------------------------------------------------------------------------#
# Remove from each of the listed directories mmc-generated files that don't
# belong there.
cleanint:
for dir in library mdbcomp browser analysis compiler \
slice profiler deep_profiler; \
do \
echo Looking for inappropriate files in the $$dir directory: ; \
( cd $$dir && ../tools/cleanint > .cleanint ) ; \
if test -s $$dir/.cleanint ; then \
cat $$dir/.cleanint ; \
else \
echo none found. ; \
fi \
done
#-----------------------------------------------------------------------------#
configure: configure.in aclocal.m4
autoconf
config.status: configure VERSION
if [ -f ./config.status ]; then \
./config.status --recheck; \
else \
echo "======> You need to run configure!"; \
exit 1; \
fi
Mmake.common: Mmake.common.in config.status
./config.status --file Mmake.common
README: .README.in VERSION
sed 's/@VERSION@/$(VERSION)/g' .README.in > README
INSTALL: .INSTALL.in VERSION
sed 's/@VERSION@/$(VERSION)/g' .INSTALL.in > INSTALL
ifeq ("$(LYNX)","")
HTML_TO_TEXT = cat
else
HTML_TO_TEXT = TERM=vt100 lynx -dump
endif
WORK_IN_PROGRESS: compiler/notes/work_in_progress.html
$(HTML_TO_TEXT) compiler/notes/work_in_progress.html > WORK_IN_PROGRESS
TODO: compiler/notes/todo.html
$(HTML_TO_TEXT) compiler/notes/todo.html > TODO
mercury-compiler.spec: .mercury-compiler.spec.in VERSION
version_with_underscores=`echo $(VERSION) | sed 's/-/_/g'`; \
beta_dir=`expr "$(VERSION)" : '\(.*beta\).*'`; \
maybe_beta=`case $(VERSION) in \
rotd*) echo "beta-releases/rotd/" ;; \
*beta*) echo "beta-releases/$$beta_dir/" ;; \
esac`; \
sed -e "s/@VERSION@/$(VERSION)/g" \
-e "s/@VERSION_WITH_UNDERSCORES@/$$version_with_underscores/g" \
-e "s^@MAYBE_BETA@^$$maybe_beta^g" \
.mercury-compiler.spec.in > mercury-compiler.spec
#-----------------------------------------------------------------------------#
# Generally you should do a `mmake realclean' before doing `mmake tar'.
.PHONY: tar
tar: $(GENERATED_DOCS)
touch Mmake.params
cd util && mmake
+cd runtime && $(SUBDIR_MMAKE) cs $(RT_LIB_NAME).init
+cd library && $(SUBDIR_MMAKE) depend
+cd library && $(SUBDIR_MMAKE) all-ints cs $(STD_LIB_NAME).init tags
+cd mdbcomp && $(SUBDIR_MMAKE) depend
+cd mdbcomp && $(SUBDIR_MMAKE) all-ints cs \
$(MDBCOMP_LIB_NAME).init tags
+cd browser && $(SUBDIR_MMAKE) depend
+cd browser && $(SUBDIR_MMAKE) all-ints cs \
$(BROWSER_LIB_NAME).init tags
+cd trace && $(SUBDIR_MMAKE) cs
+cd analysis && $(SUBDIR_MMAKE) depend
+cd analysis && $(SUBDIR_MMAKE) all-ints cs tags
+cd compiler && $(SUBDIR_MMAKE) depend
+cd compiler && $(SUBDIR_MMAKE) cs tags
+cd slice && $(SUBDIR_MMAKE) depend
+cd slice && $(SUBDIR_MMAKE) cs tags
+cd profiler && $(SUBDIR_MMAKE) depend
+cd profiler && $(SUBDIR_MMAKE) cs tags
+cd deep_profiler && $(SUBDIR_MMAKE) depend
+cd deep_profiler && $(SUBDIR_MMAKE) cs tags
+cd doc && $(SUBDIR_MMAKE) info html dvi mdb_doc
# the following commands might fail on Windows?
-cd bindist && $(SUBDIR_MMAKE) bindist.Makefile
-cd bindist && $(SUBDIR_MMAKE) bindist.INSTALL
+cd extras/dynamic_linking && $(SUBSUBDIR_MMAKE) sources
# clean up
cd scripts && mmake realclean
cd scripts && mmake canonical_grade
cd util && mmake realclean
cd doc && mmake distclean
-rm -f errs errs2 update.log
-rm -f config.status config.cache config.log configure.log a.out
-rm -f runtime/mercury_conf.h boehm_gc/mercury_boehm_gc_conf.h
-rm -f Mmake.common
-rm -f extras/Mmake.params
chmod -R a+r *
# Package up the mercury directory with some subdirectories
# excluded, into a gzipped tar archive that will unpack into
# mercury-compiler-$(VERSION).
# Put the extras directory into a gzipped tar archive that
# will unpack into mercury-extras-$(VERSION).
# Put the tests directory into a gzipped tar archive that
# will unpack into mercury-tests-$(VERSION).
DIRNAME="`pwd`"; \
ROOTNAME="`basename $$DIRNAME`"; \
export ROOTNAME; \
cd .. && ( \
mkdir stuff-to-exclude; \
mv $$ROOTNAME/trial stuff-to-exclude; \
mv $$ROOTNAME/bytecode stuff-to-exclude; \
mv $$ROOTNAME/lp_solve stuff-to-exclude; \
mv $$ROOTNAME/trax stuff-to-exclude; \
mv $$ROOTNAME/extras/opium_m stuff-to-exclude; \
mv $$ROOTNAME/extras/aditi stuff-to-exclude; \
mv $$ROOTNAME/extras mercury-extras-$(VERSION); \
mv $$ROOTNAME mercury-compiler-$(VERSION); \
mv tests mercury-tests-$(VERSION); \
tar -cf - mercury-compiler-$(VERSION) | \
gzip -9 > mercury-compiler-$(VERSION).tar.gz; \
tar -cf - mercury-extras-$(VERSION) | \
gzip -9 > mercury-extras-$(VERSION).tar.gz; \
tar -cf - mercury-tests-$(VERSION) | \
gzip -9 > mercury-tests-$(VERSION).tar.gz; \
mv mercury-compiler-$(VERSION) $$ROOTNAME; \
mv mercury-extras-$(VERSION) $$ROOTNAME/extras; \
mv mercury-tests-$(VERSION) tests; \
mv stuff-to-exclude/opium_m $$ROOTNAME/extras/opium_m;\
mv stuff-to-exclude/aditi $$ROOTNAME/extras/aditi;\
mv stuff-to-exclude/* $$ROOTNAME; \
rmdir stuff-to-exclude; \
)
.PHONY: version
version:
@echo $(VERSION)
.PHONY: fullarch
fullarch:
@echo $(FULLARCH)
.PHONY: echo_libgrades
echo_libgrades:
@echo $(LIBGRADES)
#-----------------------------------------------------------------------------#
# The code of the install rule is duplicated in bindist/bindist.Makefile.in.
.PHONY: install
install: install_main install_grades
@echo
@echo "-- Installation complete."
@echo
@echo "-- Don't forget to add $(INSTALL_BINDIR) to your PATH,"
@echo "-- $(INSTALL_MAN_DIR) to your MANPATH,"
@echo "-- and $(INSTALL_INFO_DIR) to your INFOPATH,"
@if test $(ENABLE_DEEP_PROFILER) != yes || \
cmp -s deep_profiler/mdprof_cgi \
$(INSTALL_CGI_DIR)/mdprof_cgi; \
then true ; else \
echo "-- to copy deep_profiler/mdprof_cgi" \
"to $(INSTALL_CGI_DIR),"; \
fi
@echo "-- and to add the following lines to the \`.emacs' file"
@echo "-- in your home directory:"
@echo " (setq load-path (cons (expand-file-name "
@echo " \"$(INSTALL_ELISP_DIR)\") load-path))"
@echo " (autoload 'mdb \"gud\" \"Invoke the Mercury debugger\" t)"
.PHONY: install_main
install_main: all \
install_scripts install_util install_runtime install_boehm_gc \
install_library install_mdbcomp install_browser install_trace \
install_compiler install_slice install_profiler \
install_deep_profiler install_doc install_config
.PHONY: install_scripts
install_scripts: scripts
+cd scripts && $(SUBDIR_MMAKE) install
.PHONY: install_util
install_util: util
+cd util && $(SUBDIR_MMAKE) install
.PHONY: install_config
install_config:
[ -d $(INSTALL_RECONF_DIR) ] || mkdir -p $(INSTALL_RECONF_DIR)
cp VERSION aclocal.m4 configure configure.in config.guess \
config.sub install-sh $(INSTALL_RECONF_DIR)
.PHONY: install_runtime
install_runtime: runtime
+cd runtime && $(SUBDIR_MMAKE) install
.PHONY: install_trace
install_trace: trace
+cd trace && $(SUBDIR_MMAKE) install
.PHONY: install_boehm_gc
install_boehm_gc: boehm_gc
+gc_grade=`scripts/ml --grade $(GRADE) --print-gc-grade`; \
cd boehm_gc && $(SUBDIR_MMAKE) install GC_GRADE=$$gc_grade
.PHONY: install_library
install_library: dep_library library
+cd library && $(SUBDIR_MMAKE) install
.PHONY: install_mdbcomp
install_mdbcomp: dep_mdbcomp mdbcomp
+cd mdbcomp && $(SUBDIR_MMAKE) install
.PHONY: install_browser
install_browser: dep_browser browser
+cd browser && $(SUBDIR_MMAKE) install
.PHONY: install_compiler
install_compiler: dep_compiler compiler
+cd compiler && $(SUBDIR_MMAKE) install
.PHONY: install_doc
install_doc: doc
+cd doc && $(SUBDIR_MMAKE) install
.PHONY: install_slice
install_slice: slice
+cd slice && $(SUBDIR_MMAKE) install
.PHONY: install_profiler
install_profiler: profiler
+cd profiler && $(SUBDIR_MMAKE) install
.PHONY: install_deep_profiler
install_deep_profiler: deep_profiler
+cd deep_profiler && $(SUBDIR_MMAKE) install
# LIBGRADE_SUFFIXES = .m .int3 .date3 .int2 .int .date .opt .optdate \
# .trans_opt .trans_opt_date .d .mh .mih .c_date .c .o .pic_o
.PHONY: install_grades
install_grades: all
#
# Use the newly installed compiler to build the libraries
# in various different grades. We need to override MC=mmc
# so that we use the mmc from the scripts directory, which
# runs the newly installed compiler, rather than using the
# bootstrap compiler.
#
/bin/rm -fr tmp_dir
scripts/prepare_tmp_dir_fixed_part
+for grade in x $(LIBGRADES); do \
if [ "$$grade" != "x" -a "$$grade" != "$(GRADE)" ]; then \
gc_grade=`scripts/ml --grade $$grade --print-gc-grade`; \
TWS=`/bin/pwd`/tmp_dir; \
scripts/prepare_tmp_dir_grade_part; \
( cd tmp_dir/boehm_gc && \
$(SUBDIR_MMAKE) MC=mmc GRADE=$$grade \
WORKSPACE=$$TWS GC_GRADE=$$gc_grade \
install_lib ) && \
( cd tmp_dir/runtime && \
$(SUBDIR_MMAKE) MC=mmc GRADE=$$grade WORKSPACE=$$TWS \
install_lib ) && \
( cd tmp_dir/library && \
$(SUBDIR_MMAKE) MC=mmc GRADE=$$grade WORKSPACE=$$TWS \
depend && \
$(SUBDIR_MMAKE) MC=mmc GRADE=$$grade WORKSPACE=$$TWS \
install_library ) && \
( cd tmp_dir/mdbcomp && \
$(SUBDIR_MMAKE) MC=mmc GRADE=$$grade WORKSPACE=$$TWS \
depend && \
$(SUBDIR_MMAKE) MC=mmc GRADE=$$grade WORKSPACE=$$TWS \
install_library ) && \
( cd tmp_dir/browser && \
$(SUBDIR_MMAKE) MC=mmc GRADE=$$grade WORKSPACE=$$TWS \
depend && \
$(SUBDIR_MMAKE) MC=mmc GRADE=$$grade WORKSPACE=$$TWS \
install_library ) && \
( cd tmp_dir/trace && \
$(SUBDIR_MMAKE) MC=mmc GRADE=$$grade WORKSPACE=$$TWS \
install_lib ) && \
true || \
{ echo "To clean up from failed install, remove tmp_dir"; \
exit 1; }; \
fi; \
done
if test ! -f .leave_tmp_dir; then rm -fr tmp_dir; fi
.PHONY: install_split_library
install_split_library: scripts dep_library
#
# Use the newly installed compiler to build the libraries
# in various different grades. We need to override MC=mmc
# so that we use the mmc from the scripts directory, which
# runs the newly installed compiler, rather than using the
# bootstrap compiler.
#
+cd library && \
rm -rf tmp_dir && \
mkdir tmp_dir && \
for ext in $(GRADE_SUBDIR_EXTS); do \
mv -f *.$$ext Mercury/$${ext}s/*.$$ext tmp_dir; \
done || true && \
{ mv -f $(deps_subdir)*.dep $(deps_subdir)*.dv *.$O Mercury/os/*.$O \
*.$A *.so tmp_dir || true; } && \
for grade in x $(LIBGRADES); do \
if [ "$$grade" != "x" ]; then \
$(SUBDIR_MMAKE) MC=mmc GRADE=$$grade depend && \
$(SUBDIR_MMAKE) MC=mmc GRADE=$$grade install_split_library || \
{ scripts/mercury_cleanup_install; exit 1; }; \
for ext in $(GRADE_SUBDIR_EXTS); do \
rm -f *.$$ext Mercury/$${ext}s/*.$$ext; \
done; \
rm -f *.$O Mercury/os/*.$O *.$A *.so; \
fi; \
done && \
{ for ext in $(GRADE_SUBDIR_EXTS); do \
[ -d Mercury/$${ext}s ] && mv tmp_dir/*.$$ext Mercury/$${ext}s; \
done; \
mv tmp_dir/*.dep tmp_dir/*.dv $(deps_subdir).; \
mv tmp_dir/* . ; rmdir tmp_dir; true; }
#-----------------------------------------------------------------------------#
#
# Various horrible hacks for gnu-win32 on Windows.
#
# `make touch_files' is a work-around for the broken gnu-win32 `tar'
# that loses all the file dates.
.PHONY: touch_files
touch_files:
-find . | xargs touch
sleep 1
touch library/*.date*
touch library/*.optdate
chmod +w library/*.dep
touch library/*.dep
touch mdbcomp/*.date*
touch mdbcomp/*.optdate
chmod +w mdbcomp/*.dep
touch mdbcomp/*.dep
touch browser/*.date*
touch browser/*.optdate
chmod +w browser/*.dep
touch browser/*.dep
touch analysis/*.date*
chmod +w analysis/*.dep
touch analysis/*.dep
touch compiler/*.date*
chmod +w compiler/*.dep
touch compiler/*.dep
touch slice/*.date*
chmod +w slice/*.dep
touch slice/*.date*
touch profiler/*.date*
chmod +w profiler/*.dep
touch profiler/*.dep
touch deep_profiler/*.date*
chmod +w deep_profiler/*.dep
touch deep_profiler/*.dep
touch doc/*.texi configure
sleep 1
touch boehm_gc/*.c
touch runtime/*.c
touch library/*.c
touch mdbcomp/*.c
touch browser/*.c
touch trace/*.c
touch compiler/*.c
touch slice/*.c
touch profiler/*.c
touch deep_profiler/*.c
touch doc/*.info doc/*.dvi doc/*.html config.status
#-----------------------------------------------------------------------------#
.PHONY: uninstall
uninstall:
+cd scripts; $(SUBDIR_MMAKE) uninstall
+cd deep_profiler; $(SUBDIR_MMAKE) uninstall
+cd util; $(SUBDIR_MMAKE) uninstall
+cd doc; $(SUBDIR_MMAKE) uninstall
-rm -r $(INSTALL_LIBDIR)
#-----------------------------------------------------------------------------#
.PHONY : bindist
bindist: WORK_IN_PROGRESS TODO
cd bindist; \
PATH="$(INSTALL_PREFIX)/bin:$$PATH" \
MMAKE_DIR="$(INSTALL_MMAKE_DIR)" \
mmake -v binary_distribution
#-----------------------------------------------------------------------------#
clean: clean_subdirs clean_tests
.PHONY: clean_subdirs
clean_subdirs:
rm -rf runtime/tmp_dir library/tmp_dir mdbcomp/tmp_dir \
browser/tmp_dir trace/tmp_dir
+for dir in $(SUBDIRS); do \
if [ "$$dir" = scripts ]; then continue; fi; \
(cd $$dir; $(SUBDIR_MMAKE) clean) \
done
.PHONY: clean_tests
clean_tests:
+if test -d tests; then \
(cd tests; $(MMAKE) clean) \
fi
realclean: realclean_subdirs realclean_local realclean_tests
.PHONY: realclean_local
realclean_local: realclean_config realclean_docs
.PHONY: realclean_subdirs
realclean_subdirs: clean_subdirs
rm -rf stage[1-3] stage[1-3].*
rm -rf tests/PASSED_TC_DIR tests/FAILED_TC_DIR
+for dir in $(SUBDIRS); do \
if [ "$$dir" = scripts ]; then continue; fi; \
(cd $$dir; $(SUBDIR_MMAKE) realclean) \
done
+cd scripts; $(SUBDIR_MMAKE) realclean
.PHONY: realclean_docs
realclean_docs:
rm -f $(GENERATED_DOCS)
.PHONY: realclean_config
realclean_config:
rm -f config.cache config.status config.log configure.log configure.help
.PHONY: realclean_tests
realclean_tests:
+if test -d tests; then \
(cd tests; $(MMAKE) realclean) \
fi
#-----------------------------------------------------------------------------#