Files
mercury/compiler/Mmakefile
Tyson Dowd d1938d4019 Improve build and installation on MS-Windows.
Estimated hours taken: 3

Improve build and installation on MS-Windows.

configure.in:
Mmake.common.in:
	Set extension for executables (.exe for Windows, nothing
	otherwise).
	Detect presence of perl, makeinfo, texi2dvi and dvips.

Mmakefile:
README.MS-Windows:
	Remove old preinstall and postinstall hacks for windows.

compiler/Mmakefile:
profiler/Mmakefile:
util/Mmakefile:
	Use the extension for executables when installing.

doc/Mmakefile:
	Don't generate documentation unless the appropriate tools
	are available.  Use the auto-detection of perl,
	makeinfo, texi2dvi and dvips to build documentation.

doc/generate_mdb_doc:
	Don't insist on rm being in /bin
1999-07-20 21:30:02 +00:00

199 lines
6.1 KiB
Plaintext

#-----------------------------------------------------------------------------#
# Copyright (C) 1995-1999 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 - this is Mmake file for building the Mercury compiler
MERCURY_DIR=..
include $(MERCURY_DIR)/Mmake.common
MAIN_TARGET=mercury
VPATH=$(LIBRARY_DIR)
#-----------------------------------------------------------------------------#
# Specify which compilers to use to compile the compiler.
# 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$(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="$(BROWSER_DIR)/$(BROWSER_LIB_NAME).init $(LIBRARY_DIR)/$(STD_LIB_NAME).init $(RUNTIME_DIR)/$(RT_LIB_NAME).init" \
MERCURY_MKINIT=$(UTIL_DIR)/mkinit $(SCRIPTS_DIR)/c2init
ML = MERCURY_C_LIB_DIR=. $(SCRIPTS_DIR)/ml
MLFLAGS = --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 \
*.gc*.prof*) echo $(BOEHM_GC_DIR)/libgc_prof.a ;; \
*.gc*) echo $(BOEHM_GC_DIR)/libgc.a ;; \
esac \
` -lm
MTAGS = $(SCRIPTS_DIR)/mtags
MTAGSFLAGS =
#-----------------------------------------------------------------------------#
# Rules for preprocessing `.pp' files.
# `.pp_date' files are used as timestamps as for interface files.
ifeq ($(INCLUDE_ADITI_OUTPUT),yes)
# Remove the #if line and everything between the #else and #endif lines.
$(dates_subdir)%.pp_date: %.pp
m_file=$(<:.pp=.m); \
[ ! -f $$m_file ] || chmod +w $$m_file; \
sed -e '/^#if *INCLUDE_ADITI_OUTPUT/s/.*//' \
-e '/^#else/,/^#endif/s/.*//' \
$< > $$m_file.tmp; \
mercury_update_interface -v $$m_file; \
touch $@; \
chmod -w $$m_file
else
# Remove everything between the #if line and the #else line,
# and the #endif line.
$(dates_subdir)%.pp_date: %.pp
m_file=$(<:.pp=.m); \
[ ! -f $$m_file ] || chmod +w $$m_file; \
sed -e '/^#if *INCLUDE_ADITI_OUTPUT/,/^#else/s/.*//' \
-e '/^#endif/s/.*//' \
$< > $$m_file.tmp; \
mercury_update_interface -v $$m_file; \
touch $@; \
chmod -w $$m_file
endif
PREPROCESSED_MODULES = rl_file rl_out
PREPROCESSED_FILES = $(PREPROCESSED_MODULES:%=%.pp)
PREPROCESSED_M_FILES = $(PREPROCESSED_MODULES:%=%.m)
PP_DATE_FILES = $(PREPROCESSED_MODULES:%=$(dates_subdir)%.pp_date)
# Force regeneration of the preprocessed modules.
# This is necessary if the setting of `INCLUDE_ADITI_OUTPUT' has changed.
regenerate_preprocessed_files:
touch $(PREPROCESSED_FILES)
$(MMAKE) $(PREPROCESSED_M_FILES)
# The `.m' files for the preprocessed modules depend on the `.pp_date' files.
$(PREPROCESSED_M_FILES): %.m: $(dates_subdir)%.pp_date
@:
#-----------------------------------------------------------------------------#
# targets
#
# mercury_compile
.PHONY: depend
depend: mercury_compile.depend
mercury_compile.depend: regenerate_preprocessed_files
.PHONY: all
all: mercury
.PHONY: mercury
mercury: mercury_compile
#-----------------------------------------------------------------------------#
# Add some additional dependencies, so that Mmake knows to remake the
# compiler if one of the libraries changes.
mercury_compile: $(RUNTIME_DIR)/lib$(RT_LIB_NAME).a
mercury_compile: $(LIBRARY_DIR)/lib$(STD_LIB_NAME).a
mercury_compile: $(BROWSER_DIR)/lib$(BROWSER_LIB_NAME).a
mercury_compile: $(TRACE_DIR)/lib$(TRACE_LIB_NAME).a
# Should also depend on $(BOEHM_GC_DIR)/libgc(_prof).a, but only
# if in .gc(.prof) grade; GNU make does not support dynamic dependencies,
# so just leave it out.
mercury_compile_init.c: $(UTIL_DIR)/mkinit
#-----------------------------------------------------------------------------#
.PHONY: check
check : mercury_compile.check
.PHONY: ints
ints : mercury_compile.ints
#-----------------------------------------------------------------------------#
tags : $(mercury_compile.ms) $(LIBRARY_DIR)/*.m
$(MTAGS) $(MTAGSFLAGS) $(mercury_compile.ms) $(LIBRARY_DIR)/*.m
mercury_compile.stats : source_stats.awk $(mercury_compile.ms)
awk -f `vpath_find source_stats.awk` \
`vpath_find $(mercury_compile.ms)` > $@
#-----------------------------------------------------------------------------#
.PHONY: dates
dates :
touch $(mercury_compile.dates)
#-----------------------------------------------------------------------------#
.PHONY: os cs
os: $(mercury_compile.os) $(os_subdir)mercury_compile_init.o
cs: $(mercury_compile.cs) $(cs_subdir)mercury_compile_init.c
#-----------------------------------------------------------------------------#
clean:
for file in *.pp; do \
if [ "$$file" != "*.pp" ]; then \
rm -f `basename $$file .pp`.m; \
fi; \
done
realclean:
rm -f tags mercury_compile.stats $(PP_DATE_FILES)
#-----------------------------------------------------------------------------#
#-----------------------------------------------------------------------------#
# Installation targets
.PHONY: install
install: install_mercury
.PHONY: install_all
install_all: install_mercury
.PHONY: install_mercury
install_mercury: install_compiler
.PHONY: install_dirs
install_dirs:
-[ -d $(INSTALL_MERC_BIN_DIR) ] || mkdir -p $(INSTALL_MERC_BIN_DIR)
.PHONY: install_compiler
install_compiler: mercury_compile install_dirs
cp `vpath_find mercury_compile$(EXT_FOR_EXE)` $(INSTALL_MERC_BIN_DIR)
#-----------------------------------------------------------------------------#