#-----------------------------------------------------------------------------# # Copyright (C) 1998-2003 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 -include Mmake.browser.params # Module-specific options should go in Mercury.options so they # can be found by `mmc --make'. include Mercury.options MAIN_TARGET=library MERCURY_MAIN_LIB_MODULES=$(BROWSER_LIB_NAME) $(MDBCOMP_LIB_NAME) MERCURY_MAIN_MODULES=$(MERCURY_MAIN_LIB_MODULES) browse_test declarative_test DEPENDS = $(patsubst %,%.depend,$(MERCURY_MAIN_MODULES)) INTS = $(patsubst %,%.int,$(MERCURY_MAIN_MODULES)) INT3S = $(patsubst %,%.int3,$(MERCURY_MAIN_MODULES)) LIBS = $(patsubst %,lib%,$(MERCURY_MAIN_LIB_MODULES)) CHECKS = $(patsubst %,%.check,$(MERCURY_MAIN_LIB_MODULES)) #-----------------------------------------------------------------------------# # 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, or create Mmake.browser.params. CFLAGS += $(DLL_CFLAGS) -I$(TRACE_DIR) MLFLAGS += -R$(FINAL_INSTALL_MERC_LIB_DIR) \ -R$(FINAL_INSTALL_MERC_GC_LIB_DIR) MCFLAGS += -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) # XXX what do we need here for MDCOMP_LIB_NAME? DLL_CFLAGS = -Dlib$(BROWSER_LIB_NAME)_DEFINE_DLL include $(MERCURY_DIR)/Makefile.DLLs else DLL_CFLAGS = DLL_DEF_LIB = endif #-----------------------------------------------------------------------------# # targets .PHONY: library library: $(LIBS) .PHONY: all all: library browse_test declarative_test .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) $(ALL_MCFLAGS) -f *.m .PHONY: check check: $(CHECKS) .PHONY: all-ints all-ints: ints int3s .PHONY: ints ints: $(INTS) .PHONY: int3s int3s: $(INT3S) #-----------------------------------------------------------------------------# tags: $(MTAGS) $($(BROWSER_LIB_NAME).ms) $($(MDBCOMP_LIB_NAME).ms) $(MTAGS) $($(BROWSER_LIB_NAME).ms) $($(MDBCOMP_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)` > $@ $(MDCOMP_LIB_NAME).stats: $(COMPILER_DIR)/source_stats.awk \ $($(MDCOMP_LIB_NAME).ms) awk -f $(COMPILER_DIR)/source_stats.awk \ `vpath_find $($(MDCOMP_LIB_NAME).ms)` > $@ #-----------------------------------------------------------------------------# .PHONY: dates dates: touch $($(BROWSER_LIB_NAME).dates) $($(MDBCOMP_LIB_NAME).dates) #-----------------------------------------------------------------------------# .PHONY: os cs ss ils ifeq ($(MMAKE_USE_MMC_MAKE),no) os: $($(BROWSER_LIB_NAME).os) $($(MDBCOMP_LIB_NAME).os) cs: $($(BROWSER_LIB_NAME).cs) $($(MDBCOMP_LIB_NAME).cs) ss: $($(BROWSER_LIB_NAME).ss) $($(MDBCOMP_LIB_NAME).ss) ils: $($(BROWSER_LIB_NAME).ils) $($(MDBCOMP_LIB_NAME).ils) else os: $(BROWSER_LIB_NAME).os $(MDBCOMP_LIB_NAME).os cs: $(BROWSER_LIB_NAME).cs $(MDBCOMP_LIB_NAME).cs ss: $(BROWSER_LIB_NAME).ss $(MDBCOMP_LIB_NAME).ss ils: $(BROWSER_LIB_NAME).ils $(MDBCOMP_LIB_NAME).ils endif #-----------------------------------------------------------------------------# # Ensure we recompile mdb__version if VERSION is changed. $(os_subdir)mdb.o \ $(os_subdir)mdb.pic_o \ $(os_subdir)mdbcomp.o \ $(os_subdir)mdbcomp.pic_o \ : $(RUNTIME_DIR)/mercury_conf.h #-----------------------------------------------------------------------------# realclean_local: 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 $(MDBCOMP_LIB_NAME).init install_dirs cp `vpath_find $(BROWSER_LIB_NAME).init` $(INSTALL_MODULE_DIR) cp `vpath_find $(MDBCOMP_LIB_NAME).init` $(INSTALL_MODULE_DIR) .PHONY: install_library install_library: \ lib$(BROWSER_LIB_NAME).$A \ lib$(BROWSER_LIB_NAME).$(EXT_FOR_SHARED_LIB) \ lib$(MDBCOMP_LIB_NAME).$A \ lib$(MDBCOMP_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) cp `vpath_find lib$(MDBCOMP_LIB_NAME).$A \ lib$(MDBCOMP_LIB_NAME).$(EXT_FOR_SHARED_LIB)` \ $(INSTALL_MERC_LIB_DIR) $(RANLIB) $(INSTALL_MERC_LIB_DIR)/lib$(BROWSER_LIB_NAME).$A $(RANLIB) $(INSTALL_MERC_LIB_DIR)/lib$(MDBCOMP_LIB_NAME).$A endif