#-----------------------------------------------------------------------------# #-----------------------------------------------------------------------------# # Copyright (C) 1996-2002 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.bat DEBUGGER_SCRIPTS = mdbrc EMACS_SCRIPTS = gud.el CGI_SCRIPTS = mdprof #-----------------------------------------------------------------------------# .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) $(CGI_SCRIPTS) all: Mmake.vars #-----------------------------------------------------------------------------# 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 #-----------------------------------------------------------------------------# .PHONY: install install: install_mmake install_scripts \ install_debugger_scripts install_emacs_scripts install_cgi_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_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: install_cgi_scripts install_cgi_scripts: $(CGI_SCRIPTS) # $(INSTALL_CGI_DIR) is likely to be writeable only by root or # the www system administrator, which is why we don't consider a # failure of this action to be an error. If the command fails, # the install action in ../Mmakefile will remind the user to do # the copy later. -if test $(ENABLE_DEEP_PROFILER) = yes ; then \ cp $(CGI_SCRIPTS) $(INSTALL_CGI_DIR) ; \ fi #-----------------------------------------------------------------------------# .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). # # We try to uninstall $(CGI_SCRIPTS), but failure to do so is not an # error for two reasons: because we may simply lack permission to # update the directory, and because the deep profiler installation # may not have been enabled in the first place. (Looking at the current # value of $(ENABLE_DEEP_PROFILER) to check for the latter wouldn't # necessarily do any good, since its setting may have changed since # the original install.) -cd $(INSTALL_CGI_DIR) && rm $(CGI_SCRIPTS) #-----------------------------------------------------------------------------# realclean_local: clean_scripts .PHONY: clean_scripts clean_scripts: for file in *.in; do rm -f `basename $$file .in`; done #-----------------------------------------------------------------------------#