Permalink
Switch branches/tags
version-14_01_1 version-14_01 version-13_05_2 version-13_05_1 version-13_05 version-12_08-branchpoint version-12_08-GIT version-11_07_2 version-11_07_1 version-11_07 version-11_07-branchpoint version-11_01 version-11_01-branchpoint version-10_04_2 version-10_04_1 version-10_04 version-10_04-branchpoint version-0_13_1 version-0_13-branchpoint version-0_12_2 version-0_12_1 version-0_12-branchpoint version-0_11_0 version-0_11-branchpoint version-0_10 version-0_9_1 version-0_9 version-0_9_x-snapshot version-0_9_x-snapshot-19991220 unstable-version-0_13_1-x86_64-unknown-linux-gnu-libc2_3 unstable-version-0_13_1-i686-pc-linux-libc2_3-gnu-O5-intermod unstable-version-0_13-branch-x86_64-unknown-linux-gnu-libc2_3 unstable-version-0_13-branch-i686-pc-linux-libc2_3-gnu-O5-intermod unstable-version-0_12_2-i686-pc-linux-libc2_2-gnu-O5-intermod unstable-version-0_12_2-i386-pc-solaris2_8 unstable-version-0_12_1-i686-pc-linux-libc2_3-gnu-O4-intermod unstable-version-0_12_1-i686-pc-linux-libc2_3-gnu-O2 unstable-version-0_12_1-i686-pc-linux-libc2_2-gnu-O5-intermod unstable-version-0_12_1-i386-pc-solaris2_8 unstable-version-0_12-branch-i686-pc-linux-libc2_3-gnu-O5 unstable-version-0_12-branch-i686-pc-linux-libc2_3-gnu-O4-intermod unstable-version-0_12-branch-i686-pc-linux-libc2_3-gnu-O4-hlc unstable-version-0_12-branch-i686-pc-linux-libc2_3-gnu-O2 unstable-version-0_12-branch-i686-pc-linux-libc2_2-gnu-O5 unstable-version-0_12-branch-i686-pc-linux-libc2_2-gnu-O5-intermod unstable-version-0_12-branch-i686-pc-linux-libc2_2-gnu-O3 unstable-version-0_12-branch-i386-pc-solaris2_8 unstable-version-0_11_0-sparc-sun-solaris2_7 unstable-version-0_11_0-i686-pc-linux-libc2_3-gnu-O5-intermod unstable-version-0_11_0-i686-pc-linux-libc2_2-gnu-O5 unstable-version-0_11_0-i686-pc-linux-libc2_2-gnu-O5-lcc unstable-version-0_11_0-i686-pc-linux-libc2_2-gnu-O5-hlc unstable-version-0_11_0-i686-pc-linux-libc2_1-gnu-O4 unstable-version-0_11_0-i686-pc-linux-libc2_1-gnu-O4-asm unstable-version-0_11_0-i686-pc-linux-libc2_1-gnu-O3 unstable-version-0_11_0-i386-pc-solaris2_8 unstable-version-0_11-branch-i686-pc-linux-libc2_3-gnu-O5-intermod unstable-version-0_11-branch-i686-pc-linux-libc2_2-gnu-O5-intermod unstable-version-0_11-branch-i686-pc-linux-libc2_2-gnu-O5-hlc unstable-version-0_11-branch-i686-pc-linux-libc2_1-gnu-O5 unstable-version-0_11-branch-i686-pc-linux-libc2_1-gnu-O5-lcc unstable-version-0_11-branch-i686-pc-linux-libc2_1-gnu-O5-intermod unstable-version-0_11-branch-i686-pc-linux-libc2_1-gnu-O5-hlc unstable-version-0_11-branch-alpha-dec-osf5_1 unstable-version-0_10_y-sparc-sun-solaris2_7 unstable-version-0_10_y-i686-pc-linux-libc2_1-gnu-O5 unstable-version-0_10_y-i686-pc-linux-libc2_1-gnu-O5-lcc unstable-version-0_10_y-i686-pc-linux-libc2_1-gnu-O5-intermod unstable-version-0_10_y-i686-pc-linux-libc2_1-gnu-O5-hlc unstable-version-0_10_y-i686-pc-linux-libc2_1-gnu-O4 unstable-version-0_10_y-i686-pc-linux-libc2_1-gnu-O4-hlc unstable-version-0_10_y-i686-pc-linux-libc2_1-gnu-O2 unstable-version-0_10_y-i586-pc-linux-libc2_1-gnu-O0 unstable-version-0_10_y-alpha-dec-osf5_1 unstable-version-0_10_y-alpha-dec-osf3_2 unstable-version-0_10_x-sparc-sun-solaris2_7 unstable-version-0_10_x-i686-pc-linux-libc2_1-gnu-O5 unstable-version-0_10_x-i686-pc-linux-libc2_1-gnu-O5-lcc unstable-version-0_10_x-i686-pc-linux-libc2_1-gnu-O4 unstable-version-0_10_x-i686-pc-linux-libc2_1-gnu-O4-hlc unstable-version-0_10_x-i686-pc-linux-libc2_1-gnu-O3 unstable-version-0_10_x-i686-pc-linux-libc2_1-gnu-O2 unstable-version-0_10_x-i586-pc-linux-libc2_1-gnu-O0 unstable-version-0_10_x-alpha-dec-osf3_2 termination2_trunk stable-version-0_11_0-i686-pc-linux-libc2_3-gnu-O5-intermod stable-version-0_11_0-i686-pc-linux-libc2_2-gnu-O5 stable-version-0_11_0-i686-pc-linux-libc2_2-gnu-O5-lcc stable-version-0_11_0-i686-pc-linux-libc2_2-gnu-O5-hlc stable-version-0_11_0-i686-pc-linux-libc2_1-gnu-O4 stable-version-0_11_0-i686-pc-linux-libc2_1-gnu-O4-asm stable-version-0_11_0-i686-pc-linux-libc2_1-gnu-O3 stable-version-0_11-branch-i686-pc-linux-libc2_3-gnu-O5-intermod stable-version-0_11-branch-i686-pc-linux-libc2_2-gnu-O5-lcc stable-version-0_11-branch-i686-pc-linux-libc2_2-gnu-O5-intermod stable-version-0_11-branch-i686-pc-linux-libc2_1-gnu-O5 stable-version-0_11-branch-i686-pc-linux-libc2_1-gnu-O5-lcc stable-version-0_11-branch-i686-pc-linux-libc2_1-gnu-O5-intermod stable-version-0_11-branch-i686-pc-linux-libc2_1-gnu-O5-hlc stable-version-0_11-branch-alpha-dec-osf5_1
Nothing to show
Find file
Fetching contributors…
Cannot retrieve contributors at this time
347 lines (286 sloc) 12.6 KB
#-----------------------------------------------------------------------------#
# vim: ts=8 sw=8 noexpandtab
#-----------------------------------------------------------------------------#
# Copyright (C) 1995-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.
#-----------------------------------------------------------------------------#
# This is the Mmakefile for building the Mercury deep profiler.
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.deep.params
# Override the default rule in `mmake --use-mmc-make' that asks `mmc' to
# create a missing optional params file.
Mmake.deep.params:
# Module-specific options should go in Mercury.options so they
# can be found by `mmc --make'.
include Mercury.options
MAIN_TARGET = all
ALL_DEEP_MAIN_MODULES = \
mdprof_cgi \
mdprof_test \
mdprof_dump \
mdprof_create_feedback \
mdprof_report_feedback \
mdprof_procrep
# Always compile the deep profiler, even if it is not enabled.
#
MAIN_TARGET=all
MERCURY_MAIN_MODULES=$(ALL_DEEP_MAIN_MODULES)
DEPEND=$(patsubst %,%.depend,$(ALL_DEEP_MAIN_MODULES))
PDBS=$(patsubst %,%.pdb,$(ALL_DEEP_MAIN_MODULES))
ifeq ("$(ENABLE_DEEP_PROFILER)","yes")
INSTALL=install_cgi_progs
else
INSTALL=nothing
endif
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 DEEP_FLAGS $(CONFIG_OVERRIDE)
#-----------------------------------------------------------------------------#
# Tell the C# compiler where the stdlib assembly is.
#
ifneq ("$(filter csharp%,$(GRADE))","")
CSCFLAGS=-lib:../library -r:mer_std.dll
endif
#-----------------------------------------------------------------------------#
ifneq ("$(filter csharp% java% erlang%,$(GRADE))","")
MLOBJS =
endif
#-----------------------------------------------------------------------------#
# The deep profiler contains quite a lot of C code for which there are
# currently not C#, Java or Erlang implementations. We need to pass
# `--allow-stubs' in order to compile it.
#
ifneq ("$(filter csharp% java% erlang%,$(GRADE))","")
MCFLAGS += --allow-stubs --no-warn-stubs
endif
#-----------------------------------------------------------------------------#
.PHONY: nothing
nothing:
.PHONY: depend
depend: $(MDBCOMP_MODULES) $(DEPEND)
$(DEPEND): DEEP_FLAGS $(MDBCOMP_MODULES) Mercury.modules
# This directory contains source files for which the module
# name doesn't match the file name, so smart recompilation
# won't work without the Mercury.modules file.
.PHONY: Mercury.modules
Mercury.modules: DEEP_FLAGS
$(MC) $(ALL_GRADEFLAGS) $(ALL_MCFLAGS) -f *.m
.PHONY: all
all: $(MDBCOMP_MODULES) $(ALL_DEEP_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 $*
#-----------------------------------------------------------------------------#
# Add some additional dependencies, so that Mmake knows to remake the
# profiler if one of the libraries changes.
ifeq ("$(filter csharp% java% erlang%,$(GRADE))","")
mdprof_cgi: $(RUNTIME_DIR)/lib$(RT_LIB_NAME).$A
mdprof_cgi: $(LIBRARY_DIR)/lib$(STD_LIB_NAME).$A
mdprof_test: $(RUNTIME_DIR)/lib$(RT_LIB_NAME).$A
mdprof_test: $(LIBRARY_DIR)/lib$(STD_LIB_NAME).$A
mdprof_dump: $(RUNTIME_DIR)/lib$(RT_LIB_NAME).$A
mdprof_dump: $(LIBRARY_DIR)/lib$(STD_LIB_NAME).$A
mdprof_create_feedback: $(RUNTIME_DIR)/lib$(RT_LIB_NAME).$A
mdprof_create_feedback: $(LIBRARY_DIR)/lib$(STD_LIB_NAME).$A
mdprof_report_feedback: $(RUNTIME_DIR)/lib$(RT_LIB_NAME).$A
mdprof_report_feedback: $(LIBRARY_DIR)/lib$(STD_LIB_NAME).$A
mdprof_procrep: $(RUNTIME_DIR)/lib$(RT_LIB_NAME).$A
mdprof_procrep: $(LIBRARY_DIR)/lib$(STD_LIB_NAME).$A
# XXX Should also depend on $(BOEHM_GC_DIR)/libgc(_prof).$A, but only
# if in .gc(.prof) grade.
endif
$(cs_subdir)mdprof_cgi_init.c: $(UTIL_DIR)/mkinit$(EXT_FOR_EXE)
$(cs_subdir)mdprof_test_init.c: $(UTIL_DIR)/mkinit$(EXT_FOR_EXE)
$(cs_subdir)mdprof_dump_init.c: $(UTIL_DIR)/mkinit$(EXT_FOR_EXE)
$(cs_subdir)mdprof_create_feedback_init.c: $(UTIL_DIR)/mkinit$(EXT_FOR_EXE)
$(cs_subdir)mdprof_report_feedback_init.c: $(UTIL_DIR)/mkinit$(EXT_FOR_EXE)
$(cs_subdir)mdprof_procrep_init.c: $(UTIL_DIR)/mkinit$(EXT_FOR_EXE)
#-----------------------------------------------------------------------------#
.PHONY: check
check: DEPEND=$(patsubst %,%.check,$(ALL_DEEP_MAIN_MODULES))
.PHONY: ints
ints: DEPEND=$(patsubst %,%.ints,$(ALL_DEEP_MAIN_MODULES))
#-----------------------------------------------------------------------------#
# We need the shenanigans with .deep_tags to avoid situations in which an
# "mmake tags" in this directory does nothing even in the absence of a tags
# file in this directory, because mmake uses VPATH to find ../library/tags
# and believes it to be the tags file we are asking for.
.PHONY: tags
tags: .deep_tags
DEEP_MS = \
$(mdprof_cgi.ms) \
$(mdprof_test.ms) \
$(mdprof_dump.ms) \
$(mdprof_create_feedback.ms) \
$(mdprof_report_feedback.ms) \
$(mdprof_procrep.ms)
.deep_tags: $(MTAGS) $(DEEP_MS) \
$(wildcard $(MDBCOMP_DIR)/*.m) \
$(wildcard $(LIBRARY_DIR)/*.m)
$(MTAGS) $(DEEP_MS) $(MDBCOMP_DIR)/*.m $(LIBRARY_DIR)/*.m
@touch .deep_tags
.PHONY: tags_file_exists
tags_file_exists:
@if test ! -f tags; then \
echo making tags; \
$(MTAGS) $(DEEP_MS) $(MDBCOMP_DIR)/*.m $(LIBRARY_DIR)/*.m; \
touch .deep_tags; \
fi
#-----------------------------------------------------------------------------#
.PHONY: dates
dates:
touch $(mdprof_cgi.dates) \
$(mdprof_test.dates) \
$(mdprof_dump.dates) \
$(mdprof_create_feedback.dates) \
$(mdprof_report_feedback.dates) \
$(mdprof_procrep.dates)
#-----------------------------------------------------------------------------#
.PHONY: os cs css javas
os: $(mdprof_cgi.os) $(os_subdir)mdprof_cgi_init.o
os: $(mdprof_test.os) $(os_subdir)mdprof_test_init.o
os: $(mdprof_dump.os) $(os_subdir)mdprof_dump_init.o
os: $(mdprof_create_feedback.os) $(os_subdir)mdprof_create_feedback_init.o
os: $(mdprof_report_feedback.os) $(os_subdir)mdprof_report_feedback_init.o
os: $(mdprof_procrep.os) $(os_subdir)mdprof_procrep_init.o
cs: $(mdprof_cgi.cs) $(cs_subdir)mdprof_cgi_init.c
cs: $(mdprof_test.cs) $(cs_subdir)mdprof_test_init.c
cs: $(mdprof_dump.cs) $(cs_subdir)mdprof_dump_init.c
cs: $(mdprof_create_feedback.cs) $(cs_subdir)mdprof_create_feedback_init.c
cs: $(mdprof_report_feedback.cs) $(cs_subdir)mdprof_report_feedback_init.c
cs: $(mdprof_procrep.cs) $(cs_subdir)mdprof_procrep_init.c
css: $(mdprof_cgi.css)
css: $(mdprof_test.css)
css: $(mdprof_dump.css)
css: $(mdprof_create_feedback.css)
css: $(mdprof_report_feedback.css)
css: $(mdprof_procrep.css)
javas: $(mdprof_cgi.javas)
javas: $(mdprof_test.javas)
javas: $(mdprof_dump.javas)
javas: $(mdprof_create_feedback.javas)
javas: $(mdprof_report_feedback.javas)
javas: $(mdprof_procrep.javas)
#-----------------------------------------------------------------------------#
realclean_local:
rm -f .deep_tags tags DEEP_FLAGS DEEP_FLAGS.date \
.mdbcomp_modules $(MDBCOMP_MODULES) mdbcomp.*.err
rm -f $(PDBS) vc*.pdb
#-----------------------------------------------------------------------------#
# Installation targets
.PHONY: install
install: $(INSTALL)
# We don't install mdprof_test, since it is not for users.
# The code of the install_cgi_progs target is duplicated in
# bindist/bindist.Makefile.in, though the two rules refer to mdprof_cgi
# by different paths.
.PHONY: install_cgi_progs
install_cgi_progs: mdprof_cgi mdprof_dump mdprof_test \
mdprof_create_feedback mdprof_report_feedback
# $(INSTALL_CGI_DIR) is likely to be writeable only by root or
# the www system administrator, which is why we don't consider a
# failure of this action to be an error. If the command fails,
# the install action in ../Mmakefile will remind the user to do
# the copy later.
#
# The mv before the cp is there in case the executable is being
# executed when we do the install. The mv is of course expected to
# fail during a first-time installation. The rm is before the move
# in case this is the third or later installation.
-if test $(ENABLE_DEEP_PROFILER) = yes ; then \
if test -w $(INSTALL_CGI_DIR) ; then \
rm -f $(INSTALL_CGI_DIR)/mdprof_cgi.was ; \
mv -f $(INSTALL_CGI_DIR)/mdprof_cgi \
$(INSTALL_CGI_DIR)/mdprof_cgi.was ; \
cp mdprof_cgi $(INSTALL_CGI_DIR) ; \
else \
echo "cannot install mdprof_cgi: " \
"$(INSTALL_CGI_DIR) is not writeable"; \
fi \
fi
# We also install mdprof_cgi in $(INSTALL_MERC_BIN_DIR).
# This is done just so that it can easily get put in the binary
# distribution (even if the step above failed). It is useful for
# mdprof_test and mdprof_dump to be available when debugging problems
# with the deep profiler, so we install them as well.
-[ -d $(INSTALL_MERC_BIN_DIR) ] || mkdir -p $(INSTALL_MERC_BIN_DIR)
cp `vpath_find mdprof_cgi$(EXT_FOR_EXE)` \
$(INSTALL_MERC_BIN_DIR)/mdprof_cgi$(EXT_FOR_EXE)
cp `vpath_find mdprof_test$(EXT_FOR_EXE)` \
$(INSTALL_MERC_BIN_DIR)/mdprof_test$(EXT_FOR_EXE)
cp `vpath_find mdprof_dump$(EXT_FOR_EXE)` \
$(INSTALL_MERC_BIN_DIR)/mdprof_dump$(EXT_FOR_EXE)
cp `vpath_find mdprof_create_feedback$(EXT_FOR_EXE)` \
$(INSTALL_MERC_BIN_DIR)/mdprof_create_feedback$(EXT_FOR_EXE)
cp `vpath_find mdprof_report_feedback$(EXT_FOR_EXE)` \
$(INSTALL_MERC_BIN_DIR)/mdprof_report_feedback$(EXT_FOR_EXE)
ifeq ($(findstring java,$(GRADE)),java)
cp `vpath_find mdprof_cgi.jar` $(INSTALL_MERC_BIN_DIR)
cp `vpath_find mdprof_create_feedback.jar` $(INSTALL_MERC_BIN_DIR)
cp `vpath_find mdprof_dump.jar` $(INSTALL_MERC_BIN_DIR)
cp `vpath_find mdprof_procrep.jar` $(INSTALL_MERC_BIN_DIR)
cp `vpath_find mdprof_report_feedback.jar` $(INSTALL_MERC_BIN_DIR)
cp `vpath_find mdprof_test.jar` $(INSTALL_MERC_BIN_DIR)
endif
#-----------------------------------------------------------------------------#
.PHONY: uninstall
uninstall:
# We try to uninstall mdprof_cgi, but failure to do so is not an
# error for two reasons: because we may simply lack permission to
# update the directory, and because the deep profiler installation
# may not have been enabled in the first place. (Looking at the current
# value of $(ENABLE_DEEP_PROFILER) to check for the latter wouldn't
# necessarily do any good, since its setting may have changed since
# the original install.)
-rm -f $(INSTALL_CGI_DIR)/mdprof_cgi$(EXT_FOR_EXE)
-rm -f $(INSTALL_MERC_BIN_DIR)/mdprof_cgi$(EXT_FOR_EXE)
-rm -f $(INSTALL_MERC_BIN_DIR)/mdprof_test$(EXT_FOR_EXE)
-rm -f $(INSTALL_MERC_BIN_DIR)/mdprof_dump$(EXT_FOR_EXE)
-rm -f $(INSTALL_MERC_BIN_DIR)/mdprof_create_feedback$(EXT_FOR_EXE)
-rm -f $(INSTALL_MERC_BIN_DIR)/mdprof_report_feedback$(EXT_FOR_EXE)
-rm -f $(INSTALL_MERC_BIN_DIR)/mdprof_procrep$(EXT_FOR_EXE)
#-----------------------------------------------------------------------------#