mirror of
https://github.com/Mercury-Language/mercury.git
synced 2026-04-16 09:53:36 +00:00
Estimated hours taken: 20 Branches: main Move the setting of configuration options from mmc.in to an options file Mercury.config. This has a few advantages: - reduces the duplication between mmc and mercury.bat - reduces the chance of running out of environment space on crappy operating systems (although we probably exceed the command line length limits on those systems anyway). - makes it easier to bootstrap changes which add new configuration options. Always read the options files, even without `--make', to avoid inconsistent behaviour. scripts/Mercury.config.in: New file containing the configuration code from mmc.in. configure.in: Create scripts/Mercury.config. bindist/Mmakefile: Make sure Mercury.config.in goes in the binary distribution. Mmakefile: bindist/Mmakefile: Mmake.common.in: Make sure we get the correct setting of INSTALL_PREFIX when building the binary distribution. scripts/Mmakefile: scripts/mercury_config.in: bindist/bindist.Mmakefile.in: Install Mercury.config. compiler/options.m: doc/user_guide.texi: Add documentation for the `--config-file' option, which gives the name of the configuration file to read. Add an option `read-config-file-2003-03-01' which will be used in configure.in to test whether the compiler is up to date after the configuration code is removed from mmc.in (after this change is installed everywhere). Add `--mercury-config-dir' as an abbreviation for `--mercury-configuration-directory'. Mmake.workspace: Use the configuration file in scripts/Mercury.config. browser/Mmakefile: compiler/Mmakefile: scripts/Mmake.vars.in: Always pass ALL_MCFLAGS to mmc so that mmc will use the configuration file specified in the options. compiler/handle_options.m: Handle the default value of `--config-file'. compiler/mercury_compile.m: Read the configuration file. Always read the options files, even without `--make', to avoid inconsistent behaviour. compiler/make.m: Pass the variable settings from the configuration file to make__process_args. The options files have already been read in mercury_compile.m, so don't read them again here. compiler/make.util.m: Add a version of build_with_module_options which doesn't need a make_info, for use by mercury_compile.m. compiler/options_file.m: Export a predicate to read a single options file. Make the predicates to read options files add to an initial options_variables map, rather than always creating a new one. Allow MERCURY_STDLIB_DIR and MERCURY_CONFIG_DIR to be set in the options file or environment. scripts/mmc.in: Set MERCURY_STDLIB_DIR and MERCURY_CONFIG_DIR in mercury_compile's environment.
124 lines
4.6 KiB
Plaintext
124 lines
4.6 KiB
Plaintext
#-----------------------------------------------------------------------------#
|
|
#-----------------------------------------------------------------------------#
|
|
# Copyright (C) 1996-2003 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
|
|
|
|
#-----------------------------------------------------------------------------#
|
|
|
|
SCRIPTS = mmake mmc mdb c2init mgnuc ml mprof mprof_merge_runs \
|
|
mtags vpath_find mercury_update_interface \
|
|
mkfifo_using_mknod mercury_cleanup_install canonical_grade \
|
|
mercury_config mercury.bat
|
|
DEBUGGER_SCRIPTS = mdbrc
|
|
EMACS_SCRIPTS = gud.el
|
|
|
|
#-----------------------------------------------------------------------------#
|
|
|
|
.SUFFIXES: .in
|
|
|
|
.in:
|
|
CONFIG_FILES=$@ CONFIG_HEADERS= $(MERCURY_DIR)/config.status
|
|
# check to ensure there were no mispelt autoconf variable names
|
|
if grep -n '[^$$]@' $@; then false; else true; fi
|
|
|
|
#-----------------------------------------------------------------------------#
|
|
|
|
.PHONY: all
|
|
all: $(SCRIPTS) $(DEBUGGER_SCRIPTS) $(EMACS_SCRIPTS)
|
|
all: Mmake.vars Mercury.config
|
|
|
|
#-----------------------------------------------------------------------------#
|
|
|
|
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
|
|
|
|
.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
|
|
|
|
#-----------------------------------------------------------------------------#
|