Files
mercury/scripts/Mmake
Fergus Henderson 1198573324 Fix a security problem with the use of `chmod +w'.
Estimated hours taken: 0.5

Fix a security problem with the use of `chmod +w'.

{scripts,runtime}/Mmake:
	Use `chmod u+w' rather than `chmod +w' on the installed files,
	since `chmod +w' has the wrong effect with some versions of chmod.
	When configure creates automatically-generated files, we do a
	`chmod -w' on them to make sure that you don't accidentally edit
	the automatically-generated file rather than the source `.in' file.
	However, if the installed copies are write-only, then it causes
	problems when installing a new copy on top of an old one.
	Hence we turn write permission back on again on the installed copies.
	The `chmod +w' command has the right effect on Solaris, OSF/1, and
	SunOS, where it takes into account the umask.  However, on IRIX and
	ULTRIX, `chmod +w' does not take the umask into account, and so
	makes the files world-writable, which is a security problem.
	Hence, we now use `chmod u+w' instead.
1996-04-10 09:26:11 +00:00

87 lines
2.7 KiB
Plaintext

#-----------------------------------------------------------------------------#
#-----------------------------------------------------------------------------#
# Copyright (C) 1995 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 mc mod2c c2init mgnuc ml mprof mint \
sicstus_conv mtags vpath_find mercury_update_interface \
mkfifo_using_mknod
NUPROLOG_SCRIPTS = mnc mnl mnp
SICSTUS_SCRIPTS = msc msl msp
#-----------------------------------------------------------------------------#
.SUFFIXES: .in
.in:
CONFIG_FILES=$@ CONFIG_HEADERS= $(MERCURY_DIR)/config.status
#-----------------------------------------------------------------------------#
.PHONY: all
all: $(SCRIPTS) $(NUPROLOG_SCRIPTS) $(SICSTUS_SCRIPTS)
#-----------------------------------------------------------------------------#
.PHONY: install
install: install_mmake install_scripts $(INSTALL_NUPROLOG) $(INSTALL_SICSTUS)
.PHONY: install_mmake
install_mmake: Mmake.vars Mmake.rules
[ -d $(INSTALL_LIBDIR)/mmake ] || mkdir -p $(INSTALL_LIBDIR)/mmake
rm -f $(INSTALL_LIBDIR)/mmake/Mmake.vars
cp `vpath_find Mmake.vars Mmake.rules` $(INSTALL_LIBDIR)/mmake
.PHONY: install_scripts
install_scripts: $(SCRIPTS)
[ -d $(INSTALL_BINDIR) ] || mkdir -p $(INSTALL_BINDIR)
cp $(SCRIPTS) $(INSTALL_BINDIR)
for file in $(SCRIPTS); do \
chmod u+w $(INSTALL_BINDIR)/$$file ;\
done
.PHONY: install_nuprolog
install_nuprolog: $(NUPROLOG_SCRIPTS)
[ -d $(INSTALL_BINDIR) ] || mkdir -p $(INSTALL_BINDIR)
cp $(NUPROLOG_SCRIPTS) $(INSTALL_BINDIR)
for file in $(NUPROLOG_SCRIPTS); do \
chmod u+w $(INSTALL_BINDIR)/$$file ;\
done
.PHONY: install_sicstus
install_sicstus: $(SICSTUS_SCRIPTS)
[ -d $(INSTALL_BINDIR) ] || mkdir -p $(INSTALL_BINDIR)
cp $(SICSTUS_SCRIPTS) $(INSTALL_BINDIR)
for file in $(SICSTUS_SCRIPTS); do \
chmod u+w $(INSTALL_BINDIR)/$$file ;\
done
#-----------------------------------------------------------------------------#
.PHONY: uninstall
uninstall:
-rm -r $(INSTALL_LIBDIR)/mmake
-cd $(INSTALL_BINDIR) && \
rm $(SCRIPTS) $(SICSTUS_SCRIPTS) $(NUPROLOG_SCRIPTS)
#-----------------------------------------------------------------------------#
realclean: clean_scripts
.PHONY: clean_scripts
clean_scripts:
for file in *.in; do rm -f `basename $$file .in`; done
#-----------------------------------------------------------------------------#