Files
mercury/runtime/Mmake
1995-09-04 05:11:10 +00:00

123 lines
3.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 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 io_rt.h label.h \
overflow.h prof.h memory.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
MODS = engine.mod io_rt.mod wrapper.mod call.mod solutions.mod \
math_rt.mod
MOD_CS = engine.c io_rt.c wrapper.c call.c solutions.c math_rt.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 io_rt.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=.$(PIC_O))
#-----------------------------------------------------------------------------#
$(OBJS): $(HDRS) $(MACHHDRS)
#-----------------------------------------------------------------------------#
.PHONY: lib
lib: libmer.a libmer.$(SO) runtime.init
libmer.a: $(OBJS)
ar cr libmer.a $(OBJS)
$(RANLIB) libmer.a
libmer.so: $(PIC_OBJS)
$(LINK_SHARED_OBJ) -o libmer.so $(PIC_OBJS) # -L$(BOEHM_GC_DIR) -lgc
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 +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.$(SO)
-[ -d $(INSTALL_MERC_LIB_DIR) ] || mkdir -p $(INSTALL_MERC_LIB_DIR)
cp `vpath_find libmer.a libmer.$(SO)` $(INSTALL_MERC_LIB_DIR)
#-----------------------------------------------------------------------------#
# prevent GNU make from removing these intermediate files
dont_remove: engine.c io_rt.c wrapper.c call.c solutions.c
#-----------------------------------------------------------------------------#
clean: clean_o clean_mod_c
.PHONY: clean_o
clean_o:
rm -f *.o
.PHONY: clean_mod_c
clean_mod_c:
for file in *.mod; do \
rm -f `basename $$file .mod`.c; \
done
#-----------------------------------------------------------------------------#