Files
mercury/scripts/Mmakefile
Warwick Harvey be51ca48b6 Added built-in mmake support for installing user libraries.
Estimated hours taken: 30

Added built-in mmake support for installing user libraries.

Mmake.common.in:
	Moved the definitions of many of the generic install directories
	(plus FULLARCH and LIBGRADES) to scripts/Mmake.vars.in, so they
	can be used for things other than just the Mercury compiler.

compiler/modules.m:
	Added code to generate appropriate lib<module>.install* targets.
	Improved the dependency list generated for the lib<module> target to
	include intermodule optimisation files if and only if the
	appropriate flags have been set (previously it always depended on
	the `.opt' files, but never on the `.trans_opt' files).

scripts/Mmake.rules:
	Added some rules for use when installing libraries.

scripts/Mmake.vars.in:
	Added the definitions of many of the generic install directories
	(plus FULLARCH and LIBGRADES) from Mmake.common.in.
	Added support for overriding and/or adding to the definition of
	LIBGRADES on a per-library basis.

scripts/mercury_cleanup_install:
	New script, for cleaning up after failed installs.

scripts/Mmakefile:
	Added `mercury_cleanup_install' to the list of scripts to be
	installed.

bindist/Mmakefile:
bindist/bindist.Makefile.in:
	Added `mercury_cleanup_install' and `vpath_find' to the list of
	utilities included in and installed by a binary distribution.  These
	are used by some of the install targets.

doc/user_guide.texi:
	Documented the new features.

extras/references/Mmakefile:
extras/references/samples/Mmakefile:
	Changed to exploit/test new features.
1999-10-21 14:36:39 +00:00

100 lines
3.4 KiB
Plaintext

#-----------------------------------------------------------------------------#
#-----------------------------------------------------------------------------#
# Copyright (C) 1996-1999 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 \
sicstus_conv mtags vpath_find mercury_update_interface \
mkfifo_using_mknod mercury_cleanup_install
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
#-----------------------------------------------------------------------------#
ml mgnuc: init_grade_options.sh-subr
ml mgnuc: parse_grade_options.sh-subr
ml mgnuc: final_grade_options.sh-subr
#-----------------------------------------------------------------------------#
.PHONY: install
install: install_mmake install_scripts \
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_ELISP_DIR) ] || mkdir -p $(INSTALL_ELISP_DIR)
.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
-rm -f $(INSTALL_BINDIR)/mmake.old
.PHONY: install_emacs_scripts
install_emacs_scripts: $(EMACS_SCRIPTS) install_dirs
cp $(EMACS_SCRIPTS) $(INSTALL_ELISP_DIR)
.PHONY: install_debugger_scripts
install_debugger_scripts: $(DEBUGGER_SCRIPTS) install_dirs
cp $(DEBUGGER_SCRIPTS) $(INSTALL_LIBDIR)/mdb
#-----------------------------------------------------------------------------#
.PHONY: uninstall
uninstall:
-rm -r $(INSTALL_LIBDIR)/mmake
-cd $(INSTALL_BINDIR) && rm $(SCRIPTS)
-cd $(INSTALL_LIBDIR)/mdb && rm $(DEBUGGER_SCRIPTS)
#-----------------------------------------------------------------------------#
realclean_local: clean_scripts
.PHONY: clean_scripts
clean_scripts:
for file in *.in; do rm -f `basename $$file .in`; done
#-----------------------------------------------------------------------------#