Factor out the common Mmake code to set up the mmc, mgnuc

Estimated hours taken: 8
Branches: main

Factor out the common Mmake code to set up the mmc, mgnuc
and ml flags when building the Mercury compiler and libraries.
Use options, not environment variables. This will make it simpler
to use `mmc --make' to compile the compiler.

Mmake.workspace:
	Similar to tools/lmc. Sets up Mmake variables to
	use the library files in a workspace rather than
	an installed library.

configure.in:
	Check for the `--no-mercury-stdlib-dir' mmc option.
	Bootstrap CVS tag: bootstrap_20020429_stdlib_dir

Mmake.common.in:
*/Mmakefile:
	Move common code into Mmake.workspace.

browser/Mmakefile:
library/Mmakefile:
	Avoid invoking the linker explicitly when creating
	libraries of Mercury code. That won't work well
	with `mmc --make'.

tools/bootcheck:
tests/Mmake.common:
	Use Mmake.workspace instead of setting up environment
	variables in bootcheck.

scripts/Mmake.vars.in:
	mmc compiles split C files to object code itself,
	so pass `--cflags "$(ALL_CFLAGS)"' to mmc when
	compiling with `--split-c-files'.

browser/interactive_query.m:
	Use `mmc --make' when compiling the query. This is needed
	to make tests/debugger/interactive_query.m work when linking
	against a workspace using options rather than environment
	variables.  This also fixes a bug -- mmc options were being
	passed to ml.

	Clean up after the query.

