Files
mercury/browser/Mmakefile
Simon Taylor 5d693f5a1c 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.
2002-04-29 08:22:08 +00:00

178 lines
4.9 KiB
Plaintext

#-----------------------------------------------------------------------------#
# Copyright (C) 1998-2002 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.
#-----------------------------------------------------------------------------#
# browser/Mmakefile - this is the Mmakefile for building the Mercury
# browser library, which also includes other functionality needed
# by Mercury debuggers.
# Since the code in this directory is intended to be invoked only from
# the trace library, which turns off tracing in the Mercury code it calls,
# compiling the modules in this directory with tracing on only makes
# the generated code much bigger. However, since all Mercury code
# in an executable must be of the same grade, we need to be able to
# compile the modules in this directory in debug grades as well.
MERCURY_DIR=..
LINK_STDLIB_ONLY=yes
include $(MERCURY_DIR)/Mmake.common
MAIN_TARGET=library
#-----------------------------------------------------------------------------#
# Specify which compilers to use to compile the library.
# Don't change these without good reason - if you want to
# do a temporary change, change ../Mmake.params.
CFLAGS += $(DLL_CFLAGS) -I$(TRACE_DIR)
MLFLAGS += -R$(FINAL_INSTALL_MERC_LIB_DIR) \
-R$(FINAL_INSTALL_MERC_GC_LIB_DIR)
MLLIBS += $(SOCKET_LIBRARY) $(NSL_LIBRARY) $(DL_LIBRARY) \
$(READLINE_LIBRARIES)
# XXX Smart recompilation currently doesn't work when the module
# name doesn't match the file name, so disable warnings about it
# not working in this directory.
MCFLAGS += --no-warn-smart-recompilation
# XXX There is a bug in deforestation which causes the compiler
# to abort compiling declarative_user.m.
MCFLAGS-mdb.declarative_user = --no-deforestation
MTAGS = $(SCRIPTS_DIR)/mtags
LN = ln
#-----------------------------------------------------------------------------#
# Stuff for Windows DLLS using gnu-win32
ifeq ($(USE_DLLS),yes)
DLL_CFLAGS = -Dlib$(BROWSER_LIB_NAME)_DEFINE_DLL
include $(MERCURY_DIR)/Makefile.DLLs
else
DLL_CFLAGS =
DLL_DEF_LIB =
endif
#-----------------------------------------------------------------------------#
# targets
.PHONY: all
all : library browse_test declarative_test
.PHONY: depend
depend : mdb.depend browse_test.depend declarative_test.depend
.PHONY: check
check : mdb.check
.PHONY: all-ints
all-ints: ints int3s
.PHONY: ints
ints : mdb.ints browse_test.ints declarative_test.ints
.PHONY: int3s
int3s : mdb.int3s
#-----------------------------------------------------------------------------#
tags : $(MTAGS) $(mdb.ms)
$(MTAGS) $(mdb.ms) ../library/*.m
mdb.stats : $(COMPILER_DIR)/source_stats.awk $(mdb.ms)
awk -f $(COMPILER_DIR)/source_stats.awk \
`vpath_find $(mdb.ms)` > $@
#-----------------------------------------------------------------------------#
.PHONY: dates
dates :
touch $(mdb.dates)
#-----------------------------------------------------------------------------#
.PHONY: os cs ss
os: $(mdb.os)
cs: $(mdb.cs)
ss: $(mdb.ss)
#-----------------------------------------------------------------------------#
.PHONY: library
library: lib$(BROWSER_LIB_NAME).$A lib$(BROWSER_LIB_NAME).$(EXT_FOR_SHARED_LIB)
library: $(BROWSER_LIB_NAME).init
lib$(BROWSER_LIB_NAME)$(DLL_DEF_LIB).$A : libmdb.$A
rm -f lib$(BROWSER_LIB_NAME)$(DLL_DEF_LIB).$A
$(LN) libmdb.$A lib$(BROWSER_LIB_NAME)$(DLL_DEF_LIB).$A
lib$(BROWSER_LIB_NAME).so : libmdb.so
rm -f lib$(BROWSER_LIB_NAME)$(DLL_DEF_LIB).so
$(LN) libmdb.so lib$(BROWSER_LIB_NAME)$(DLL_DEF_LIB).so
$(BROWSER_LIB_NAME).init: $(deps_subdir)mdb.dep mdb.init
cp mdb.init $(BROWSER_LIB_NAME).init
# Ensure we recompile mdb__version if VERSION is changed.
$(os_subdir)mdb.o \
$(os_subdir)mdb.pic_o \
: $(RUNTIME_DIR)/mercury_conf.h
#-----------------------------------------------------------------------------#
realclean_local:
rm -f lib$(BROWSER_LIB_NAME).$A lib$(BROWSER_LIB_NAME).so \
$(BROWSER_LIB_NAME).init mdb.init
rm -f tags
#-----------------------------------------------------------------------------#
# Installation targets
.PHONY: install
install: install_init install_library
.PHONY: install_dirs
install_dirs:
[ -d $(INSTALL_MODULE_DIR) ] || mkdir -p $(INSTALL_MODULE_DIR)
[ -d $(INSTALL_MERC_LIB_DIR) ] || mkdir -p $(INSTALL_MERC_LIB_DIR)
ifeq ($(findstring il,$(GRADE)),il)
# there is no browser in the .NET backend
.PHONY: install_init
install_init:
.PHONY: install_library
install_library:
else
.PHONY: install_init
install_init: $(BROWSER_LIB_NAME).init install_dirs
cp `vpath_find $(BROWSER_LIB_NAME).init` $(INSTALL_MODULE_DIR)
.PHONY: install_library
install_library: lib$(BROWSER_LIB_NAME).$A \
lib$(BROWSER_LIB_NAME).$(EXT_FOR_SHARED_LIB) install_dirs
cp `vpath_find lib$(BROWSER_LIB_NAME).$A \
lib$(BROWSER_LIB_NAME).$(EXT_FOR_SHARED_LIB)` \
$(INSTALL_MERC_LIB_DIR)
endif