mirror of
https://github.com/Mercury-Language/mercury.git
synced 2026-04-22 21:03:53 +00:00
*/Mmake: Make sure that the rules for `mmake clean' and `mmake realclean' remove a few files that we'd missed. Change the rules for making tags so that it uses the local version of `mtags' (i.e. ../scripts/mtags) rather than the installed one.
170 lines
5.2 KiB
Plaintext
170 lines
5.2 KiB
Plaintext
#-----------------------------------------------------------------------------#
|
|
|
|
# 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
|
|
|
|
MCD = MERCURY_INT_DIR=. $(MC) --generate-dependencies
|
|
MCI = MERCURY_INT_DIR=$(LIBRARY_DIR) $(MC) --make-interface
|
|
MCG = MERCURY_C_INCL_DIR=$(RUNTIME_DIR) \
|
|
MERCURY_INT_DIR=$(LIBRARY_DIR) $(MC) --compile-to-c
|
|
MCS = MERCURY_C_INCL_DIR=$(RUNTIME_DIR) \
|
|
MERCURY_INT_DIR=$(LIBRARY_DIR) \
|
|
$(MC) --cflags -I$(BOEHM_GC_DIR) --split-c-files -c
|
|
MGNUC = MERCURY_C_INCL_DIR=$(RUNTIME_DIR) $(SCRIPTS_DIR)/mgnuc
|
|
MGNUCFLAGS = -I$(BOEHM_GC_DIR) $(EXTRA_CFLAGS)
|
|
C2INIT = \
|
|
MERCURY_MOD_LIB_MODS="$(RUNTIME_DIR)/runtime.init $(LIBRARY_DIR)/library.init" \
|
|
MERCURY_MKINIT=$(UTIL_DIR)/mkinit $(SCRIPTS_DIR)/c2init
|
|
ML = MERCURY_C_LIB_DIR=. $(SCRIPTS_DIR)/ml
|
|
MLFLAGS = --no-libs $(EXTRA_MLFLAGS)
|
|
MLLIBS = $(EXTRA_MLLIBS) $(LIBRARY_DIR)/libmercury.a \
|
|
$(RUNTIME_DIR)/libmer.a ` \
|
|
case $(GRADE) in \
|
|
*.gc.prof) echo $(BOEHM_GC_DIR)/libgc_prof.a ;; \
|
|
*.gc) echo $(BOEHM_GC_DIR)/libgc.a ;; \
|
|
esac \
|
|
` -lm
|
|
MSC = MERCURY_SICSTUS_COMPILER=$(LIBRARY_DIR)/sicstus_compile \
|
|
$(SCRIPTS_DIR)/msc
|
|
MSL = MERCURY_SP_LIB_DIR=$(LIBRARY_DIR) $(SCRIPTS_DIR)/msl
|
|
MNC = MERCURY_NC_BUILTIN=$(LIBRARY_DIR)/nc_builtin.nl \
|
|
$(SCRIPTS_DIR)/mnc
|
|
MNL = MERCURY_NU_LIB_DIR=$(LIBRARY_DIR) $(SCRIPTS_DIR)/mnl
|
|
MNLFLAGS = -u 6000
|
|
MTAGS = $(SCRIPTS_DIR)/mtags
|
|
|
|
#-----------------------------------------------------------------------------#
|
|
|
|
# targets
|
|
#
|
|
# mercury_compile
|
|
# mercury_compile.nu
|
|
# mercury_compile.nu.debug
|
|
# mercury_compile.sicstus
|
|
# mercury_compile.sicstus.debug
|
|
|
|
.PHONY: depend
|
|
depend : mercury_compile.depend
|
|
|
|
# we need to make sure the .pp files get converted to .m before
|
|
# we do the make depend
|
|
mercury_compile.depend: mercury_compile.m optimize.m code_gen.m
|
|
|
|
.PHONY: all
|
|
all : mercury nuprolog sicstus
|
|
|
|
.PHONY: mercury
|
|
mercury: mercury_compile
|
|
|
|
.PHONY: nuprolog
|
|
nuprolog: mercury_compile.nu
|
|
|
|
.PHONY: sicstus
|
|
sicstus: mercury_compile.sicstus
|
|
|
|
#-----------------------------------------------------------------------------#
|
|
|
|
# Add some additional dependencies, so that Mmake knows to remake the
|
|
# compiler if one of the libraries changes.
|
|
|
|
mercury_compile: $(RUNTIME_DIR)/libmer.a $(LIBRARY_DIR)/libmercury.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.sicstus: $(LIBRARY_DIR)/library.sicstus.debug
|
|
mercury_compile.sicstus.debug: $(LIBRARY_DIR)/library.sicstus.debug
|
|
|
|
mercury_compile_init.c: $(UTIL_DIR)/mkinit
|
|
|
|
#-----------------------------------------------------------------------------#
|
|
|
|
.PHONY: check
|
|
check : mercury_compile.check
|
|
|
|
.PHONY: ints
|
|
ints : mercury_compile.ints
|
|
|
|
#-----------------------------------------------------------------------------#
|
|
|
|
tags : $(MTAGS) *.pp $(mercury_compile.ms) $(LIBRARY_DIR)/*.m
|
|
$(MTAGS) *.pp $(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) mercury_compile_init.o
|
|
cs: $(mercury_compile.cs) mercury_compile_init.c
|
|
|
|
#-----------------------------------------------------------------------------#
|
|
|
|
clean:
|
|
for file in *.pp; do \
|
|
rm -f `basename $$file .pp`.m; \
|
|
done
|
|
|
|
realclean:
|
|
rm -f tags mercury_compile.stats
|
|
|
|
#-----------------------------------------------------------------------------#
|
|
#-----------------------------------------------------------------------------#
|
|
|
|
# Installation targets
|
|
|
|
.PHONY: install
|
|
install: install_mercury
|
|
|
|
.PHONY: install_all
|
|
install_all: install_mercury install_nuprolog install_sicstus
|
|
|
|
.PHONY: install_mercury
|
|
install_mercury: install_compiler
|
|
|
|
.PHONY: install_nuprolog
|
|
install_nuprolog: install_compiler_nu
|
|
|
|
.PHONY: install_sicstus
|
|
install_sicstus: install_compiler_sicstus
|
|
|
|
.PHONY: install_compiler
|
|
install_compiler: mercury_compile
|
|
-[ -d $(INSTALL_MERC_BIN_DIR) ] || mkdir -p $(INSTALL_MERC_BIN_DIR)
|
|
cp `vpath_find mercury_compile` $(INSTALL_MERC_BIN_DIR)
|
|
|
|
.PHONY: install_compiler_nu
|
|
install_compiler_nu: mercury_compile.nu
|
|
-[ -d $(INSTALL_NU_ARCH_DIR) ] || mkdir -p $(INSTALL_NU_ARCH_DIR)
|
|
sed "s^`pwd`^$(INSTALL_NU_ARCH_DIR)^g" `vpath_find mercury_compile.nu` \
|
|
> $(INSTALL_NU_ARCH_DIR)/mercury_compile.nu
|
|
-chmod +x $(INSTALL_NU_ARCH_DIR)/mercury_compile.nu
|
|
cp `vpath_find mercury_compile.nu.save` $(INSTALL_NU_ARCH_DIR)
|
|
|
|
.PHONY: install_compiler_sicstus
|
|
install_compiler_sicstus: mercury_compile.sicstus
|
|
-[ -d $(INSTALL_SP_ARCH_DIR) ] || mkdir -p $(INSTALL_SP_ARCH_DIR)
|
|
cp `vpath_find mercury_compile.sicstus` $(INSTALL_SP_ARCH_DIR)
|
|
|
|
#-----------------------------------------------------------------------------#
|