tests/debugger/Mmakefile:
tests/debugger/interactive.inp:
tests/debugger/interactive.inp.subdirs:
tests/debugger/interactive.inp.nosubdirs:
tests/debugger/interactive.exp:
tests/debugger/interactive.exp2:
	Generate the input file to this test so that MCFLAGS
	and MC_MAKE_FLAGS (from Mmake.workspace) are used when
	compiling queries.

	tests/debugger/Mmakefile now sets SHELL to /usr/local/bash
	to allow the use of $(...) style command substitution
	(`...` style command substitution can't be nested).

tests/warnings/Mmakefile:
tests/dppd/Mmakefile:
	Include tests/Mmake.common.

tools/*:
scripts/c2init.in:
scripts/ml.in:
	Update the lists of files containing the library names.
This commit is contained in:
Simon Taylor
2002-04-29 08:22:08 +00:00
parent 95d7c88d3c
commit 5d693f5a1c
29 changed files with 329 additions and 507 deletions

View File

@@ -19,12 +19,15 @@
include $(MERCURY_DIR)/VERSION include $(MERCURY_DIR)/VERSION
WORKSPACE=$(MERCURY_DIR)
include $(MERCURY_DIR)/Mmake.workspace
#-----------------------------------------------------------------------------# #-----------------------------------------------------------------------------#
# Specify the Mercury compiler to use for bootstrapping # Specify the Mercury compiler to use for bootstrapping.
MC = @BOOTSTRAP_MC@ MC = @BOOTSTRAP_MC@
# Specify the compilation model to use for compiling the compiler # Specify the compilation model to use for compiling the compiler.
GRADE = @GRADE@ GRADE = @GRADE@
# Specify EXT_FOR_EXE is `.exe' on MS-Windows and empty elsewhere. # Specify EXT_FOR_EXE is `.exe' on MS-Windows and empty elsewhere.
@@ -36,7 +39,7 @@ EXT_FOR_EXE = @EXT_FOR_EXE@
# or as `a' if it doesn't. # or as `a' if it doesn't.
EXT_FOR_SHARED_LIB = @EXT_FOR_SHARED_LIB@ EXT_FOR_SHARED_LIB = @EXT_FOR_SHARED_LIB@
# Specify USE_DLLs as `yes' if the OS supports Windows-style DLLs # Specify USE_DLLs as `yes' if the OS supports Windows-style DLLs.
USE_DLLS = @USE_DLLS@ USE_DLLS = @USE_DLLS@
# Specify any special flags to pass to the C compiler when creating objects # Specify any special flags to pass to the C compiler when creating objects
@@ -113,15 +116,6 @@ SHARED_LIBS = @SHARED_LIBS@
INSTALL_MERC_GC_LIB_DIR = $(INSTALL_MERC_GRADELESS_LIB_DIR) INSTALL_MERC_GC_LIB_DIR = $(INSTALL_MERC_GRADELESS_LIB_DIR)
FINAL_INSTALL_MERC_GC_LIB_DIR = $(FINAL_INSTALL_MERC_GRADELESS_LIB_DIR) FINAL_INSTALL_MERC_GC_LIB_DIR = $(FINAL_INSTALL_MERC_GRADELESS_LIB_DIR)
SCRIPTS_DIR = $(MERCURY_DIR)/scripts
RUNTIME_DIR = $(MERCURY_DIR)/runtime
LIBRARY_DIR = $(MERCURY_DIR)/library
TRACE_DIR = $(MERCURY_DIR)/trace
BROWSER_DIR = $(MERCURY_DIR)/browser
BOEHM_GC_DIR = $(MERCURY_DIR)/boehm_gc
COMPILER_DIR = $(MERCURY_DIR)/compiler
UTIL_DIR = $(MERCURY_DIR)/util
# By default, GRADESTRING is defined as the result of invoking # By default, GRADESTRING is defined as the result of invoking
# `mmc --output-grade-string' with $(GRADE) and $(GRADEFLAGS). # `mmc --output-grade-string' with $(GRADE) and $(GRADEFLAGS).
# But when installing the standard library, the compiler will not yet # But when installing the standard library, the compiler will not yet
@@ -133,22 +127,8 @@ UTIL_DIR = $(MERCURY_DIR)/util
# compiler itself should be done by setting GRADE, not GRADEFLAGS. # compiler itself should be done by setting GRADE, not GRADEFLAGS.
GRADESTRING = $(GRADE) GRADESTRING = $(GRADE)
# The names of the various libraries.
# The archives and shared object objects have a "lib" prefix and a ".a" or
# ".so" (or ".dll") suffix around these names; the initialization files
# have just a ".init" suffix. (The trace library does not have a .init file,
# since it contains no Mercury code.)
#
# If you change these, you will also need to change scripts/ml.in,
# scripts/c2init.in, tools/bootcheck, tools/binary, tools/binary_step
# and tools/linear.
RT_LIB_NAME = mer_rt
STD_LIB_NAME = mer_std
TRACE_LIB_NAME = mer_trace
BROWSER_LIB_NAME = mer_browser
# Options to pass to the Mercury compiler # Options to pass to the Mercury compiler
MCFLAGS = --no-infer-all --halt-at-warn --no-warn-inferred-erroneous MCFLAGS += --no-infer-all --halt-at-warn --no-warn-inferred-erroneous
# Do we want to deal with intermodule information when building the library? # Do we want to deal with intermodule information when building the library?
# By default yes, since this way we note immediately when intermodule # By default yes, since this way we note immediately when intermodule

156
Mmake.workspace Normal file
View File

@@ -0,0 +1,156 @@
#-----------------------------------------------------------------------------#
# Copyright (C) 2002 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.
#-----------------------------------------------------------------------------#
# Mmake.workspace - build a program or library using the current workspace,
# not an installed library.
#
# The variable WORKSPACE must be set externally.
#
# If the variable LINK_STATIC is set to `yes', the names of the `.a' files
# for the Mercury libraries will be included in MLLIBS, otherwise
# `-l' options will be included.
#
# Setting LINK_BOEHM_GC_ONLY to `yes' causes only the boehm_gc directory
# to be included in MLFLAGS, MLLIBS and CFLAGS.
# Setting LINK_RUNTIME_ONLY to `yes' causes only the boehm_gc and runtime
# directories to be included in MLFLAGS, MLLIBS and CFLAGS.
# Setting LINK_STDLIB_ONLY to `yes' causes only the boehm_gc, runtime
# and library directories to be included in MLFLAGS, MLLIBS and CFLAGS.
#-----------------------------------------------------------------------------#
LINK_STATIC ?= no
LINK_BOEHM_GC_ONLY ?= no
LINK_RUNTIME_ONLY ?= no
LINK_STDLIB_ONLY ?= no
SCRIPTS_DIR = $(WORKSPACE)/scripts
RUNTIME_DIR = $(WORKSPACE)/runtime
LIBRARY_DIR = $(WORKSPACE)/library
TRACE_DIR = $(WORKSPACE)/trace
BROWSER_DIR = $(WORKSPACE)/browser
BOEHM_GC_DIR = $(WORKSPACE)/boehm_gc
COMPILER_DIR = $(WORKSPACE)/compiler
UTIL_DIR = $(WORKSPACE)/util
# The names of the various libraries.
# The archives and shared object objects have a "lib" prefix and a ".a" or
# ".so" (or ".dll") suffix around these names; the initialization files
# have just a ".init" suffix. (The trace library does not have a .init file,
# since it contains no Mercury code.)
#
# If you change these, you will also need to change scripts/ml.in,
# scripts/c2init.in, tools/bootcheck, tools/binary, tools/binary_step
# and tools/linear.
RT_LIB_NAME = mer_rt
STD_LIB_NAME = mer_std
TRACE_LIB_NAME = mer_trace
BROWSER_LIB_NAME = mer_browser
MC = $(SCRIPTS_DIR)/mmc
MGNUC = $(SCRIPTS_DIR)/mgnuc
ML = $(SCRIPTS_DIR)/ml
C2INIT = MERCURY_MKINIT=$(UTIL_DIR)/mkinit $(SCRIPTS_DIR)/c2init
MTAGS = $(SCRIPTS_DIR)/mtags
MTAGSFLAGS += $(EXTRA_MTAGSFLAGS)
VPATH = $(LIBRARY_DIR)
MCFLAGS += --no-mercury-stdlib-dir -I$(LIBRARY_DIR)
MGNUCFLAGS += --no-mercury-stdlib-dir
C2INITFLAGS += --trace-init-file $(BROWSER_DIR)/$(BROWSER_LIB_NAME).init
C2INITARGS += $(LIBRARY_DIR)/$(STD_LIB_NAME).init \
$(RUNTIME_DIR)/$(RT_LIB_NAME).init
MLFLAGS += --no-mercury-stdlib-dir
#
# MC_MAKE_FLAGS contains flags to be used by `mmc --make'.
# This will also include flags to pass to ml.
#
MC_MAKE_FLAGS += --trace-init-file $(BROWSER_DIR)/$(BROWSER_LIB_NAME).init \
--init-file $(LIBRARY_DIR)/$(STD_LIB_NAME).init \
--init-file $(RUNTIME_DIR)/$(RT_LIB_NAME).init
#
# Work out the C include directories.
#
C_INCL_DIRS = -I$(BOEHM_GC_DIR) -I$(BOEHM_GC_DIR)/include
ifneq ($(LINK_BOEHM_GC_ONLY),yes)
C_INCL_DIRS += -I$(RUNTIME_DIR)
ifneq ($(LINK_RUNTIME_ONLY),yes)
C_INCL_DIRS += -I$(LIBRARY_DIR)
ifneq ($(LINK_STDLIB_ONLY),yes)
C_INCL_DIRS += -I$(BROWSER_DIR) -I$(TRACE_DIR)
endif
endif
endif
CFLAGS += $(C_INCL_DIRS)
MC_MAKE_FLAGS += $(patsubst -I%,--c-include-directory %,$(C_INCL_DIRS))
#
# Work out which libraries to link with.
#
STATIC_GC_LIBS = \
` \
case $(GRADE) in \
*.par*.gc*.prof*) echo $(BOEHM_GC_DIR)/libpar_gc_prof.$A ;; \
*.par*.gc*) echo $(BOEHM_GC_DIR)/libpar_gc.$A ;; \
*.gc*.prof*) echo $(BOEHM_GC_DIR)/libgc_prof.$A ;; \
*.gc*) echo $(BOEHM_GC_DIR)/libgc.$A ;; \
esac \
`
SHARED_GC_LIBS = \
` \
case $(GRADE) in \
*.par*.gc*.prof*) echo -lpar_gc_prof ;; \
*.par*.gc*) echo -libpar_gc ;; \
*.gc*.prof*) echo -lgc_prof ;; \
*.gc*) echo -lgc ;; \
esac \
`
ifeq ($(LINK_STATIC),yes)
STATIC_LIBS := $(STATIC_GC_LIBS)
ifneq ($(LINK_BOEHM_GC_ONLY),yes)
STATIC_LIBS := $(RUNTIME_DIR)/lib$(RT_LIB_NAME).$A $(STATIC_LIBS)
ifneq ($(LINK_RUNTIME_ONLY),yes)
STATIC_LIBS := $(LIBRARY_DIR)/lib$(STD_LIB_NAME).$A $(STATIC_LIBS)
ifneq ($(LINK_STDLIB_ONLY),yes)
STATIC_LIBS := $(TRACE_DIR)/lib$(TRACE_LIB_NAME).$A \
$(BROWSER_DIR)/lib$(BROWSER_LIB_NAME).$A $(STATIC_LIBS)
endif
endif
endif
MLLIBS += $(STATIC_LIBS)
MC_MAKE_FLAGS += $(patsubst %,--link-object %,$(STATIC_LIBS))
else # LINK_STATIC != yes
NON_STATIC_LIBS := $(SHARED_GC_LIBS)
NON_STATIC_LIB_DIRS := -L$(BOEHM_GC_DIR) -R$(BOEHM_GC_DIR)
ifneq ($(LINK_BOEHM_GC_ONLY),yes)
NON_STATIC_LIBS := -l$(RT_LIB_NAME) $(NON_STATIC_LIBS)
NON_STATIC_LIB_DIRS := -L$(RUNTIME_DIR) -R$(RUNTIME_DIR) $(NON_STATIC_LIB_DIRS)
ifneq ($(LINK_RUNTIME_ONLY),yes)
NON_STATIC_LIBS := -l$(STD_LIB_NAME) $(NON_STATIC_LIBS)
NON_STATIC_LIB_DIRS := -L$(LIBRARY_DIR) -R$(LIBRARY_DIR) $(NON_STATIC_LIB_DIRS)
ifneq ($(LINK_STDLIB_ONLY),yes)
NON_STATIC_LIBS := -l$(TRACE_LIB_NAME) -l$(BROWSER_LIB_NAME) $(NON_STATIC_LIBS)
NON_STATIC_LIB_DIRS := -L$(TRACE_DIR) -R$(TRACE_DIR) -L$(BROWSER_DIR) \
-R$(BROWSER_DIR) $(NON_STATIC_LIB_DIRS)
endif
endif
endif
MLFLAGS += $(NON_STATIC_LIB_DIRS)
MLLIBS += $(NON_STATIC_LIBS)
MC_MAKE_FLAGS += $(patsubst -R%,--link-flags -R%,$(NON_STATIC_LIB_DIRS)) \
$(NON_STATIC_LIBS)
endif # LINK_STATIC != yes

View File

@@ -19,6 +19,7 @@
#-----------------------------------------------------------------------------# #-----------------------------------------------------------------------------#
MERCURY_DIR=.. MERCURY_DIR=..
LINK_BOEHM_GC_ONLY=yes
include ../Mmake.common include ../Mmake.common
# Primary targets: # Primary targets:

View File

@@ -1,5 +1,5 @@
#-----------------------------------------------------------------------------# #-----------------------------------------------------------------------------#
# Copyright (C) 1995-2001 University of Melbourne. # Copyright (C) 1995-2002 University of Melbourne.
# This file may only be copied under the terms of the GNU General # This file may only be copied under the terms of the GNU General
# Public Licence - see the file COPYING in the Mercury distribution. # Public Licence - see the file COPYING in the Mercury distribution.
#-----------------------------------------------------------------------------# #-----------------------------------------------------------------------------#
@@ -13,6 +13,7 @@ GC_GRADE=gc
MAIN_TARGET=lib$(GC_GRADE) MAIN_TARGET=lib$(GC_GRADE)
MERCURY_DIR=.. MERCURY_DIR=..
LINK_BOEHM_GC_ONLY=yes
include $(MERCURY_DIR)/Mmake.common include $(MERCURY_DIR)/Mmake.common
#-----------------------------------------------------------------------------# #-----------------------------------------------------------------------------#

View File

@@ -1,5 +1,5 @@
#-----------------------------------------------------------------------------# #-----------------------------------------------------------------------------#
# Copyright (C) 1998-2001 The University of Melbourne. # Copyright (C) 1998-2002 The University of Melbourne.
# This file may only be copied under the terms of the GNU General # This file may only be copied under the terms of the GNU General
# Public License - see the file COPYING in the Mercury distribution. # Public License - see the file COPYING in the Mercury distribution.
#-----------------------------------------------------------------------------# #-----------------------------------------------------------------------------#
@@ -16,46 +16,22 @@
# compile the modules in this directory in debug grades as well. # compile the modules in this directory in debug grades as well.
MERCURY_DIR=.. MERCURY_DIR=..
LINK_STDLIB_ONLY=yes
include $(MERCURY_DIR)/Mmake.common include $(MERCURY_DIR)/Mmake.common
MAIN_TARGET=library MAIN_TARGET=library
VPATH=$(LIBRARY_DIR)
#-----------------------------------------------------------------------------# #-----------------------------------------------------------------------------#
# Specify which compilers to use to compile the library. # Specify which compilers to use to compile the library.
# Don't change these without good reason - if you want to # Don't change these without good reason - if you want to
# do a temporary change, change ../Mmake.params. # do a temporary change, change ../Mmake.params.
M_ENV = MERCURY_INT_DIR=$(LIBRARY_DIR) \ CFLAGS += $(DLL_CFLAGS) -I$(TRACE_DIR)
MERCURY_ALL_C_INCL_DIRS="\ MLFLAGS += -R$(FINAL_INSTALL_MERC_LIB_DIR) \
-I$(TRACE_DIR) \ -R$(FINAL_INSTALL_MERC_GC_LIB_DIR)
-I$(LIBRARY_DIR) \ MLLIBS += $(SOCKET_LIBRARY) $(NSL_LIBRARY) $(DL_LIBRARY) \
-I$(RUNTIME_DIR) \ $(READLINE_LIBRARIES)
-I$(BOEHM_GC_DIR) \
-I$(BOEHM_GC_DIR)/include \
"
MCD = $(M_ENV) $(MC) --generate-dependencies
MCI = $(M_ENV) $(MC) --make-interface
MCPI = $(M_ENV) $(MC) --make-private-interface
MCSI = $(M_ENV) $(MC) --make-short-interface
MCOI = $(M_ENV) $(MC) --make-opt-int
MCTOI = $(M_ENV) $(MC) --make-trans-opt
MCG = $(M_ENV) $(MC) --compile-to-c
MCS = $(M_ENV) $(MC) --split-c-files -c --cflags "$(ALL_CFLAGS)"
MGNUC = $(M_ENV) $(SCRIPTS_DIR)/mgnuc
MGNUCFLAGS = $(DLL_CFLAGS)
LDFLAGS = -L$(LIBRARY_DIR) -L$(RUNTIME_DIR) -L$(BOEHM_GC_DIR)
LDLIBS = -l$(STD_LIB_NAME) -l$(RT_LIB_NAME) \
` case "$(GRADE)" in \
*.par*.gc*.prof*) echo "-lpar_gc_prof" ;; \
*.par*.gc*) echo "-lpar_gc" ;; \
*.gc*.prof*) echo "-lgc_prof" ;; \
*.gc*) echo "-lgc" ;; \
esac \
`
# XXX Smart recompilation currently doesn't work when the module # XXX Smart recompilation currently doesn't work when the module
# name doesn't match the file name, so disable warnings about it # name doesn't match the file name, so disable warnings about it
@@ -68,6 +44,8 @@ MCFLAGS-mdb.declarative_user = --no-deforestation
MTAGS = $(SCRIPTS_DIR)/mtags MTAGS = $(SCRIPTS_DIR)/mtags
LN = ln
#-----------------------------------------------------------------------------# #-----------------------------------------------------------------------------#
# Stuff for Windows DLLS using gnu-win32 # Stuff for Windows DLLS using gnu-win32
@@ -135,25 +113,13 @@ ss: $(mdb.ss)
library: lib$(BROWSER_LIB_NAME).$A lib$(BROWSER_LIB_NAME).$(EXT_FOR_SHARED_LIB) library: lib$(BROWSER_LIB_NAME).$A lib$(BROWSER_LIB_NAME).$(EXT_FOR_SHARED_LIB)
library: $(BROWSER_LIB_NAME).init library: $(BROWSER_LIB_NAME).init
lib$(BROWSER_LIB_NAME)$(DLL_DEF_LIB).$A : $(mdb.os) lib$(BROWSER_LIB_NAME)$(DLL_DEF_LIB).$A : libmdb.$A
rm -f lib$(BROWSER_LIB_NAME)$(DLL_DEF_LIB).$A rm -f lib$(BROWSER_LIB_NAME)$(DLL_DEF_LIB).$A
$(AR) $(ALL_ARFLAGS) \ $(LN) libmdb.$A lib$(BROWSER_LIB_NAME)$(DLL_DEF_LIB).$A
$(AR_LIBFILE_OPT)lib$(BROWSER_LIB_NAME)$(DLL_DEF_LIB).$A \
$(mdb.os)
$(RANLIB) lib$(BROWSER_LIB_NAME)$(DLL_DEF_LIB).$A
RPATH_1=$(SHLIB_RPATH_OPT)$(FINAL_INSTALL_MERC_LIB_DIR) lib$(BROWSER_LIB_NAME).so : libmdb.so
RPATH_2=$(SHLIB_RPATH_SEP)$(FINAL_INSTALL_MERC_GC_LIB_DIR) rm -f lib$(BROWSER_LIB_NAME)$(DLL_DEF_LIB).so
$(LN) libmdb.so lib$(BROWSER_LIB_NAME)$(DLL_DEF_LIB).so
lib$(BROWSER_LIB_NAME).so : $(mdb.pic_os)
$(LINK_SHARED_OBJ) $(ERROR_UNDEFINED) \
-o lib$(BROWSER_LIB_NAME).so \
$(mdb.pic_os) \
$(RPATH_1)$(RPATH_2) \
$(LDFLAGS) $(LDLIBS) \
$(SOCKET_LIBRARY) $(NSL_LIBRARY) $(DL_LIBRARY) \
$(READLINE_LIBRARIES) \
$(SHARED_LIBS)
$(BROWSER_LIB_NAME).init: $(deps_subdir)mdb.dep mdb.init $(BROWSER_LIB_NAME).init: $(deps_subdir)mdb.dep mdb.init
cp mdb.init $(BROWSER_LIB_NAME).init cp mdb.init $(BROWSER_LIB_NAME).init

View File

@@ -177,6 +177,7 @@ run_query(Options, Program) -->
else else
{ true } { true }
), ),
cleanup_query(Options),
io__set_environment_var("MERCURY_OPTIONS", MERCURY_OPTIONS) io__set_environment_var("MERCURY_OPTIONS", MERCURY_OPTIONS)
else else
print("Unable to unset MERCURY_OPTIONS environment variable") print("Unable to unset MERCURY_OPTIONS environment variable")
@@ -411,50 +412,37 @@ compile_file(Options, Succeeded) -->
% for inferring the type etc. of query/N % for inferring the type etc. of query/N
% -O0 --no-c-optimize % -O0 --no-c-optimize
% to improve compilation speed % to improve compilation speed
% --no-verbose-make
% don't show which files are being made
% --output-compile-error-lines 10000
% output all errors
% --no-warn-det-decls-too-lax % --no-warn-det-decls-too-lax
% --no-warn-simple-code % --no-warn-simple-code
% to avoid spurious warnings in the automatically % to avoid spurious warnings in the automatically
% generated parts of the query predicate % generated parts of the query predicate
% --link-flags --allow-undefined
% needed to allow the query to reference
% symbols defined in the program
% %
{ string__append_list([ { string__append_list([
"mmc --grade ", grade_option, " ", "mmc --grade ", grade_option, " ",
"--infer-all ", "--infer-all --no-verbose-make ",
"--pic-reg ", "-O0 --no-c-optimize ", "--pic-reg ", "-O0 --no-c-optimize ",
"--no-warn-simple-code --no-warn-det-decls-too-lax ", "--no-warn-simple-code --no-warn-det-decls-too-lax ",
"-c ", Options, "--output-compile-error-lines 10000 ",
" query.m"], Command) }, "--link-flags --allow-undefined ", Options,
invoke_system_command(Command, Succeeded0), " --make libquery.so"], Command) },
( { Succeeded0 = yes } -> invoke_system_command(Command, Succeeded).
% Figure out the location of the object file,
% which will depend on whether --use-subdirs was specified.
% XXX This code doesn't properly handle the case when the
% option is later overridden, e.g. if the options are
% `--use-subdirs --no-use-subdirs'. But that case
% is not very likely to occur in practice...
{ string__sub_string_search(Options, "--use-subdirs", _) ->
QueryObject = "Mercury/os/query.o"
;
QueryObject = "query.o"
},
% We use the following options: :- pred cleanup_query(options, state, state).
% --make-shared-lib :- mode cleanup_query(in, di, uo) is det.
% needed so we can dynamically load in the
% code cleanup_query(Options) -->
% --allow-undefined invoke_system_command(
% needed to allow the query to reference string__append_list(["mmc --grade ", grade_option, " ",
% symbols defined in the program Options, " --make query.realclean"]),
% --trace _),
{ string__append_list([ io__remove_file("query.m", _).
"ml --grade ", grade_option,
" --trace",
" --allow-undefined",
" --make-shared-lib ", Options,
" -o libquery.so ", QueryObject], Command2) },
invoke_system_command(Command2, Succeeded)
;
{ Succeeded = no }
).
:- func grade_option = string. :- func grade_option = string.
% %

View File

@@ -7,6 +7,7 @@
# Mmake - this is Mmake file for building the Mercury compiler # Mmake - this is Mmake file for building the Mercury compiler
MERCURY_DIR=.. MERCURY_DIR=..
LINK_STATIC=yes
include $(MERCURY_DIR)/Mmake.common include $(MERCURY_DIR)/Mmake.common
MAIN_TARGET=mercury MAIN_TARGET=mercury
@@ -30,52 +31,10 @@ GCC_MAIN_LIBS =
GCC_BACKEND_LIBS = GCC_BACKEND_LIBS =
endif endif
# Specify which compilers to use to compile the compiler. MCFLAGS += -I $(BROWSER_DIR)
# Don't change these without good reason - if you want to ALL_MLLIBS = ../main.$O $(MLLIBS) $(EXTRA_MLLIBS) \
# do a temporary change, change ../Mmake.params $(GCC_BACKEND_LIBS) $(MATH_LIB)
MLFLAGS += --no-main --shared
M_ENV = MERCURY_INT_DIR=$(LIBRARY_DIR) \
MERCURY_ALL_C_INCL_DIRS="\
-I$(BROWSER_DIR) \
-I$(TRACE_DIR) \
-I$(LIBRARY_DIR) \
-I$(RUNTIME_DIR) \
-I$(BOEHM_GC_DIR) \
-I$(BOEHM_GC_DIR)/include \
"
SMC = $(MC) --search-directory $(BROWSER_DIR)
MCD = $(M_ENV) $(SMC) --generate-dependencies
MCI = $(M_ENV) $(SMC) --make-interface
MCPI = $(M_ENV) $(SMC) --make-private-interface
MCSI = $(M_ENV) $(SMC) --make-short-interface
MCOI = $(M_ENV) $(SMC) --make-optimization-interface
MCTOI = $(M_ENV) $(SMC) --make-transitive-optimization-interface
MCG = $(M_ENV) $(SMC) --compile-to-c
MCE = $(M_ENV) $(SMC) --errorcheck-only
MCS = $(M_ENV) $(SMC) --split-c-files -c --cflags "$(ALL_CFLAGS)"
MGNUC = $(M_ENV) $(SCRIPTS_DIR)/mgnuc
C2INIT = MERCURY_MOD_LIB_MODS="$(LIBRARY_DIR)/$(STD_LIB_NAME).init $(RUNTIME_DIR)/$(RT_LIB_NAME).init" \
MERCURY_TRACE_LIB_MODS="$(BROWSER_DIR)/$(BROWSER_LIB_NAME).init" \
MERCURY_MKINIT=$(UTIL_DIR)/mkinit $(SCRIPTS_DIR)/c2init
ML = MERCURY_C_LIB_DIR=. $(SCRIPTS_DIR)/ml
MLFLAGS = --shared --no-main --mercury-libs none
MLLIBS = ../main.$O \
$(TRACE_DIR)/lib$(TRACE_LIB_NAME).$A \
$(BROWSER_DIR)/lib$(BROWSER_LIB_NAME).$A \
$(LIBRARY_DIR)/lib$(STD_LIB_NAME).$A \
$(RUNTIME_DIR)/lib$(RT_LIB_NAME).$A ` \
case $(GRADE) in \
*.par*.gc*.prof*) \
echo $(BOEHM_GC_DIR)/libpar_gc_prof.$A ;; \
*.par*.gc*) echo $(BOEHM_GC_DIR)/libpar_gc.$A ;; \
*.gc*.prof*) echo $(BOEHM_GC_DIR)/libgc_prof.$A ;; \
*.gc*) echo $(BOEHM_GC_DIR)/libgc.$A ;; \
esac \
` \
$(GCC_BACKEND_LIBS) \
$(MATH_LIB)
MTAGS = $(SCRIPTS_DIR)/mtags
MTAGSFLAGS = $(EXTRA_MTAGSFLAGS)
# #
# Work-around for a fixed limit: on alpha-dec-osf3.2, if we compile with # Work-around for a fixed limit: on alpha-dec-osf3.2, if we compile with
@@ -187,7 +146,7 @@ PP_DATE_FILES = $(PREPROCESSED_MODULES:%=$(dates_subdir)%.pp_date)
regenerate_preprocessed_files: regenerate_preprocessed_files:
-[ -d ./$(dates_subdir) ] || mkdir -p ./$(dates_subdir) -[ -d ./$(dates_subdir) ] || mkdir -p ./$(dates_subdir)
touch $(PREPROCESSED_FILES) touch $(PREPROCESSED_FILES)
$(MMAKE) $(PREPROCESSED_M_FILES) MMAKE_DIR=$(SCRIPTS_DIR) $(MMAKE) $(PREPROCESSED_M_FILES)
# The `.m' files for the preprocessed modules depend on the `.pp_date' files. # The `.m' files for the preprocessed modules depend on the `.pp_date' files.
$(PREPROCESSED_M_FILES): %.m: $(dates_subdir)%.pp_date $(PREPROCESSED_M_FILES): %.m: $(dates_subdir)%.pp_date

View File

@@ -119,13 +119,16 @@ if test "$BOOTSTRAP_MC" != ""; then
"). ").
EOF EOF
if if
# Test for the `--generate-mmc-deps' option. # Test for the `--generate-mmc-deps' and
# `--no-mercury-stdlib-dir' options.
echo $BOOTSTRAP_MC conftest >&AC_FD_CC 2>&1 && echo $BOOTSTRAP_MC conftest >&AC_FD_CC 2>&1 &&
$BOOTSTRAP_MC \ $BOOTSTRAP_MC \
--generate-mmc-deps \ --generate-mmc-deps \
--halt-at-warn $link_flags conftest \ --halt-at-warn $link_flags conftest \
</dev/null >&AC_FD_CC 2>&1 && </dev/null >&AC_FD_CC 2>&1 &&
test "`./conftest 2>&1 | tr -d '\015'`" = "Hello, world" test "`./conftest 2>&1 | tr -d '\015'`" = "Hello, world" &&
$BOOTSTRAP_MC --output-grade-string --no-mercury-stdlib-dir \
</dev/null >&AC_FD_CC 2>&1
then then
AC_MSG_RESULT(yes) AC_MSG_RESULT(yes)
else else

View File

@@ -1,5 +1,5 @@
#-----------------------------------------------------------------------------# #-----------------------------------------------------------------------------#
# Copyright (C) 1995-2001 The University of Melbourne. # Copyright (C) 1995-2002 The University of Melbourne.
# This file may only be copied under the terms of the GNU General # This file may only be copied under the terms of the GNU General
# Public Licence - see the file COPYING in the Mercury distribution. # Public Licence - see the file COPYING in the Mercury distribution.
#-----------------------------------------------------------------------------# #-----------------------------------------------------------------------------#
@@ -9,6 +9,7 @@
-include Mmake.deep.params -include Mmake.deep.params
MERCURY_DIR=.. MERCURY_DIR=..
LINK_STATIC=yes
include $(MERCURY_DIR)/Mmake.common include $(MERCURY_DIR)/Mmake.common
ifeq ("$(ENABLE_DEEP_PROFILER)","yes") ifeq ("$(ENABLE_DEEP_PROFILER)","yes")
@@ -21,51 +22,9 @@ else
INSTALL=nothing INSTALL=nothing
endif endif
VPATH=$(LIBRARY_DIR)
#-----------------------------------------------------------------------------# #-----------------------------------------------------------------------------#
# Specify which compilers to use to compile the profiler. MLFLAGS += --shared
# Don't change these without good reason - if you want to
# do a temporary change, change ../Mmake.params
M_ENV = MERCURY_INT_DIR=$(LIBRARY_DIR) \
MERCURY_ALL_C_INCL_DIRS="\
-I$(TRACE_DIR) \
-I$(LIBRARY_DIR) \
-I$(RUNTIME_DIR) \
-I$(BOEHM_GC_DIR) \
-I$(BOEHM_GC_DIR)/include \
"
MCD = $(M_ENV) $(MC) --generate-dependencies
MCI = $(M_ENV) $(MC) --make-interface
MCPI = $(M_ENV) $(MC) --make-private-interface
MCSI = $(M_ENV) $(MC) --make-short-interface
MCOI = $(M_ENV) $(MC) --make-optimization-interface
MCTOI = $(M_ENV) $(MC) --make-transitive-optimization-interface
MCG = $(M_ENV) $(MC) --compile-to-c
MCS = $(M_ENV) $(MC) --split-c-files -c --cflags "$(ALL_CFLAGS)"
MGNUC = $(M_ENV) $(SCRIPTS_DIR)/mgnuc
C2INIT = MERCURY_MOD_LIB_MODS="$(LIBRARY_DIR)/$(STD_LIB_NAME).init $(RUNTIME_DIR)/$(RT_LIB_NAME).init" \
MERCURY_TRACE_LIB_MODS="$(BROWSER_DIR)/$(BROWSER_LIB_NAME).init" \
MERCURY_MKINIT=$(UTIL_DIR)/mkinit $(SCRIPTS_DIR)/c2init
ML = MERCURY_C_LIB_DIR=. $(SCRIPTS_DIR)/ml
MLFLAGS = --shared --mercury-libs none
MLLIBS = $(TRACE_DIR)/lib$(TRACE_LIB_NAME).$A \
$(BROWSER_DIR)/lib$(BROWSER_LIB_NAME).$A \
$(LIBRARY_DIR)/lib$(STD_LIB_NAME).$A \
$(RUNTIME_DIR)/lib$(RT_LIB_NAME).$A ` \
case $(GRADE) in \
*.par*.gc*.prof*) \
echo $(BOEHM_GC_DIR)/libpar_gc_prof.$A ;; \
*.par*.gc*) echo $(BOEHM_GC_DIR)/libpar_gc.$A ;; \
*.gc*.prof*) echo $(BOEHM_GC_DIR)/libgc_prof.$A ;; \
*.gc*) echo $(BOEHM_GC_DIR)/libgc.$A ;; \
esac \
` $(MATH_LIB)
MSL = MERCURY_SP_LIB_DIR=$(LIBRARY_DIR) $(SCRIPTS_DIR)/msl
MNLFLAGS = -u 6000
MTAGS = $(SCRIPTS_DIR)/mtags
#-----------------------------------------------------------------------------# #-----------------------------------------------------------------------------#

View File

@@ -15,6 +15,7 @@ EXTRA_LDLIBS =
#-----------------------------------------------------------------------------# #-----------------------------------------------------------------------------#
MERCURY_DIR=.. MERCURY_DIR=..
LINK_RUNTIME_ONLY=yes
include $(MERCURY_DIR)/Mmake.common include $(MERCURY_DIR)/Mmake.common
MAIN_TARGET=mercury MAIN_TARGET=mercury
@@ -23,36 +24,6 @@ VPATH=.
#-----------------------------------------------------------------------------# #-----------------------------------------------------------------------------#
# We need to compile the library with --strict-sequential for two reasons:
# (1) Otherwise Mercury code that is compiled with --strict-sequential
# might do the wrong thing, because the standard library wasn't compiled
# with --strict-sequential. (We could make it a separate grade, but
# that's not worth it.)
# (2) The code for get_determinism in library/exception.m relies on it
# (in particular it relies on --no-reorder-disj).
MCFLAGS += --strict-sequential
# Generate dependencies for use by `mmc --make'.
MCFLAGS += --generate-mmc-deps
# Modules which use user-guided type specialization need to be
# compiled with these flags to make sure all calls
# to the builtin comparison routines are inlined.
TYPE_SPEC_FLAGS = --inline-vars-threshold 10000
MCFLAGS-list += $(TYPE_SPEC_FLAGS)
MCFLAGS-map += $(TYPE_SPEC_FLAGS)
MCFLAGS-tree234 += $(TYPE_SPEC_FLAGS)
MCFLAGS-set += $(TYPE_SPEC_FLAGS)
MCFLAGS-set_ordlist += $(TYPE_SPEC_FLAGS)
#-----------------------------------------------------------------------------#
# Bug workarounds.
MCFLAGS-std_util += --no-halt-at-warn
#-----------------------------------------------------------------------------#
# Specify which options to use to compile the library. # Specify which options to use to compile the library.
# Don't change these without good reason - if you want to # Don't change these without good reason - if you want to
# do a temporary change, change ../Mmake.params. # do a temporary change, change ../Mmake.params.
@@ -79,44 +50,47 @@ CHECK_TERM_OPTS =
endif endif
M_ENV = MERCURY_INT_DIR=. \ # We need to compile the library with --strict-sequential for two reasons:
MERCURY_ALL_C_INCL_DIRS="\ # (1) Otherwise Mercury code that is compiled with --strict-sequential
-I$(TRACE_DIR) \ # might do the wrong thing, because the standard library wasn't compiled
-I$(RUNTIME_DIR) \ # with --strict-sequential. (We could make it a separate grade, but
-I$(BOEHM_GC_DIR) \ # that's not worth it.)
-I$(BOEHM_GC_DIR)/include \ # (2) The code for get_determinism in library/exception.m relies on it
" # (in particular it relies on --no-reorder-disj).
MCD = $(M_ENV) $(MC) --generate-dependencies $(INTERMODULE_OPTS) #
MCI = $(M_ENV) $(MC) --make-interface $(INTERMODULE_OPTS) \ # We compile the files in the library directory with --trace minimum by
$(ENABLE_TERM_OPTS) # default, which has no effect in non-debugging grades and causes the
MCPI = $(M_ENV) $(MC) --make-private-interface $(INTERMODULE_OPTS) \ # library to be shallow traced, not deep traced, in debugging grades.
$(ENABLE_TERM_OPTS) # This is probably what most users want, and it makes it much easier to
MCSI = $(M_ENV) $(MC) --make-short-interface $(INTERMODULE_OPTS) \ # maintain the expected output of the debugging test cases in debugging grades.
$(ENABLE_TERM_OPTS) #
MCOI = $(M_ENV) $(MC) --make-opt-int $(INTERMODULE_OPTS) \ # Always generate dependencies for use by `mmc --make'.
$(ENABLE_TERM_OPTS) MCFLAGS += --strict-sequential --trace minimum --generate-mmc-deps \
MCTOI = $(M_ENV) $(MC) --make-trans-opt $(INTERMODULE_OPTS) \ $(INTERMODULE_OPTS) $(ENABLE_TERM_OPTS) $(CHECK_TERM_OPTS)
$(ENABLE_TERM_OPTS)
MCG = $(M_ENV) $(MC) --compile-to-c --trace minimum \ # Modules which use user-guided type specialization need to be
$(INTERMODULE_OPTS) $(CHECK_TERM_OPTS) # compiled with these flags to make sure all calls
MCS = $(M_ENV) $(MC) --split-c-files -c --cflags "$(ALL_CFLAGS)" \ # to the builtin comparison routines are inlined.
$(INTERMODULE_OPTS) $(CHECK_TERM_OPTS) TYPE_SPEC_FLAGS = --inline-vars-threshold 10000
MGNUC = $(M_ENV) $(SCRIPTS_DIR)/mgnuc MCFLAGS-list += $(TYPE_SPEC_FLAGS)
MGNUCFLAGS = $(DLL_CFLAGS) MCFLAGS-map += $(TYPE_SPEC_FLAGS)
LDFLAGS = -L$(BOEHM_GC_DIR) -L$(RUNTIME_DIR) MCFLAGS-tree234 += $(TYPE_SPEC_FLAGS)
ALL_LDFLAGS = $(LDFLAGS) $(EXTRA_LDFLAGS) MCFLAGS-set += $(TYPE_SPEC_FLAGS)
LDLIBS = -l$(RT_LIB_NAME) \ MCFLAGS-set_ordlist += $(TYPE_SPEC_FLAGS)
` case "$(GRADE)" in \
*.par*.gc*.prof*) echo "-lpar_gc_prof" ;; \ # Bug workarounds.
*.par*.gc*) echo "-lpar_gc" ;; \ MCFLAGS-std_util += --no-halt-at-warn
*.gc*.prof*) echo "-lgc_prof" ;; \
*.gc*) echo "-lgc" ;; \ #-----------------------------------------------------------------------------#
esac \
` CFLAGS += $(DLL_CFLAGS) -I$(TRACE_DIR)
ALL_LDLIBS = $(LDLIBS) $(EXTRA_LDLIBS) MLFLAGS += -R$(FINAL_INSTALL_MERC_LIB_DIR) \
-R$(FINAL_INSTALL_MERC_GC_LIB_DIR)
MTAGS = $(SCRIPTS_DIR)/mtags MTAGS = $(SCRIPTS_DIR)/mtags
LN = ln
#-----------------------------------------------------------------------------# #-----------------------------------------------------------------------------#
# Stuff for Windows DLLS using gnu-win32 # Stuff for Windows DLLS using gnu-win32
@@ -266,22 +240,13 @@ lib_std: $(os_subdir)tree234.$O
lib_std: lib$(STD_LIB_NAME).$A lib$(STD_LIB_NAME).$(EXT_FOR_SHARED_LIB) lib_std: lib$(STD_LIB_NAME).$A lib$(STD_LIB_NAME).$(EXT_FOR_SHARED_LIB)
lib_std: $(STD_LIB_NAME).init lib_std: $(STD_LIB_NAME).init
lib$(STD_LIB_NAME)$(DLL_DEF_LIB).$A : $(library.os) lib$(STD_LIB_NAME)$(DLL_DEF_LIB).$A : liblibrary.$A
rm -f lib$(STD_LIB_NAME)$(DLL_DEF_LIB).$A rm -f lib$(STD_LIB_NAME)$(DLL_DEF_LIB).$A
$(AR) $(ALL_ARFLAGS) \ $(LN) liblibrary.$A lib$(STD_LIB_NAME)$(DLL_DEF_LIB).$A
$(AR_LIBFILE_OPT)lib$(STD_LIB_NAME)$(DLL_DEF_LIB).$A \
$(library.os)
$(RANLIB) lib$(STD_LIB_NAME)$(DLL_DEF_LIB).$A
RPATH_1=$(SHLIB_RPATH_OPT)$(FINAL_INSTALL_MERC_LIB_DIR) lib$(STD_LIB_NAME).so : liblibrary.so
RPATH_2=$(SHLIB_RPATH_SEP)$(FINAL_INSTALL_MERC_GC_LIB_DIR) rm -f lib$(STD_LIB_NAME).so
$(LN) liblibrary.so lib$(STD_LIB_NAME).so
lib$(STD_LIB_NAME).so : $(library.pic_os)
$(LINK_SHARED_OBJ) $(ERROR_UNDEFINED) \
-o lib$(STD_LIB_NAME).so $(library.pic_os) \
$(RPATH_1)$(RPATH_2) \
$(ALL_LDFLAGS) $(ALL_LDLIBS) \
$(SHARED_LIBS)
endif endif

View File

@@ -1,5 +1,5 @@
#-----------------------------------------------------------------------------# #-----------------------------------------------------------------------------#
# Copyright (C) 1995-2000 The University of Melbourne. # Copyright (C) 1995-2000,2002 The University of Melbourne.
# This file may only be copied under the terms of the GNU General # This file may only be copied under the terms of the GNU General
# Public Licence - see the file COPYING in the Mercury distribution. # Public Licence - see the file COPYING in the Mercury distribution.
#-----------------------------------------------------------------------------# #-----------------------------------------------------------------------------#
@@ -7,55 +7,14 @@
# Mmake - this is Mmake file for building the Mercury profiler # Mmake - this is Mmake file for building the Mercury profiler
MERCURY_DIR=.. MERCURY_DIR=..
LINK_STATIC=yes
include $(MERCURY_DIR)/Mmake.common include $(MERCURY_DIR)/Mmake.common
MAIN_TARGET=mercury_profile MAIN_TARGET=mercury_profile
VPATH=$(LIBRARY_DIR)
#-----------------------------------------------------------------------------# #-----------------------------------------------------------------------------#
# Specify which compilers to use to compile the profiler. MLFLAGS += --shared
# Don't change these without good reason - if you want to
# do a temporary change, change ../Mmake.params
M_ENV = MERCURY_INT_DIR=$(LIBRARY_DIR) \
MERCURY_ALL_C_INCL_DIRS="\
-I$(TRACE_DIR) \
-I$(LIBRARY_DIR) \
-I$(RUNTIME_DIR) \
-I$(BOEHM_GC_DIR) \
-I$(BOEHM_GC_DIR)/include \
"
MCD = $(M_ENV) $(MC) --generate-dependencies
MCI = $(M_ENV) $(MC) --make-interface
MCPI = $(M_ENV) $(MC) --make-private-interface
MCSI = $(M_ENV) $(MC) --make-short-interface
MCOI = $(M_ENV) $(MC) --make-optimization-interface
MCTOI = $(M_ENV) $(MC) --make-transitive-optimization-interface
MCG = $(M_ENV) $(MC) --compile-to-c
MCS = $(M_ENV) $(MC) --split-c-files -c --cflags "$(ALL_CFLAGS)"
MGNUC = $(M_ENV) $(SCRIPTS_DIR)/mgnuc
C2INIT = MERCURY_MOD_LIB_MODS="$(LIBRARY_DIR)/$(STD_LIB_NAME).init $(RUNTIME_DIR)/$(RT_LIB_NAME).init" \
MERCURY_TRACE_LIB_MODS="$(BROWSER_DIR)/$(BROWSER_LIB_NAME).init" \
MERCURY_MKINIT=$(UTIL_DIR)/mkinit $(SCRIPTS_DIR)/c2init
ML = MERCURY_C_LIB_DIR=. $(SCRIPTS_DIR)/ml
MLFLAGS = --shared --mercury-libs none
MLLIBS = $(TRACE_DIR)/lib$(TRACE_LIB_NAME).$A \
$(BROWSER_DIR)/lib$(BROWSER_LIB_NAME).$A \
$(LIBRARY_DIR)/lib$(STD_LIB_NAME).$A \
$(RUNTIME_DIR)/lib$(RT_LIB_NAME).$A ` \
case $(GRADE) in \
*.par*.gc*.prof*) \
echo $(BOEHM_GC_DIR)/libpar_gc_prof.$A ;; \
*.par*.gc*) echo $(BOEHM_GC_DIR)/libpar_gc.$A ;; \
*.gc*.prof*) echo $(BOEHM_GC_DIR)/libgc_prof.$A ;; \
*.gc*) echo $(BOEHM_GC_DIR)/libgc.$A ;; \
esac \
` $(MATH_LIB)
MSL = MERCURY_SP_LIB_DIR=$(LIBRARY_DIR) $(SCRIPTS_DIR)/msl
MNLFLAGS = -u 6000
MTAGS = $(SCRIPTS_DIR)/mtags
#-----------------------------------------------------------------------------# #-----------------------------------------------------------------------------#

View File

@@ -9,21 +9,14 @@
MAIN_TARGET=runtime MAIN_TARGET=runtime
MERCURY_DIR=.. MERCURY_DIR=..
LINK_BOEHM_GC_ONLY=yes
include $(MERCURY_DIR)/Mmake.common include $(MERCURY_DIR)/Mmake.common
-include Mmake.runtime.params -include Mmake.runtime.params
#-----------------------------------------------------------------------------# #-----------------------------------------------------------------------------#
CFLAGS = -g $(DLL_CFLAGS) -DMERCURY_BOOTSTRAP_H -DMERCURY_CONF_BOOTSTRAP_H CFLAGS += -g $(DLL_CFLAGS) -DMERCURY_BOOTSTRAP_H -DMERCURY_CONF_BOOTSTRAP_H
MGNUCFLAGS += --no-ansi
MGNUC = MERCURY_ALL_C_INCL_DIRS=" \
-I$(RUNTIME_DIR) \
-I$(BOEHM_GC_DIR) \
-I$(BOEHM_GC_DIR)/include \
" \
$(SCRIPTS_DIR)/mgnuc
MGNUCFLAGS = --no-ansi
MOD2C = $(SCRIPTS_DIR)/mod2c
#-----------------------------------------------------------------------------# #-----------------------------------------------------------------------------#
@@ -190,14 +183,8 @@ OBJS = $(CFILES:.c=.$O)
PIC_OBJS = $(CFILES:.c=.$(EXT_FOR_PIC_OBJECTS)) PIC_OBJS = $(CFILES:.c=.$(EXT_FOR_PIC_OBJECTS))
LDFLAGS = -L$(BOEHM_GC_DIR) LDFLAGS = -L$(BOEHM_GC_DIR)
LDLIBS = \ LDLIBS = $(SHARED_GC_LIBS)
` case "$(GRADE)" in \
*.par*.gc*.prof*) echo "-lpar_gc_prof" ;; \
*.par*.gc*) echo "-lpar_gc" ;; \
*.gc*.prof*) echo "-lgc_prof" ;; \
*.gc*) echo "-lgc" ;; \
esac \
`
THREADLIBS = \ THREADLIBS = \
` case "$(GRADE)" in \ ` case "$(GRADE)" in \
*.par*) echo "-lpthread" ;; \ *.par*) echo "-lpthread" ;; \

View File

@@ -105,7 +105,7 @@ ALL_MCDFLAGS = $(MCDFLAGS) $(EXTRA_MCDFLAGS) $(TARGET_MCFLAGS) \
ALL_MCGFLAGS = $(MCGFLAGS) $(EXTRA_MCGFLAGS) $(TARGET_MCFLAGS) \ ALL_MCGFLAGS = $(MCGFLAGS) $(EXTRA_MCGFLAGS) $(TARGET_MCFLAGS) \
$(LIB_MCFLAGS) $(LIB_MCFLAGS)
ALL_MCSFLAGS = $(MCSFLAGS) $(EXTRA_MCSFLAGS) $(TARGET_MCFLAGS) \ ALL_MCSFLAGS = $(MCSFLAGS) $(EXTRA_MCSFLAGS) $(TARGET_MCFLAGS) \
$(LIB_MCFLAGS) $(LIB_MCFLAGS) --cflags "$(ALL_CFLAGS)"
MCIFLAGS = $(MCFLAGS) MCIFLAGS = $(MCFLAGS)
MCPIFLAGS = $(MCFLAGS) MCPIFLAGS = $(MCFLAGS)

View File

@@ -25,7 +25,7 @@ DEFAULT_GRADE=${MERCURY_DEFAULT_GRADE=@DEFAULT_GRADE@}
# include the file `canonical_grade.sh-subr' # include the file `canonical_grade.sh-subr'
@CANONICAL_GRADE@ @CANONICAL_GRADE@
# If you change these, you will also need to change Mmake.common.in, # If you change these, you will also need to change Mmake.workspace
# scripts/ml.in, tools/bootcheck, tools/binary, tools/binary_step and # scripts/ml.in, tools/bootcheck, tools/binary, tools/binary_step and
# tools/linear. # tools/linear.
RT_LIB_NAME=mer_rt RT_LIB_NAME=mer_rt

View File

@@ -80,7 +80,7 @@ DL_LIBRARY="@DL_LIBRARY@"
# Likewise for -lreadline -l{termcap,curses,ncurses} # Likewise for -lreadline -l{termcap,curses,ncurses}
READLINE_LIBRARIES="@READLINE_LIBRARIES@" READLINE_LIBRARIES="@READLINE_LIBRARIES@"
# If you change these, you will also need to change Mmake.common.in, # If you change these, you will also need to change Mmake.workspace,
# scripts/c2init.in, tools/bootcheck, tools/binary, tools/binary_step # scripts/c2init.in, tools/bootcheck, tools/binary, tools/binary_step
# and tools/linear. # and tools/linear.
RT_LIB_NAME=mer_rt RT_LIB_NAME=mer_rt

View File

@@ -1,5 +1,14 @@
#-----------------------------------------------------------------------------# #-----------------------------------------------------------------------------#
# Set up to test a particular workspace.
ifdef WORKSPACE
# Make sure we don't get the installed versions of the libraries.
LINK_STATIC = yes
include $(WORKSPACE)/Mmake.workspace
endif
# #
# Note: Mmake lets you override MCFLAGS for a particular file by setting # Note: Mmake lets you override MCFLAGS for a particular file by setting
# MCFLAGS-foo. Similarly, you can override GRADEFLAGS for a particular # MCFLAGS-foo. Similarly, you can override GRADEFLAGS for a particular

View File

@@ -63,8 +63,8 @@ MCFLAGS-tabled_read_decl = --trace-table-io-decl
# The optimization level also affects stack frame sizes. # The optimization level also affects stack frame sizes.
MCFLAGS-nondet_stack = -O2 --no-reclaim-heap-on-failure MCFLAGS-nondet_stack = -O2 --no-reclaim-heap-on-failure
MCFLAGS = --trace deep MCFLAGS += --trace deep
MLFLAGS = --trace MLFLAGS += --trace
# We need to use shared libraries for interactive queries to work. # We need to use shared libraries for interactive queries to work.
# The following is necessary for shared libraries to work on Linux. # The following is necessary for shared libraries to work on Linux.
@@ -72,10 +72,11 @@ GRADEFLAGS-interactive = --pic-reg
MLFLAGS-interactive = --shared MLFLAGS-interactive = --shared
# Since the `interactive' test case requires the use of shared libraries, # Since the `interactive' test case requires the use of shared libraries,
# this means it won't work properly if MERCURY_LIBS is set to point # this means it won't work properly if the static libraries are linked
# to static libraries (as is done by tools/bootcheck and tools/lmc). # (as is done by tools/bootcheck and tools/lmc).
# So we only enable it if MERCURY_LIBS is not set. # So we only enable it if LINK_STATIC is not set.
ifeq "$(origin MERCURY_LIBS)" "undefined" LINK_STATIC ?= no
ifeq ($(LINK_STATIC),no)
RETRY_PROGS := $(RETRY_PROGS) interactive RETRY_PROGS := $(RETRY_PROGS) interactive
endif endif
@@ -299,13 +300,24 @@ type_desc_test.out: type_desc_test type_desc_test.inp
# to have been built. # to have been built.
ifeq ($(MMAKE_USE_SUBDIRS),yes) ifeq ($(MMAKE_USE_SUBDIRS),yes)
INTERACTIVE_INP = interactive.inp.subdirs USE_SUBDIRS_OPT = --use-subdirs
else else
INTERACTIVE_INP = interactive.inp.nosubdirs USE_SUBDIRS_OPT =
endif endif
interactive.out.orig: interactive $(INTERACTIVE_INP) $(interactive.ints) # We need $(...) style command substitution for the rule below.
$(MDB) ./interactive < $(INTERACTIVE_INP) > interactive.out.orig 2>&1 # (MC_MAKE_FLAGS can contain `...` style command substitution,
# which can't be nested).
SHELL=/usr/local/bin/bash
interactive.out.orig: interactive interactive.inp $(interactive.ints)
echo "echo on" > interactive.inp.tmp
echo mmc_options $(USE_SUBDIRS_OPT) \
$$(echo $(MC_MAKE_FLAGS) $(ALL_MCFLAGS)) \
--trace minimum >> interactive.inp.tmp
cat interactive.inp >> interactive.inp.tmp
$(MDB) ./interactive < interactive.inp.tmp > interactive.out.orig 2>&1
rm -f interactive.inp.tmp
# We pipe the output through sed to avoid differences for `--use-subdirs', # We pipe the output through sed to avoid differences for `--use-subdirs',
# and to remove some spurious warnings that `gcc' and `ld' issue. # and to remove some spurious warnings that `gcc' and `ld' issue.
@@ -315,7 +327,7 @@ interactive.out.orig: interactive $(INTERACTIVE_INP) $(interactive.ints)
interactive.out: interactive.out.orig interactive.out: interactive.out.orig
cat interactive.out.orig | \ cat interactive.out.orig | \
sed \ sed \
-e '/mdb> mmc_options --use-subdirs/d' \ -e '/mdb> mmc_options/d' \
-e '/In file included from \/home\/mercury\/public\/.a\/lib\/mercury\/inc\/mercury_trace_base.h:[0-9]*,$$/N' \ -e '/In file included from \/home\/mercury\/public\/.a\/lib\/mercury\/inc\/mercury_trace_base.h:[0-9]*,$$/N' \
-e 's/In file included from \/home\/mercury\/public\/.a\/lib\/mercury\/inc\/mercury_trace_base.h:[0-9]*,.//' \ -e 's/In file included from \/home\/mercury\/public\/.a\/lib\/mercury\/inc\/mercury_trace_base.h:[0-9]*,.//' \
-e '/ from \/home\/mercury\/public\/.a\/lib\/mercury\/inc\/mercury_wrapper.h:[0-9]*,$$/N' \ -e '/ from \/home\/mercury\/public\/.a\/lib\/mercury\/inc\/mercury_wrapper.h:[0-9]*,$$/N' \

View File

@@ -51,8 +51,8 @@ NONWORKING_DECLARATIVE_PROGS= \
ite_2 \ ite_2 \
solutions solutions
MCFLAGS = --trace decl MCFLAGS += --trace decl
MLFLAGS = --trace MLFLAGS += --trace
MCFLAGS-deep_sub=--trace deep MCFLAGS-deep_sub=--trace deep
MCFLAGS-dependency=--trace rep MCFLAGS-dependency=--trace rep

View File

@@ -167,6 +167,7 @@ No (more) solutions.
<stdin>:001: argument has type `int', <stdin>:001: argument has type `int',
<stdin>:001: constant `"foo"' has type `string'. <stdin>:001: constant `"foo"' has type `string'.
For more information, try recompiling with `-E'. For more information, try recompiling with `-E'.
** Error making `query.c'.
qperm([1,2,"foo"], List). qperm([1,2,"foo"], List).
Compilation error(s) occurred. Compilation error(s) occurred.
?- <stdin>:026: Inferred :- pred query((list:list(int))). ?- <stdin>:026: Inferred :- pred query((list:list(int))).
@@ -181,6 +182,7 @@ Compilation error(s) occurred.
<stdin>:026: mode error: variable `HeadVar__2' has instantiatedness `free', <stdin>:026: mode error: variable `HeadVar__2' has instantiatedness `free',
<stdin>:026: expected instantiatedness was `ground'. <stdin>:026: expected instantiatedness was `ground'.
For more information, try recompiling with `-E'. For more information, try recompiling with `-E'.
** Error making `query.c'.
qperm(List, [1]). qperm(List, [1]).
Compilation error(s) occurred. Compilation error(s) occurred.
?- quit. ?- quit.

View File

@@ -169,6 +169,7 @@ No (more) solutions.
<stdin>:001: argument has type `int', <stdin>:001: argument has type `int',
<stdin>:001: constant `"foo"' has type `string'. <stdin>:001: constant `"foo"' has type `string'.
For more information, try recompiling with `-E'. For more information, try recompiling with `-E'.
** Error making `query.c'.
qperm([1,2,"foo"], List). qperm([1,2,"foo"], List).
Compilation error(s) occurred. Compilation error(s) occurred.
?- <stdin>:026: Inferred :- pred query((list:list(int))). ?- <stdin>:026: Inferred :- pred query((list:list(int))).
@@ -183,6 +184,7 @@ Compilation error(s) occurred.
<stdin>:026: mode error: variable `HeadVar__2' has instantiatedness `free', <stdin>:026: mode error: variable `HeadVar__2' has instantiatedness `free',
<stdin>:026: expected instantiatedness was `ground'. <stdin>:026: expected instantiatedness was `ground'.
For more information, try recompiling with `-E'. For more information, try recompiling with `-E'.
** Error making `query.c'.
qperm(List, [1]). qperm(List, [1]).
Compilation error(s) occurred. Compilation error(s) occurred.
?- quit. ?- quit.

View File

@@ -1,4 +1,3 @@
echo on
print * print *
print * print *

View File

@@ -1,76 +0,0 @@
echo on
print *
print *
print *
print *
print *
print *
print *
print *
level 1
print *
up 1
vars
print *
print HeadVar__1
print HeadVar__2
print HeadVar__3
print *
print *
print *
print *
print *
goto -a 20
stack
stack -d
print *
#
# Test interactive queries.
#
mmc_options --use-subdirs
query interactive list
append(X, Y, ['a', 'b', 'c']).
qperm([1,2,3], List).
qperm([1,2,3], List), List = [2 | _].
qperm([1,2,3], List), List = [4 | _].
qperm([1,2,"foo"], List).
qperm(List, [1]).
quit.
cc_query interactive list
append(X, Y, ['a', 'b', 'c']).
qperm([1,2,3], List).
qperm([1,2,3], List), List = [2 | _].
qperm([1,2,3], List), List = [4 | _].
quit.
io_query interactive list
main.
if { append(X, Y, ['a', 'b', 'c']) } then print("X = "), print(X), print(", Y = "), print(Y), nl else print("No solution\n").
if { qperm([1,2,3], List) } then print(List), nl else [].
if { qperm([1,2,3], List), List = [2 | _] } then print(List), nl else { true }.
if { qperm([1,2,3], List), List = [4 | _] } then print(List), nl else print("No solution, as expected."), io__nl.
quit.
retry
print *
finish -a
register --quiet
break print_list
break qdelete
continue -a
step -aS 5
disable 1
continue -n
continue -n -S

View File

@@ -1,3 +1,5 @@
include ../Mmake.common
MCFLAGS=#--pd --no-inlining -d 35 -D petdr #-d 99 MCFLAGS=#--pd --no-inlining -d 35 -D petdr #-d 99
#GRADE=asm_fast.gc.prof #GRADE=asm_fast.gc.prof
MLFLAGS=--static MLFLAGS=--static

View File

@@ -1,5 +1,6 @@
#-----------------------------------------------------------------------------# #-----------------------------------------------------------------------------#
include ../Mmake.common
-include ../Mmake.params -include ../Mmake.params
main_target: check main_target: check

View File

@@ -61,7 +61,7 @@ Options:
" "
# If you change this, you will also need to change scripts/ml.in, # If you change this, you will also need to change scripts/ml.in,
# scripts/c2init.in, Mmake.common.in, tools/bootcheck, tools/binary_step # scripts/c2init.in, Mmake.workspace, tools/bootcheck, tools/binary_step
# and tools/linear. # and tools/linear.
STD_LIB_NAME=mer_std STD_LIB_NAME=mer_std

View File

@@ -41,7 +41,7 @@ Options:
" "
# If you change this, you will also need to change scripts/ml.in, # If you change this, you will also need to change scripts/ml.in,
# scripts/c2init.in, Mmake.common.in, tools/bootcheck, tools/binary # scripts/c2init.in, Mmake.workspace, tools/bootcheck, tools/binary
# and tools/linear. # and tools/linear.
STD_LIB_NAME=mer_std STD_LIB_NAME=mer_std

View File

@@ -105,6 +105,7 @@ Options:
Use this option on systems which don't support symbolic links. Use this option on systems which don't support symbolic links.
" "
unset WORKSPACE
testdirs="" testdirs=""
extras=false extras=false
jfactor="" jfactor=""
@@ -143,7 +144,7 @@ then
fi fi
# If you change these, you will also need to change scripts/ml.in, # If you change these, you will also need to change scripts/ml.in,
# scripts/c2init.in, Mmake.common.in, tools/binary, tools/binary_step # scripts/c2init.in, Mmake.workspace, tools/binary, tools/binary_step
# and tools/linear. # and tools/linear.
RT_LIB_NAME=mer_rt RT_LIB_NAME=mer_rt
STD_LIB_NAME=mer_std STD_LIB_NAME=mer_std
@@ -395,8 +396,6 @@ then
MERCURY_COMPILER=$root/compiler/mercury_compile MERCURY_COMPILER=$root/compiler/mercury_compile
export MERCURY_COMPILER export MERCURY_COMPILER
MERCURY_INT_DIR=$root/stage2/library
export MERCURY_INT_DIR
[ -d stage2 ] || mkdir stage2 [ -d stage2 ] || mkdir stage2
if $keep_stage_2 if $keep_stage_2
@@ -632,8 +631,6 @@ then
MERCURY_COMPILER=$root/stage2/compiler/mercury_compile MERCURY_COMPILER=$root/stage2/compiler/mercury_compile
export MERCURY_COMPILER export MERCURY_COMPILER
MERCURY_INT_DIR=$root/stage3/library
export MERCURY_INT_DIR
[ -d stage3 ] || mkdir stage3 [ -d stage3 ] || mkdir stage3
if $keep_stage_3 if $keep_stage_3
@@ -877,48 +874,12 @@ then
stage2_insert="" stage2_insert=""
fi fi
MERCURY_INT_DIR=$root/${stage2_insert}library WORKSPACE="$root/${stage2_insert}"
export MERCURY_INT_DIR export WORKSPACE
if test "$test_grade" = ""; then
gc_grade=`scripts/ml --print-gc-grade`
else
gc_grade=`scripts/ml --grade $test_grade --print-gc-grade`
fi
MERCURY_LIBS="
`$CYGPATH $root/${stage2_insert}trace/lib$TRACE_LIB_NAME.$A`
`$CYGPATH $root/${stage2_insert}browser/lib$BROWSER_LIB_NAME.$A`
`$CYGPATH $root/${stage2_insert}library/lib$STD_LIB_NAME.$A`
`$CYGPATH $root/${stage2_insert}runtime/lib$RT_LIB_NAME.$A`
`$CYGPATH $root/${stage2_insert}boehm_gc/lib$gc_grade.$A`
-lm"
export MERCURY_LIBS
MERCURY_ALL_C_INCL_DIRS="-I$root/${stage2_insert}trace
-I$root/${stage2_insert}library
-I$root/${stage2_insert}runtime
-I$root/${stage2_insert}boehm_gc
-I$root/${stage2_insert}boehm_gc/include"
export MERCURY_ALL_C_INCL_DIRS
MERCURY_ALL_MC_C_INCL_DIRS="
--c-include-directory $root/${stage2_insert}trace
--c-include-directory $root/${stage2_insert}library
--c-include-directory $root/${stage2_insert}runtime
--c-include-directory $root/${stage2_insert}boehm_gc
--c-include-directory $root/${stage2_insert}boehm_gc/include"
export MERCURY_ALL_MC_C_INCL_DIRS
MMAKE_DIR="$root/${stage2_insert}scripts" MMAKE_DIR="$root/${stage2_insert}scripts"
export MMAKE_DIR export MMAKE_DIR
MERCURY_MOD_LIB_MODS="
$root/${stage2_insert}library/$STD_LIB_NAME.init
$root/${stage2_insert}runtime/$RT_LIB_NAME.init"
export MERCURY_MOD_LIB_MODS
MERCURY_TRACE_LIB_MODS="
$root/${stage2_insert}browser/$BROWSER_LIB_NAME.init"
export MERCURY_TRACE_LIB_MODS
# for mkinit, mmc, mgnuc, ml etc # for mkinit, mmc, mgnuc, ml etc
PATH=$root/${stage2_insert}util:$root/${stage2_insert}scripts:$PATH PATH=$root/${stage2_insert}util:$root/${stage2_insert}scripts:$PATH
export PATH export PATH

View File

@@ -44,7 +44,7 @@ Options:
" "
# If you change this, you will also need to change scripts/ml.in, # If you change this, you will also need to change scripts/ml.in,
# scripts/c2init.in, Mmake.common.in, tools/bootcheck, tools/binary # scripts/c2init.in, Mmake.workspace, tools/bootcheck, tools/binary
# and tools/binary_step. # and tools/binary_step.
STD_LIB_NAME=mer_std STD_LIB_NAME=mer_std

View File

@@ -10,21 +10,15 @@
MAIN_TARGET=trace MAIN_TARGET=trace
MERCURY_DIR=.. MERCURY_DIR=..
LINK_STDLIB_ONLY=yes
include $(MERCURY_DIR)/Mmake.common include $(MERCURY_DIR)/Mmake.common
-include Mmake.trace.params -include Mmake.trace.params
#-----------------------------------------------------------------------------# #-----------------------------------------------------------------------------#
M_ENV = MERCURY_ALL_C_INCL_DIRS="\ CFLAGS += -I$(BROWSER_DIR) -g $(DLL_CFLAGS) \
-I$(BROWSER_DIR) \ -DMERCURY_BOOTSTRAP_H -DMERCURY_CONF_BOOTSTRAP_H
-I$(LIBRARY_DIR) \ MGNUCFLAGS += --no-ansi
-I$(RUNTIME_DIR) \
-I$(BOEHM_GC_DIR) \
-I$(BOEHM_GC_DIR)/include \
"
CFLAGS = -g $(DLL_CFLAGS) -DMERCURY_BOOTSTRAP_H -DMERCURY_CONF_BOOTSTRAP_H
MGNUC = $(M_ENV) $(SCRIPTS_DIR)/mgnuc
MGNUCFLAGS = --no-ansi
#-----------------------------------------------------------------------------# #-----------------------------------------------------------------------------#
@@ -87,16 +81,8 @@ OBJ_CHECKS = $(OBJS:%=%.obj_check)
LDFLAGS = -L$(BROWSER_DIR) -L$(LIBRARY_DIR) \ LDFLAGS = -L$(BROWSER_DIR) -L$(LIBRARY_DIR) \
-L$(RUNTIME_DIR) -L$(BOEHM_GC_DIR) -L$(RUNTIME_DIR) -L$(BOEHM_GC_DIR)
LDLIBS = -l$(BROWSER_LIB_NAME) -l$(STD_LIB_NAME) -l$(RT_LIB_NAME) \ LDLIBS = -l$(BROWSER_LIB_NAME) $(MLLIBS) $(SOCKET_LIBRARY) \
` case "$(GRADE)" in \ $(NSL_LIBRARY) $(DL_LIBRARY) $(READLINE_LIBRARIES)
*.par*.gc*.prof*) echo "-lpar_gc_prof" ;; \
*.par*.gc*) echo "-lpar_gc" ;; \
*.gc*.prof*) echo "-lgc_prof" ;; \
*.gc*) echo "-lgc" ;; \
esac \
` \
$(SOCKET_LIBRARY) $(NSL_LIBRARY) $(DL_LIBRARY) \
$(READLINE_LIBRARIES)
THREADLIBS = \ THREADLIBS = \
` case "$(GRADE)" in \ ` case "$(GRADE)" in \
*.par*) echo "-lpthread" ;; \ *.par*) echo "-lpthread" ;; \