mirror of
https://github.com/Mercury-Language/mercury.git
synced 2026-04-15 09:23:44 +00:00
The main objective of this change is to get bootchecks in the csharp
and java grades to actually build the slice, profiler, deep_profiler
and mfilterjavac directories, which (due to the bug this diff fixes)
they weren't doing before.
However, since one side effect of this change is to eliminate
one source of annoying warnings from mmake about references to undefined
variables, a subsidiary objective is to eliminate other sources of such
warnings as well, which mostly come from the rules for making tags files.
browser/Mmakefile:
deep_profiler/Mmakefile:
library/Mmakefile:
mdbcomp/Mmakefile:
profiler/Mmakefile:
slice/Mmakefile:
ssdb/Mmakefile:
When creating stage 3, the bootcheck builds, in each directory,
only the files that it wants to compare against their stage 2 versions.
This means that it wants to build all the .c, .cs or .java files,
which it does via the cs, css and javas mmake targets.
The correct definitions of the rules of these targets depends on
whether mmc --make is being used or not, so we need at least two
sets of definitions: one for mmc --make, and for no mmc --make,
and conditionally selecting the appropriate one. The latter definition
has the problem that it refers to mmake variables that are intended
to be defined in .dv files created by mmc --generate-dependencies,
but until that has been run, those mmake variables are undefined.
Until now, the only directories that had both the mmc --make
and the no mmc --make definitions were the ones needed to build
the compiler. Bootchecks in the csharp and java grades, which
always use --make make, got errors when they tried to build
the directories that bootcheck builds after the compiler:
the slice, profiler, deep_prof and mfilterjavac directories.
This diff ensures that all directories we build in bootcheck
get all both versions of the os, cs, css, and javas targets.
In fact, they get two subversions of the no mmc --make version:
one for use in the presence of .dv files, and one for use in their
absence. The latter just builds the .dv files and invokes mmake
again. This avoids one source of warnings about undefined mmake
variables.
To avoid another source, make the rules for tags files and their
proxies depends on *.m instead of mmake variables such as $(mcov.ms),
since this makes sense even before making dependencies. The only price
is that any untracked Mercury source files in the directory have to
either be given some other suffix, or moved somewhere else.
Where relevant, make the mtags invocation prefer the master versions
of files that are copied from the mdbcomp directory to other directories,
since this is the only writeable version.
Make the os and cs rules consistently NOT build the _init.[co] files.
The way we use those files in bootcheck, we never need them;
when we need them, the right target to give is the executable anyway.
In the slice directory, don't put mcov between mtc_union and mtc_diff.
Eliminate unnecessary duplication, e.g. of sources in rules.
Eliminate double negatives in conditionals.
Fix formatting.
Mmake.common.in:
bindist/Mmakefile:
bytecode/Mmakefile:
compiler/Mmakefile:
doc/Mmakefile:
grade_lib/Mmakefile:
robdd/Mmakefile:
samples/Mmakefile:
scripts/Mmakefile:
tools/Mmakefile:
trace/Mmakefile:
util/Mmakefile:
Add "ft=make" to vim modelines. This is redundant for the files whose
names is Mmakefile, but it is needed for Mmake.common.
209 lines
6.1 KiB
Makefile
209 lines
6.1 KiB
Makefile
#-----------------------------------------------------------------------------#
|
|
# vim: ts=8 sw=8 noexpandtab ft=make
|
|
#-----------------------------------------------------------------------------#
|
|
# Copyright (C) 1996-2009, 2011 The University of Melbourne.
|
|
# This file may only be copied under the terms of the GNU General
|
|
# Public License - see the file COPYING in the Mercury distribution.
|
|
#-----------------------------------------------------------------------------#
|
|
|
|
# Mmake - Mmake file for the Mercury scripts
|
|
|
|
MAIN_TARGET=all
|
|
|
|
MERCURY_DIR=..
|
|
include $(MERCURY_DIR)/Mmake.common
|
|
|
|
#-----------------------------------------------------------------------------#
|
|
|
|
NONCONF_SCRIPTS = \
|
|
mprof_merge_runs \
|
|
mtc \
|
|
vpath_find
|
|
|
|
CONF_SCRIPTS = \
|
|
c2init \
|
|
canonical_grade \
|
|
mdb \
|
|
mdb.bat \
|
|
mdprof \
|
|
mercury.bat \
|
|
mercury_config \
|
|
mercury_update_interface \
|
|
mgnuc \
|
|
mkfifo_using_mknod \
|
|
ml \
|
|
mmake \
|
|
mmc \
|
|
mprof \
|
|
mprof.bat \
|
|
mtags \
|
|
prepare_install_dir
|
|
|
|
SCRIPTS = $(NONCONF_SCRIPTS) $(CONF_SCRIPTS)
|
|
|
|
CONF_FILES = \
|
|
Mercury.config.bootstrap \
|
|
Mercury.config \
|
|
Mmake.vars \
|
|
parse_ml_options.sh-subr
|
|
|
|
CONF_DEBUG_SCRIPTS = \
|
|
mdbrc
|
|
|
|
DEBUGGER_SCRIPTS = $(CONF_DEBUG_SCRIPTS) \
|
|
xul_tree.xsl \
|
|
mdb_open \
|
|
mdb_grep \
|
|
mdb_track \
|
|
mdb_term_browser.js \
|
|
mdb_term_browser.css \
|
|
jquery.slim.js \
|
|
jstree.js \
|
|
jstree.style.css \
|
|
32px.png \
|
|
40px.png \
|
|
throbber.gif
|
|
|
|
EMACS_SCRIPTS = gud.el
|
|
|
|
JAVA_WRAPPER_SCRIPTS = \
|
|
mercury_compile \
|
|
mfilterjavac
|
|
|
|
CSHARP_WRAPPER_SCRIPTS = \
|
|
mercury_compile
|
|
|
|
#-----------------------------------------------------------------------------#
|
|
|
|
# .SUFFIXES: .in
|
|
|
|
# we test membership of CONF_SCRIPTS and CONF_FILES, because testing $(@D)
|
|
# (the directory part of $*) does the wrong thing for Mercury.config.
|
|
# Not testing anything would make this rule apply even to ../Mmake.common.
|
|
# The grep is there to ensure that there were no mispelt autoconf variable
|
|
# names.
|
|
|
|
%:: %.in $(MERCURY_DIR)/config.status
|
|
@for file in $(CONF_SCRIPTS) ; do \
|
|
if test "$*" = "$$file" ; then \
|
|
$(MERCURY_DIR)/config.status --file=$* ; \
|
|
if grep -n '[^$$]@' $@ > /dev/null; \
|
|
then false; \
|
|
else true; \
|
|
fi ; \
|
|
chmod a+x $* ; \
|
|
fi \
|
|
done
|
|
@for file in $(CONF_FILES) $(CONF_DEBUG_SCRIPTS) ; do \
|
|
if test "$*" = "$$file" ; then \
|
|
$(MERCURY_DIR)/config.status --file=$* ; \
|
|
if grep -n '[^$$]@' $@ > /dev/null; \
|
|
then false; \
|
|
else true; \
|
|
fi \
|
|
fi \
|
|
done
|
|
|
|
#-----------------------------------------------------------------------------#
|
|
|
|
.PHONY: all
|
|
all: $(CONF_FILES) $(SCRIPTS) $(DEBUGGER_SCRIPTS) $(EMACS_SCRIPTS)
|
|
|
|
#-----------------------------------------------------------------------------#
|
|
|
|
parse_ml_options.sh-subr mgnuc canonical_grade: init_grade_options.sh-subr
|
|
parse_ml_options.sh-subr mgnuc canonical_grade: parse_grade_options.sh-subr
|
|
parse_ml_options.sh-subr mgnuc canonical_grade: final_grade_options.sh-subr
|
|
ml c2init: parse_ml_options.sh-subr
|
|
ml c2init canonical_grade: canonical_grade.sh-subr
|
|
mercury_config: ../configure.help
|
|
|
|
#-----------------------------------------------------------------------------#
|
|
|
|
.PHONY: install
|
|
install: install_mmake install_scripts install_config \
|
|
install_debugger_scripts install_emacs_scripts
|
|
|
|
.PHONY: install_dirs
|
|
install_dirs:
|
|
[ -d $(INSTALL_BINDIR) ] || mkdir -p $(INSTALL_BINDIR)
|
|
[ -d $(INSTALL_LIBDIR)/mmake ] || mkdir -p $(INSTALL_LIBDIR)/mmake
|
|
[ -d $(INSTALL_LIBDIR)/mdb ] || mkdir -p $(INSTALL_LIBDIR)/mdb
|
|
[ -d $(INSTALL_CONF_DIR) ] || mkdir -p $(INSTALL_CONF_DIR)
|
|
[ -d $(INSTALL_ELISP_DIR) ] || mkdir -p $(INSTALL_ELISP_DIR)
|
|
[ -d $(INSTALL_RECONF_DIR)/scripts ] || \
|
|
mkdir -p $(INSTALL_RECONF_DIR)/scripts
|
|
|
|
.PHONY: install_mmake
|
|
install_mmake: Mmake.vars Mmake.rules install_dirs
|
|
rm -f $(INSTALL_LIBDIR)/mmake/Mmake.vars
|
|
cp `vpath_find Mmake.vars Mmake.rules` $(INSTALL_LIBDIR)/mmake
|
|
|
|
.PHONY: install_scripts
|
|
install_scripts: $(SCRIPTS) install_dirs
|
|
# We move the installed `mmake' script before (re)installing it
|
|
# to avoid overwriting the script while it is running
|
|
# (just removing it doesn't work very well on win32, which will
|
|
# deny you permission to write the file while mmake is running).
|
|
-mv $(INSTALL_BINDIR)/mmake $(INSTALL_BINDIR)/mmake.old
|
|
cp $(SCRIPTS) $(INSTALL_BINDIR)
|
|
-for file in $(SCRIPTS); do \
|
|
chmod u+w $(INSTALL_BINDIR)/$$file ;\
|
|
done
|
|
cp *.in *.sh-subr $(SCRIPTS) $(INSTALL_RECONF_DIR)/scripts
|
|
-rm -f $(INSTALL_BINDIR)/mmake.old
|
|
ifeq ($(findstring java,$(GRADE)),java)
|
|
for file in $(JAVA_WRAPPER_SCRIPTS); do \
|
|
cp $$file.sh-java $(INSTALL_MERC_BIN_DIR)/$$file ;\
|
|
done
|
|
endif
|
|
ifeq ($(findstring csharp,$(GRADE)),csharp)
|
|
for file in $(CSHARP_WRAPPER_SCRIPTS); do \
|
|
cp $$file.sh-csharp $(INSTALL_MERC_BIN_DIR)/$$file ;\
|
|
done
|
|
endif
|
|
|
|
.PHONY: install_config
|
|
install_config: Mercury.config install_dirs
|
|
rm -f $(INSTALL_CONF_DIR)/Mercury.config
|
|
cp `vpath_find Mercury.config` $(INSTALL_CONF_DIR)
|
|
|
|
.PHONY: install_debugger_scripts
|
|
install_debugger_scripts: $(DEBUGGER_SCRIPTS) install_dirs
|
|
# Reportedly old versions of Mercury
|
|
# used to install mdbrc as read-only.
|
|
# If that is the case, then we need to make sure
|
|
# that it gets made writable before we install the
|
|
# new version.
|
|
-chmod u+w $(INSTALL_LIBDIR)/mdb/*
|
|
cp $(DEBUGGER_SCRIPTS) $(INSTALL_LIBDIR)/mdb
|
|
|
|
.PHONY: install_emacs_scripts
|
|
install_emacs_scripts: $(EMACS_SCRIPTS) install_dirs
|
|
cp $(EMACS_SCRIPTS) $(INSTALL_ELISP_DIR)
|
|
|
|
#-----------------------------------------------------------------------------#
|
|
|
|
.PHONY: uninstall
|
|
uninstall:
|
|
-rm -r $(INSTALL_LIBDIR)/mmake
|
|
-cd $(INSTALL_BINDIR) && rm $(SCRIPTS)
|
|
-cd $(INSTALL_LIBDIR)/mdb && rm $(DEBUGGER_SCRIPTS)
|
|
# The reason why we don't uninstall $(EMACS_SCRIPTS) specifically here
|
|
# is that the uninstall rule in the top-level Mmakefile does an "rm -r"
|
|
# on $(INSTALL_LIBDIR), and the directory into which $(EMACS_SCRIPTS)
|
|
# is installed, $(INSTALL_ELISP_DIR), is configured to be a
|
|
# subdirectory of $(INSTALL_LIBDIR).
|
|
|
|
#-----------------------------------------------------------------------------#
|
|
|
|
realclean_local: clean_scripts
|
|
|
|
.PHONY: clean_scripts
|
|
clean_scripts:
|
|
for file in *.in; do rm -f `basename $$file .in`; done
|
|
rm -f test_mdbrc
|
|
rm -f config.log
|
|
|
|
#-----------------------------------------------------------------------------#
|