mirror of
https://github.com/Mercury-Language/mercury.git
synced 2026-04-15 01:13:30 +00:00
Fix some problems that were preventing the system from compiling properly with MSVC. (1) Visual Studio 2013 no longer includes the files NtWin32.Mak and Win32.Mak which are required for building the Boehm GC with MSVC. (This appears to be an issue with upstream Boehm as well.) The workaround here is to reference the copies of this files included with the Windows 7 SDK. (This appears to be the official Microsoft workaround for dealing with this problem for now.) (2) Disable support for `--c-debug' when using MSVC. Using this option causes MSVC to emit .pdb (Program Data Base), that contain the symbol information for an object files. This causes a variety of problems: (i) parallel builds are contending for the vc*.pdb file shared by all the object files in a directory causing compilation to abort. (Compiling with the -FS option is another solution to this -- it causes the compiler to serialize access to the .pdb file -- but at the cost of slowing down compilation.) (ii) .pdb files are not cleaned up by realclean; compilation will abort if a pdb file generated by a different version of MSVC is encountered. (iii) we don't install the .pdb files alongside the libraries anyway. This can be a source of linker warnings. (And shutting up the Microsoft linker seems to be very difficult indeed ...) (iv) compiling with -Zi (apparently) inhibits some C compiler optimizations. Compiling with the older -Z7 (MSVC 7 style debugging info) option is another alternative. Using that option causes MSVC to include symbol information in the object files, instead of in a separate file. For now (i.e. the 14.01 release), disabling `--c-debug' for MSVC is the simplest way of addressing the above issues. README.MS-VisualC: Describe the problem with NtWin32.Mak and Visual Studio 2013 and provide two possible workarounds. Mention that `--c-debug' is not currently supported with MSVC and how to re-enable it. Simplify some of the instructions for setting up the build environment. configure.ac: scripts/mgnuc.in: Disable `--c-debug' with MSVC. scripts/prepare_install_dir.in: Copy all makefile fragments for nmake into the boehm_gc directory for the library grade installation. (This is in case the user copies NtWin32.Mak etc into the boehm_gc directory as per the second of the workarounds in README.MS-VisualC.) slice/Mmakefile: compiler/Mmakefile: deep_profiler/Mmakefile: mfilterjavac/Mmakefile: profiler/Mmakefile: slice/Mmakefile: Clean up any .pdb files. Note that one is generated for each executable (regardless of whether -Zi is given to cl or not). In addition, if -Zi is given to cl, there will be file named vc<version>.pdb generated (where <version> is the version of MSVC being used.)
143 lines
4.1 KiB
Plaintext
143 lines
4.1 KiB
Plaintext
#-----------------------------------------------------------------------------#
|
|
# Copyright (C) 2013 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 mfilterjavac tool.
|
|
|
|
MERCURY_DIR=..
|
|
LINK_STATIC=yes
|
|
include $(MERCURY_DIR)/Mmake.common
|
|
|
|
#----------------------------------------------------------------------------#
|
|
|
|
-include Mmake.mfilterjavac.params
|
|
|
|
# Override the default rule in `mmake --use-mmc-make' that asks `mmc' to
|
|
# create a missing optional params file.
|
|
Mmake.mfilterjavac.params:
|
|
|
|
# Module-specific options should go in Mercury.options so they
|
|
# can be found by `mmc --make'. But this hasn't been used in this directory
|
|
# so it's commented out.
|
|
# include Mercury.options
|
|
|
|
MAIN_TARGET = all
|
|
|
|
ALL_MODULES = mfilterjavac
|
|
|
|
MAIN_TARGET=all
|
|
MERCURY_MAIN_MODULES=$(ALL_MODULES)
|
|
DEPEND=$(patsubst %,%.depend,$(ALL_MODULES))
|
|
PDBS=$(patsubst %,%.pdb,$(ALL_MODULES))
|
|
|
|
VPATH = $(LIBRARY_DIR) $(SSDB_DIR)
|
|
|
|
#-----------------------------------------------------------------------------#
|
|
|
|
MLFLAGS += --shared
|
|
MCFLAGS += --flags MFILTERJAVAC_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 il% csharp% java% erlang%,$(GRADE))","")
|
|
MLOBJS =
|
|
endif
|
|
|
|
#-----------------------------------------------------------------------------#
|
|
|
|
.PHONY: nothing
|
|
nothing:
|
|
|
|
.PHONY: depend
|
|
depend: $(DEPEND)
|
|
|
|
$(DEPEND): MFILTERJAVAC_FLAGS
|
|
|
|
.PHONY: all
|
|
all: $(ALL_MODULES) $(TAGS_FILE_EXISTS)
|
|
|
|
#-----------------------------------------------------------------------------#
|
|
|
|
# Add some additional dependencies, so that Mmake knows to remake the
|
|
# profiler if one of the libraries changes.
|
|
|
|
ifeq ("$(filter il% csharp% java% erlang%,$(GRADE))","")
|
|
mfilterjavac: $(RUNTIME_DIR)/lib$(RT_LIB_NAME).$A
|
|
mfilterjavac: $(LIBRARY_DIR)/lib$(STD_LIB_NAME).$A
|
|
endif
|
|
|
|
$(cs_subdir)mfilterjavac.c: $(UTIL_DIR)/mkinit$(EXT_FOR_EXE)
|
|
|
|
#-----------------------------------------------------------------------------#
|
|
|
|
.PHONY: check
|
|
check: DEPEND=$(patsubst %,%.check,$(ALL_MODULES))
|
|
|
|
.PHONY: ints
|
|
ints: DEPEND=$(patsubst %,%.ints,$(ALL_MODULES))
|
|
|
|
#-----------------------------------------------------------------------------#
|
|
|
|
# We need the shenanigans with .mfilterjavac_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: .mfilterjavac_tags
|
|
|
|
MS = \
|
|
$(mfilterjavac.ms)
|
|
|
|
.mfilterjavac_tags: $(MTAGS) $(MS) \
|
|
$(wildcard $(LIBRARY_DIR)/*.m)
|
|
$(MTAGS) $(MS) $(LIBRARY_DIR)/*.m
|
|
@touch .mfilterjavac_tags
|
|
|
|
.PHONY: tags_file_exists
|
|
tags_file_exists:
|
|
@if test ! -f tags; then echo making tags; \
|
|
$(MTAGS) $(MS) $(LIBRARY_DIR)/*.m; \
|
|
touch .mfilterjavac_tags; \
|
|
fi
|
|
|
|
#-----------------------------------------------------------------------------#
|
|
|
|
.PHONY: dates
|
|
dates:
|
|
touch $(mfilterjavac.dates)
|
|
|
|
#-----------------------------------------------------------------------------#
|
|
|
|
.PHONY: os cs
|
|
os: $(mfilterjavac.os) $(os_subdir)mfilterjavac_init.o
|
|
cs: $(mfilterjavac.cs) $(cs_subdir)mfilterjavac_init.c
|
|
|
|
#-----------------------------------------------------------------------------#
|
|
|
|
realclean_local:
|
|
rm -f .mfilterjavac_tags tags MFILTERJAVAC_FLAGS MFILTERJAVAC_FLAGS.date
|
|
rm -f $(PDBS) vc*.pdb
|
|
|
|
#-----------------------------------------------------------------------------#
|
|
|
|
# Installation target
|
|
|
|
.PHONY: install
|
|
install: mfilterjavac
|
|
-[ -d $(INSTALL_MERC_BIN_DIR) ] || mkdir -p $(INSTALL_MERC_BIN_DIR)
|
|
cp `vpath_find mfilterjavac$(EXT_FOR_EXE)` \
|
|
$(INSTALL_MERC_BIN_DIR)/mfilterjavac
|
|
|
|
#-----------------------------------------------------------------------------#
|