mirror of
https://github.com/Mercury-Language/mercury.git
synced 2026-04-16 01:43:35 +00:00
251 lines
8.7 KiB
Plaintext
251 lines
8.7 KiB
Plaintext
#-----------------------------------------------------------------------------#
|
|
# vim: ts=8 sw=8 noexpandtab
|
|
#-----------------------------------------------------------------------------#
|
|
# Copyright (C) 2005-2007, 2009-2012 The University of Melbourne.
|
|
# This file may only be copied under the terms of the GNU General
|
|
# Public Licence - see the file COPYING in the Mercury distribution.
|
|
#-----------------------------------------------------------------------------#
|
|
|
|
# Mmakefile for building the Mercury slice and dice tools.
|
|
|
|
MERCURY_DIR=..
|
|
LINK_STATIC=yes
|
|
include $(MERCURY_DIR)/Mmake.common
|
|
|
|
#----------------------------------------------------------------------------#
|
|
|
|
# Override some settings from ../Mmake.workspace so that in debugging grades
|
|
# we do not include mer_mdbcomp.init when creating the _init.c files in
|
|
# this directory. We copy the mdbcomp modules into this directory so if we
|
|
# do include mer_mdbcomp.init we will end up with duplicate entries in the
|
|
# _init.c files.
|
|
|
|
C2INITFLAGS = --trace-init-file $(BROWSER_DIR)/$(BROWSER_LIB_NAME).init
|
|
|
|
#----------------------------------------------------------------------------#
|
|
|
|
-include Mmake.slice.params
|
|
|
|
# Override the default rule in `mmake --use-mmc-make' that asks `mmc' to
|
|
# create a missing optional params file.
|
|
Mmake.slice.params:
|
|
|
|
# Module-specific options should go in Mercury.options so they
|
|
# can be found by `mmc --make'.
|
|
include Mercury.options
|
|
|
|
MAIN_TARGET = all
|
|
|
|
# If you add more modules, you'll also have to modify ../Mmakefile.
|
|
MERCURY_MAIN_MODULES = mslice mdice mtc_union mcov mtc_diff
|
|
|
|
DEPENDS = $(patsubst %,%.depend,$(MERCURY_MAIN_MODULES))
|
|
INTS = $(patsubst %,%.ints,$(MERCURY_MAIN_MODULES))
|
|
INT3S = $(patsubst %,%.int3s,$(MERCURY_MAIN_MODULES))
|
|
CHECKS = $(patsubst %,%.check,$(MERCURY_MAIN_MODULES))
|
|
PDBS = $(patsubst %,%.pdb,$(MERCURY_MAIN_MODULES))
|
|
|
|
VPATH = $(LIBRARY_DIR) $(SSDB_DIR)
|
|
|
|
#-----------------------------------------------------------------------------#
|
|
|
|
MDBCOMP_MODULES = \
|
|
builtin_modules.m \
|
|
feedback.automatic_parallelism.m \
|
|
feedback.m \
|
|
mdbcomp.m \
|
|
mdbcomp.goal_path.m \
|
|
prim_data.m \
|
|
program_representation.m \
|
|
rtti_access.m \
|
|
shared_utilities.m \
|
|
slice_and_dice.m \
|
|
sym_name.m \
|
|
trace_counts.m
|
|
|
|
#-----------------------------------------------------------------------------#
|
|
|
|
MLFLAGS += --shared
|
|
MCFLAGS += --flags SLICE_FLAGS $(CONFIG_OVERRIDE)
|
|
|
|
#-----------------------------------------------------------------------------#
|
|
|
|
ifneq ("$(filter il% csharp% java% erlang%,$(GRADE))","")
|
|
MLOBJS =
|
|
endif
|
|
|
|
#-----------------------------------------------------------------------------#
|
|
|
|
# Tell the C# compiler where the stdlib assembly is.
|
|
#
|
|
ifneq ("$(filter csharp%,$(GRADE))","")
|
|
CSCFLAGS=-lib:../library -r:mer_std.dll
|
|
endif
|
|
|
|
#-----------------------------------------------------------------------------#
|
|
|
|
.PHONY: depend
|
|
depend: $(MDBCOMP_MODULES) $(DEPENDS)
|
|
|
|
$(DEPENDS): SLICE_FLAGS $(MDBCOMP_MODULES)
|
|
|
|
.PHONY: all
|
|
all: $(MDBCOMP_MODULES) $(MERCURY_MAIN_MODULES) $(TAGS_FILE_EXISTS)
|
|
|
|
#-----------------------------------------------------------------------------#
|
|
#
|
|
# The programs in this directory rely on the mdbcomp package, since
|
|
# it contains the types that define the representation of Mercury programs
|
|
# for tools such as debuggers and profilers, and predicates that operate on
|
|
# those representations.
|
|
#
|
|
# If we linked ../mdbcomp/libmer_mdbcomp.so into the executables in this
|
|
# directory, then those executables would have to be compiled in the same grade
|
|
# as the modules of the mdbcomp directory, which in turn is the same grade
|
|
# as the modules of the library and compiler directories. This would work,
|
|
# but it would mean that rebuilding the tools in this directory in another
|
|
# grade (e.g. to enable debugging) would take several minutes. To avoid such
|
|
# delays, we copy across the source files of the mdbcomp library. The copied
|
|
# .m files, and the .m files that natively reside in this directory, can be
|
|
# recompiled in a different grade much more quickly than that.
|
|
#
|
|
|
|
$(MDBCOMP_MODULES): %: $(MDBCOMP_DIR)/%
|
|
-@/bin/rm -f $*
|
|
@cp $(MDBCOMP_DIR)/$* .
|
|
@chmod a-w $*
|
|
|
|
#-----------------------------------------------------------------------------#
|
|
|
|
# The C#, Java and Erlang implementations of the mdbcomp library are not yet
|
|
# complete, so we need to pass `--allow-stubs' to get them to compile.
|
|
# Since the standard library is compiled with `--halt-at-warn',
|
|
# we also need `--no-warn-stubs'.
|
|
ifneq ("$(filter csharp% java% erlang%,$(GRADE))","")
|
|
MCFLAGS += --allow-stubs --no-warn-stubs
|
|
endif
|
|
|
|
#-----------------------------------------------------------------------------#
|
|
|
|
# Add some additional dependencies, so that Mmake knows to remake the
|
|
# slicer and dicer if one of the libraries changes.
|
|
|
|
ifeq ("$(filter csharp% java% erlang%,$(GRADE))","")
|
|
mslice: $(RUNTIME_DIR)/lib$(RT_LIB_NAME).$A
|
|
mslice: $(LIBRARY_DIR)/lib$(STD_LIB_NAME).$A
|
|
mslice: $(BROWSER_DIR)/lib$(BROWSER_LIB_NAME).$A
|
|
mdice: $(RUNTIME_DIR)/lib$(RT_LIB_NAME).$A
|
|
mdice: $(LIBRARY_DIR)/lib$(STD_LIB_NAME).$A
|
|
mdice: $(BROWSER_DIR)/lib$(BROWSER_LIB_NAME).$A
|
|
# XXX Should also depend on $(BOEHM_GC_DIR)/libgc(_prof).$A, but only
|
|
# if in .gc(.prof) grade.
|
|
mtc_union: $(RUNTIME_DIR)/lib$(RT_LIB_NAME).$A
|
|
mtc_union: $(LIBRARY_DIR)/lib$(STD_LIB_NAME).$A
|
|
mtc_union: $(BROWSER_DIR)/lib$(BROWSER_LIB_NAME).$A
|
|
mcov: $(RUNTIME_DIR)/lib$(RT_LIB_NAME).$A
|
|
mcov: $(LIBRARY_DIR)/lib$(STD_LIB_NAME).$A
|
|
mcov: $(BROWSER_DIR)/lib$(BROWSER_LIB_NAME).$A
|
|
mtc_diff: $(RUNTIME_DIR)/lib$(RT_LIB_NAME).$A
|
|
mtc_diff: $(LIBRARY_DIR)/lib$(STD_LIB_NAME).$A
|
|
mtc_diff: $(BROWSER_DIR)/lib$(BROWSER_LIB_NAME).$A
|
|
endif
|
|
|
|
$(cs_subdir)mslice_init.c: $(UTIL_DIR)/mkinit$(EXT_FOR_EXE)
|
|
$(cs_subdir)mdice_init.c: $(UTIL_DIR)/mkinit$(EXT_FOR_EXE)
|
|
$(cs_subdir)mtc_union.c: $(UTIL_DIR)/mkinit$(EXT_FOR_EXE)
|
|
$(cs_subdir)mcov.c: $(UTIL_DIR)/mkinit$(EXT_FOR_EXE)
|
|
$(cs_subdir)mtc_diff.c: $(UTIL_DIR)/mkinit$(EXT_FOR_EXE)
|
|
|
|
#-----------------------------------------------------------------------------#
|
|
|
|
.PHONY: check
|
|
check: $(CHECKS)
|
|
|
|
.PHONY: ints
|
|
ints: $(INTS)
|
|
|
|
#-----------------------------------------------------------------------------#
|
|
|
|
tags: .slice_tags
|
|
|
|
.slice_tags: $(MTAGS) $(mslice.ms) $(mdice.ms) $(mtc_union.ms) $(mcov.ms) \
|
|
$(mtc_diff.ms) $(wildcard $(LIBRARY_DIR)/*.m)
|
|
$(MTAGS) $(mslice.ms) $(mdice.ms) $(mtc_union.ms) $(mcov.ms) \
|
|
$(mtc_diff.ms) $(LIBRARY_DIR)/*.m
|
|
@touch .slice_tags
|
|
|
|
.PHONY: tags_file_exists
|
|
tags_file_exists:
|
|
@if test ! -f tags; then \
|
|
echo making tags; \
|
|
$(MTAGS) $(mslice.ms) $(mdice.ms) $(mtc_union.ms) \
|
|
$(mcov.ms) $(mtc_union.ms) $(LIBRARY_DIR)/*.m; \
|
|
touch .slice_tags; \
|
|
fi
|
|
|
|
#-----------------------------------------------------------------------------#
|
|
|
|
.PHONY: dates
|
|
dates:
|
|
touch $(mslice.dates) $(mdice.dates) $(mtc_union.dates) \
|
|
$(mcov.dates) $(mtc_diff.ms)
|
|
|
|
#-----------------------------------------------------------------------------#
|
|
|
|
.PHONY: os cs ls
|
|
os: $(mslice.os) $(mdice.os) $(mtc_union.os) \
|
|
$(os_subdir)mslice_init.o $(os_subdir)mdice_init.o \
|
|
$(os_subdir)mtc_union.o $(os_subdir)mcov.o \
|
|
$(os_subdir)mtc_diff.o
|
|
cs: $(mslice.cs) $(mdice.cs) $(mtc_union.cs) \
|
|
$(cs_subdir)mslice_init.c $(cs_subdir)mdice_init.c \
|
|
$(cs_subdir)mtc_union.c $(cs_subdir)mcov.c \
|
|
$(cs_subdir)mtc_diff.c
|
|
|
|
#-----------------------------------------------------------------------------#
|
|
|
|
realclean_local:
|
|
rm -f tags SLICE_FLAGS SLICE_FLAGS.date \
|
|
.mdbcomp_modules $(MDBCOMP_MODULES) mdbcomp.*.err
|
|
rm -f $(PDBS) vc*.pdb
|
|
|
|
#-----------------------------------------------------------------------------#
|
|
|
|
# Installation targets
|
|
|
|
.PHONY: install
|
|
install: install_slicer
|
|
|
|
.PHONY: install_slicer
|
|
install_slicer: mslice mdice mtc_union mcov mtc_diff
|
|
-[ -d $(INSTALL_MERC_BIN_DIR) ] || mkdir -p $(INSTALL_MERC_BIN_DIR)
|
|
cp `vpath_find mslice$(EXT_FOR_EXE)` \
|
|
$(INSTALL_MERC_BIN_DIR)/mslice$(EXT_FOR_EXE)
|
|
cp `vpath_find mdice$(EXT_FOR_EXE)` \
|
|
$(INSTALL_MERC_BIN_DIR)/mdice$(EXT_FOR_EXE)
|
|
cp `vpath_find mtc_union$(EXT_FOR_EXE)` \
|
|
$(INSTALL_MERC_BIN_DIR)/mtc_union$(EXT_FOR_EXE)
|
|
cp `vpath_find mcov$(EXT_FOR_EXE)` \
|
|
$(INSTALL_MERC_BIN_DIR)/mcov$(EXT_FOR_EXE)
|
|
cp `vpath_find mtc_diff$(EXT_FOR_EXE)` \
|
|
$(INSTALL_MERC_BIN_DIR)/mtc_diff$(EXT_FOR_EXE)
|
|
ifeq ($(findstring java,$(GRADE)),java)
|
|
cp `vpath_find mcov.jar` $(INSTALL_MERC_BIN_DIR)
|
|
cp `vpath_find mdice.jar` $(INSTALL_MERC_BIN_DIR)
|
|
cp `vpath_find mslice.jar` $(INSTALL_MERC_BIN_DIR)
|
|
cp `vpath_find mtc_diff.jar` $(INSTALL_MERC_BIN_DIR)
|
|
cp `vpath_find mtc_union.jar` $(INSTALL_MERC_BIN_DIR)
|
|
endif
|
|
|
|
#-----------------------------------------------------------------------------#
|
|
|
|
.PHONY: uninstall
|
|
uninstall:
|
|
-rm -f $(INSTALL_MERC_BIN_DIR)/mslice$(EXT_FOR_EXE)
|
|
-rm -f $(INSTALL_MERC_BIN_DIR)/mdice$(EXT_FOR_EXE)
|
|
-rm -f $(INSTALL_MERC_BIN_DIR)/mtc_union$(EXT_FOR_EXE)
|
|
-rm -f $(INSTALL_MERC_BIN_DIR)/mcov$(EXT_FOR_EXE)
|
|
-rm -f $(INSTALL_MERC_BIN_DIR)/mtc_diff$(EXT_FOR_EXE)
|
|
|
|
#-----------------------------------------------------------------------------#
|