mirror of
https://github.com/Mercury-Language/mercury.git
synced 2025-12-20 08:19:28 +00:00
{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.
134 lines
3.9 KiB
Plaintext
134 lines
3.9 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 runtime library
|
|
|
|
MAIN_TARGET=lib
|
|
|
|
MERCURY_DIR=..
|
|
include $(MERCURY_DIR)/Mmake.common
|
|
|
|
#-----------------------------------------------------------------------------#
|
|
|
|
CFLAGS = -I$(MERCURY_DIR)/runtime -I$(MERCURY_DIR)/boehm_gc -g \
|
|
$(EXTRA_CFLAGS)
|
|
MGNUC = MERCURY_C_INCL_DIR=. $(SCRIPTS_DIR)/mgnuc
|
|
MGNUCFLAGS = --no-ansi $(CFLAGS)
|
|
MOD2C = $(SCRIPTS_DIR)/mod2c
|
|
|
|
#-----------------------------------------------------------------------------#
|
|
|
|
HDRS = access.h aux.h conf.h dlist.h debug.h dummy.h engine.h \
|
|
getopt.h goto.h heap.h imp.h init.h label.h \
|
|
overflow.h prof.h memory.h mercury_solver_backtrack.h \
|
|
regorder.h regs.h std.h stacks.h \
|
|
table.h tags.h timing.h wrapper.h \
|
|
prof.h type_info.h
|
|
|
|
MACHHDRS = machdeps/no_regs.h machdeps/i386_regs.h \
|
|
machdeps/mips_regs.h machdeps/sparc_regs.h \
|
|
machdeps/alpha_regs.h machdeps/pa_regs.h \
|
|
machdeps/rs6000_regs.h
|
|
MODS = engine.mod wrapper.mod call.mod solutions.mod
|
|
MOD_CS = engine.c wrapper.c call.c solutions.c
|
|
MOD_OS = $(MOD_CS:.c=.o)
|
|
ORIG_CS = access.c aux.c dlist.c dummy.c label.c \
|
|
memory.c table.c timing.c prof.c
|
|
ORIG_OS = $(ORIG_CS:.c=.o)
|
|
OBJS = $(MOD_OS) $(ORIG_OS)
|
|
# OBJS = engine.o wrapper.o call.o solutions.o \
|
|
# access.o aux.o dlist.o dummy.o label.o \
|
|
# memory.o table.o timing.o
|
|
PIC_OBJS = $(OBJS:.o=.$(EXT_FOR_PIC_OBJECTS))
|
|
|
|
#-----------------------------------------------------------------------------#
|
|
|
|
$(OBJS) $(PIC_OBJS): $(HDRS) $(MACHHDRS)
|
|
|
|
#-----------------------------------------------------------------------------#
|
|
|
|
.PHONY: lib
|
|
lib: libmer.a libmer.$(EXT_FOR_SHARED_LIB) runtime.init
|
|
|
|
libmer.a: $(OBJS)
|
|
rm -f libmer.a
|
|
ar cr libmer.a $(OBJS)
|
|
$(RANLIB) libmer.a
|
|
|
|
libmer.so: $(PIC_OBJS)
|
|
$(LINK_SHARED_OBJ) -o libmer.so $(PIC_OBJS) `\
|
|
case "$(GRADE)" in \
|
|
*.gc.prof) echo "-L$(BOEHM_GC_DIR) -lgc_prof" ;; \
|
|
*.gc) echo "-L$(BOEHM_GC_DIR) -lgc" ;; \
|
|
esac \
|
|
` $(SHARED_LIBS)
|
|
|
|
runtime.init: $(MOD_CS)
|
|
cat `vpath_find $(MOD_CS)` | grep '^INIT ' > runtime.init
|
|
|
|
conf.h.date: $(MERCURY_DIR)/config.status conf.h.in
|
|
CONFIG_FILES= CONFIG_HEADERS=conf.h $(MERCURY_DIR)/config.status
|
|
echo datestamp > conf.h.date
|
|
|
|
conf.h: conf.h.date
|
|
|
|
|
|
.PHONY: cs
|
|
cs: $(MOD_CS)
|
|
|
|
tags: $(MODS) $(ORIG_CS)
|
|
ctags $(MODS) $(ORIG_CS)
|
|
|
|
#-----------------------------------------------------------------------------#
|
|
|
|
# installation rules
|
|
|
|
.PHONY: install
|
|
install: install_headers install_init install_lib
|
|
|
|
.PHONY: install_headers
|
|
install_headers: $(HDRS) $(MACHHDRS)
|
|
-[ -d $(INSTALL_INC_DIR)/machdeps ] || \
|
|
mkdir -p $(INSTALL_INC_DIR)/machdeps
|
|
cp `vpath_find $(HDRS)` $(INSTALL_INC_DIR)
|
|
chmod u+w $(INSTALL_INC_DIR)/conf.h
|
|
cp `vpath_find $(MACHHDRS)` $(INSTALL_INC_DIR)/machdeps
|
|
|
|
.PHONY: install_init
|
|
install_init: runtime.init
|
|
-[ -d $(INSTALL_MODULE_DIR) ] || mkdir -p $(INSTALL_MODULE_DIR)
|
|
cp `vpath_find runtime.init` $(INSTALL_MODULE_DIR)
|
|
|
|
.PHONY: install_lib
|
|
install_lib: libmer.a libmer.$(EXT_FOR_SHARED_LIB)
|
|
-[ -d $(INSTALL_MERC_LIB_DIR) ] || mkdir -p $(INSTALL_MERC_LIB_DIR)
|
|
cp `vpath_find libmer.a libmer.$(EXT_FOR_SHARED_LIB)` \
|
|
$(INSTALL_MERC_LIB_DIR)
|
|
|
|
#-----------------------------------------------------------------------------#
|
|
|
|
# prevent GNU make from removing these intermediate files
|
|
dont_remove: engine.c wrapper.c call.c solutions.c
|
|
|
|
#-----------------------------------------------------------------------------#
|
|
|
|
clean: clean_o clean_mod_c
|
|
|
|
.PHONY: clean_o
|
|
clean_o:
|
|
rm -f *.o *.pic_o
|
|
|
|
.PHONY: clean_mod_c
|
|
clean_mod_c:
|
|
for file in *.mod; do \
|
|
rm -f `basename $$file .mod`.c; \
|
|
done
|
|
|
|
realclean:
|
|
rm -f libmer.a libmer.so
|
|
|
|
#-----------------------------------------------------------------------------#
|