Files
mercury/browser/Mmakefile
Zoltan Somogyi b7e55aa8ad Enforce namespace cleanliness in the library and browser directories
Estimated hours taken: 6
Branches: main

Enforce namespace cleanliness in the library and browser directories
as well as in the runtime and trace directories.

Mmake.common.in:
	Move the rules check_namespace here (they used to be in the Mmakefiles
	of the runtime and trace directories), together with the variables they
	need. Generalize them to also handle the needs of the browser, library
	and bytecode directories. The former two in particular need the
	ability to check automatically generated .mh files.

	Make all the rules used by check_namespace conditional on a macro
	that is defined by the Makefiles in all the directories that are
	checked for namespace cleanliness.

trace/Mmakefile:
runtime/Mmakefile:
	Replace the old rules for check_namespace, which are now in
	../Mmake.common.in, with the macros needed to control their behavior.

bytecode/Mmakefile:
	Add the macros needed to control the behavior of the rules for
	check_namespace.

	Move the lists of files to the start, before the include of
	../Mmake.common.

browser/Mmakefile:
library/Mmakefile:
	Add the macros needed to control the behavior of the rules for
	check_namespace.

runtime/RESERVED_MACRO_NAMES:
	Update comments, and delete obsolete exceptions.

browser/RESERVED_MACRO_NAMES:
library/RESERVED_MACRO_NAMES:
	New files to contain the exceptions from the naming scheme.

tools/bootcheck:
	Invoke "mmake check_namespace" in the library and browser directories
	as well as the runtime and the trace directories. Perform the
	invocation before we delete the object files we are checking for
	cleanliness.

	Clean up object files in all stage2 directories, not just the library,
	as soon as we can.

library/array.m:
library/builtin.m:
library/io.m:
library/time.m:
	Fix namespace violations.
2002-09-24 06:55:36 +00:00

189 lines
5.1 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.
# Specify which files to check for namespace cleanliness, and which name
# prefixes are allowed.
CHECK_HDRS =
CHECK_MHDRS = $(mer_browser.mhs)
CHECK_OBJS = $(mer_browser.os)
ALLOW_LIB_PREFIX=yes
ALLOW_BROWSER_PREFIX=yes
MERCURY_DIR=..
LINK_STDLIB_ONLY=yes
include $(MERCURY_DIR)/Mmake.common
# Module-specific options should go in Mercury.options so they
# can be found by `mmc --make'.
include Mercury.options
MAIN_TARGET=library
MERCURY_MAIN_MODULES=$(BROWSER_LIB_NAME) browse_test declarative_test
#-----------------------------------------------------------------------------#
# 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)
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
DEPENDS = $(BROWSER_LIB_NAME).depend browse_test.depend declarative_test.depend
.PHONY: depend
depend : $(DEPENDS)
$(DEPENDS) : 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:
$(MC) -f *.m
.PHONY: check
check : $(BROWSER_LIB_NAME).check
.PHONY: all-ints
all-ints: ints int3s
.PHONY: ints
ints : $(BROWSER_LIB_NAME).ints \
browse_test.ints declarative_test.ints
.PHONY: int3s
int3s : $(BROWSER_LIB_NAME).int3s
#-----------------------------------------------------------------------------#
tags : $(MTAGS) $($(BROWSER_LIB_NAME).ms)
$(MTAGS) $($(BROWSER_LIB_NAME).ms) ../library/*.m
$(BROWSER_LIB_NAME).stats : $(COMPILER_DIR)/source_stats.awk \
$($(BROWSER_LIB_NAME).ms)
awk -f $(COMPILER_DIR)/source_stats.awk \
`vpath_find $($(BROWSER_LIB_NAME).ms)` > $@
#-----------------------------------------------------------------------------#
.PHONY: dates
dates :
touch $($(BROWSER_LIB_NAME).dates)
#-----------------------------------------------------------------------------#
.PHONY: os cs ss
ifeq ($(MMAKE_USE_MMC_MAKE),no)
os: $($(BROWSER_LIB_NAME).os)
cs: $($(BROWSER_LIB_NAME).cs)
ss: $($(BROWSER_LIB_NAME).ss)
else
os: $(BROWSER_LIB_NAME).os
cs: $(BROWSER_LIB_NAME).cs
ss: $(BROWSER_LIB_NAME).ss
endif
#-----------------------------------------------------------------------------#
.PHONY: library
library: lib$(BROWSER_LIB_NAME)
# Ensure we recompile mdb__version if VERSION is changed.
$(os_subdir)mdb.o \
$(os_subdir)mdb.pic_o \
: $(RUNTIME_DIR)/mercury_conf.h
#-----------------------------------------------------------------------------#
# In the past we generated libmdb.* and then linked
# libmer_browser.* to the files.
realclean_local:
rm -rf libmdb.so libmdb.a mdb.init
rm -f Mercury.modules 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