mirror of
https://github.com/Mercury-Language/mercury.git
synced 2026-04-15 01:13:30 +00:00
Estimated hours taken: 2 Cleaned up runtime directory. runtime/*.c: - Renamed all .c files as mercury_*.c Some have been renamed to make their purpose clearer. call.mod -> mercury_ho_call.c runtime/*.h: - Moved contents of .h files to mercury_*.h - *.h now contain #include mercury_*.h. They be removed later. - Updated references to conf.h -> mercury_conf.h runtime/conf.h.in: - Renamed conf.h.in as mercury_conf.h.in. Didn't leave a forwarding header for this one, as conf.h was never part of the repository anyway. runtime/Mmakefile: - Convert lists to one-per-line lists. - Add mercury_accurate_gc.h to HDRS. - Remove all .mod files - Make sure runtime.init uses the ORIG_CS not MOD_CS. - Fix the rules for "clean_o" and "clean_mod_c", which used wildcards like "*.o" to remove files. The one that removed all .c files corresponding with *.mod, instead of using MOD_CS was particularly vicious. - Cope with the file renamings. configure.in: - Cope with the file renamings.
230 lines
5.8 KiB
Plaintext
230 lines
5.8 KiB
Plaintext
#-----------------------------------------------------------------------------#
|
|
# Copyright (C) 1997 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 runtime library
|
|
|
|
MAIN_TARGET=lib
|
|
|
|
MERCURY_DIR=..
|
|
include $(MERCURY_DIR)/Mmake.common
|
|
|
|
#-----------------------------------------------------------------------------#
|
|
|
|
CFLAGS = -I$(MERCURY_DIR)/runtime -I$(MERCURY_DIR)/boehm_gc -g \
|
|
$(DLL_CFLAGS) $(EXTRA_CFLAGS)
|
|
MGNUC = MERCURY_C_INCL_DIR=. $(SCRIPTS_DIR)/mgnuc
|
|
MGNUCFLAGS = --no-ansi $(CFLAGS)
|
|
MOD2C = $(SCRIPTS_DIR)/mod2c
|
|
|
|
#-----------------------------------------------------------------------------#
|
|
|
|
# keep this list in alphabetical order, please
|
|
HDRS = \
|
|
mercury_engine.h \
|
|
mercury_getopt.h \
|
|
mercury_goto.h \
|
|
mercury_heap.h \
|
|
mercury_imp.h \
|
|
mercury_init.h \
|
|
mercury_label.h \
|
|
mercury_memory.h \
|
|
mercury_accurate_gc.h \
|
|
mercury_calls.h \
|
|
mercury_conf.h \
|
|
mercury_context.h \
|
|
mercury_debug.h \
|
|
mercury_deep_copy.h \
|
|
mercury_dummy.h \
|
|
mercury_dlist.h \
|
|
mercury_float.h \
|
|
mercury_string.h \
|
|
mercury_trace.h \
|
|
mercury_trail.h \
|
|
mercury_types.h \
|
|
mercury_misc.h \
|
|
mercury_overflow.h \
|
|
mercury_prof.h \
|
|
mercury_prof_mem.h \
|
|
mercury_regorder.h \
|
|
mercury_regs.h \
|
|
mercury_spinlock.h \
|
|
mercury_std.h \
|
|
mercury_stacks.h \
|
|
mercury_table.h \
|
|
mercury_tags.h \
|
|
mercury_timing.h \
|
|
mercury_type_info.h \
|
|
mercury_wrapper.h \
|
|
$(LIBMER_DLL_H)
|
|
|
|
# Note that `libmer_globals.h' cannot be part of $(HDR),
|
|
# since it depends on libmer_def.a, and $(OBJ) : $(HDR) would create a
|
|
# circular dependency.
|
|
|
|
|
|
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
|
|
|
|
|
|
# XXX .mod support is being removed. This will soon disappear.
|
|
MODS =
|
|
MOD_CS =
|
|
MOD_OS = $(MOD_CS:.c=.o)
|
|
|
|
# keep this list in alphabetical order, please
|
|
ORIG_CS = mercury_context.c \
|
|
mercury_deep_copy.c \
|
|
mercury_dlist.c \
|
|
mercury_dummy.c \
|
|
mercury_engine.c \
|
|
mercury_float.c \
|
|
mercury_grade.c \
|
|
mercury_ho_call.c \
|
|
mercury_label.c \
|
|
mercury_memory.c \
|
|
mercury_misc.c \
|
|
mercury_prof.c \
|
|
mercury_prof_mem.c \
|
|
mercury_regs.c \
|
|
mercury_spinlock.c \
|
|
mercury_table.c \
|
|
mercury_timing.c \
|
|
mercury_trace.c \
|
|
mercury_trail.c \
|
|
mercury_type_info.c \
|
|
mercury_wrapper.c
|
|
|
|
ORIG_OS = $(ORIG_CS:.c=.o)
|
|
ORIG_OS = $(ORIG_CS:.c=.o)
|
|
OBJS = $(MOD_OS) $(ORIG_OS)
|
|
PIC_OBJS = $(OBJS:.o=.$(EXT_FOR_PIC_OBJECTS))
|
|
|
|
LDFLAGS = -L$(BOEHM_GC_DIR)
|
|
LDLIBS = \
|
|
` case "$(GRADE)" in \
|
|
*.gc*.prof*) echo "-lgc_prof" ;; \
|
|
*.gc*) echo "-lgc" ;; \
|
|
esac \
|
|
`
|
|
|
|
#-----------------------------------------------------------------------------#
|
|
|
|
# Stuff for Windows DLLs
|
|
|
|
ifeq ($(USE_DLLS),yes)
|
|
|
|
DLL_CFLAGS = -Dlibmer_DEFINE_DLL
|
|
|
|
LIBMER_DLL_H = libmer_dll.h
|
|
LIBMER_GLOBALS_H = libmer_globals.h
|
|
|
|
include $(MERCURY_DIR)/Makefile.DLLs
|
|
|
|
endif
|
|
|
|
#-----------------------------------------------------------------------------#
|
|
|
|
$(OBJS) $(PIC_OBJS): $(HDRS) $(MACHHDRS)
|
|
|
|
#-----------------------------------------------------------------------------#
|
|
|
|
.PHONY: lib
|
|
lib: libmer.a libmer.$(EXT_FOR_SHARED_LIB) runtime.init \
|
|
$(LIBMER_DLL_H) $(LIBMER_GLOBALS_H)
|
|
|
|
libmer$(DLL_DEF_LIB).a: $(OBJS)
|
|
rm -f libmer$(DLL_DEF_LIB).a
|
|
ar cr libmer$(DLL_DEF_LIB).a $(OBJS)
|
|
$(RANLIB) libmer$(DLL_DEF_LIB).a
|
|
|
|
libmer.so: $(PIC_OBJS)
|
|
$(LINK_SHARED_OBJ) -o libmer.so $(PIC_OBJS) \
|
|
$(SHLIB_RPATH_OPT)$(FINAL_INSTALL_MERC_GC_LIB_DIR) \
|
|
$(LDFLAGS) $(LDLIBS) \
|
|
$(SHARED_LIBS)
|
|
|
|
runtime.init: $(ORIG_CS)
|
|
cat `vpath_find $(ORIG_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
|
|
@true
|
|
|
|
.PHONY: cs
|
|
cs: $(MOD_CS)
|
|
|
|
tags: $(MODS) $(ORIG_CS)
|
|
ctags $(MODS) $(ORIG_CS) $(HDRS)
|
|
|
|
.PHONY: check_headers
|
|
check_headers:
|
|
for file in $(HDRS); do \
|
|
echo "$$file"; \
|
|
echo "#include \"$$file\"" > tmp.c; \
|
|
$(MGNUC) $(MGNUCFLAGS) -c tmp.c || exit 1; \
|
|
done
|
|
rm -f tmp.c
|
|
|
|
#-----------------------------------------------------------------------------#
|
|
|
|
# installation rules
|
|
|
|
.PHONY: install
|
|
install: install_headers install_init install_lib
|
|
|
|
.PHONY: install_headers
|
|
install_headers: $(HDRS) $(MACHHDRS) $(LIBMER_GLOBALS_H)
|
|
-[ -d $(INSTALL_INC_DIR)/machdeps ] || \
|
|
mkdir -p $(INSTALL_INC_DIR)/machdeps
|
|
cp `vpath_find $(HDRS) $(LIBMER_GLOBALS_H)` $(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
|
|
|
|
# prevent Mmake from removing C files
|
|
RM_C=:
|
|
|
|
#-----------------------------------------------------------------------------#
|
|
|
|
clean: clean_o clean_mod_c
|
|
|
|
.PHONY: clean_o
|
|
clean_o:
|
|
rm -f $(MOD_OS) $(OBJS) $(PIC_OBJS)
|
|
|
|
.PHONY: clean_mod_c
|
|
clean_mod_c:
|
|
rm -f $(MOD_OS)
|
|
|
|
realclean:
|
|
rm -f libmer.a libmer.so runtime.init
|
|
rm -f conf.h conf.h.date
|
|
|
|
#-----------------------------------------------------------------------------#
|