# This is the developer's -*- Makefile -*-, not the user's Makefile.
# Do not use it unless you know exactly what you are doing!
# Expects GNU make

# Some important programs:
SHELL = /bin/sh
# Don't set MAKE here. Instead use the value of the environment variable 'MAKE'
# or, if that is not set, the name of the current program.
# MAKE = make
CPP = gcc -E
PERL = perl
GROFF = nroff -man
# GROFF = groff -mandoc
RM = rm -f
RMRF = rm -rf
CP = cp -afv
WGET = wget --execute netrc=off --no-verbose --retry-connrefused --timeout=60
GIT = git
# http://ctags.sourceforge.net
CTAGS = ctags

# Shortcut (evaluated by make once only).
CURDIR=$(shell pwd)

# List of targets that do not correspond to files on disk.
.PHONY : all build-prerequisites htmldoc makefiles configures check-configures \
	update-ansi-tests update-asdf update-gmalloc potfiles fixperms \
	view-man view-html check-sbcl install-gcc \
	multibuild-linux-x86 multibuild-darwin-powerpc \
	build-aux-update gnulib-imported distrib release pre-release \
	upload upload-ssh upload-sf upload-gnu \
	src-distrib doc-distrib gnu-distrib tag-release tp-mail


# ==============================================================================
# Targets that create files for use in the distribution. Run at any moment.

all : build-prerequisites makefiles potfiles htmldoc

# ------------------------------------------------------------------------------
# Create files that are necessary for building CLISP.

build-prerequisites : check-configures fixperms                              \
                      src/version.h                                          \
                      src/ari_asm_arm-macro.c                                \
                      src/ari_asm_hppa-macro.c                               \
                      src/ari_asm_i386-macro.c    src/sp_asm_i386-macro.c    \
                                                  src/sp_asm_m68k-macro.c    \
                      src/ari_asm_mips-macro.c    src/sp_asm_mips-macro.c    \
                      src/ari_asm_mips64-macro.c                             \
                      src/ari_asm_sparc-macro.c   src/sp_asm_sparc-macro.c   \
                      src/ari_asm_sparc64-macro.c src/sp_asm_sparc64-macro.c

# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# Create the configure files.

MODULES=berkeley-db clx/new-clx dirkey fastcgi i18n oracle pari pcre dbus \
  postgresql rawsock readline regexp syscalls zlib gtk2 gdbm libsvm
CONFIG_H_IN = src/config.h.in $(patsubst %,modules/%/config.h.in,$(MODULES))
MOD_CONFIGURES=$(patsubst %,modules/%/configure,$(MODULES))
CONFIGURES=src/configure $(MOD_CONFIGURES)

configures : $(CONFIGURES) $(CONFIG_H_IN) src/gllib/Makefile.in

src/aclocal.m4 : $(wildcard src/m4/*.m4) $(wildcard src/glm4/*.m4) \
			$(addsuffix .in,$(CONFIGURES))
	$(RM) src/configure.ac
	$(CP) src/configure.in src/configure.ac
	cat $(addsuffix .in,$(MOD_CONFIGURES)) | \
	egrep -v -e 'AC_(INIT|PREREQ|CANONICAL_|GNU_SOURCE|CONFIG_HEADER|OUTPUT)' \
		-e 'AC_CONFIG_FILE.*(Makefile|link\.sh)' -e 'AM_INIT_AUTOMAKE' \
		>> src/configure.ac
	cd src && aclocal --output=aclocal.m4 -I m4 -I glm4
	$(RM) src/configure.ac

AUTOCONF_FILES = src/aclocal.m4
AUTOCONF_CACHE = autom4te.cache

$(CONFIGURES) : %/configure : %/configure.in $(AUTOCONF_FILES) version.sh
# Need to remove $(AUTOCONF_CACHE) before running autotonf, otherwise
# changes to version.sh are not taken into account.
	cd $* && $(RMRF) $(AUTOCONF_CACHE) && autoconf --include=$(CURDIR)/src

$(CONFIG_H_IN) : %/config.h.in : %/configure.in $(AUTOCONF_FILES)
	cd $* && autoheader --include=$(CURDIR)/src

src/gllib/Makefile.in : src/gllib/Makefile.am src/configure.in src/aclocal.m4
	cd src && automake --gnits gllib/Makefile && \
	sed -i -e 's,$$(top_srcdir)/src/build-aux,$$(top_srcdir)/build-aux,' \
		gllib/Makefile.in

# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# Syntax check of the configure files.

check-configures : configures
	set -e; for f in $(CONFIGURES); do bash -x -n $$f; done
	$(RMRF) `find . -name $(AUTOCONF_CACHE)`;

# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# Fix execution permissions of files.

fixperms :
	./utils/fix-perms.sh

# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# Create src/version.h.

src/version.h: version.sh
	. ./version.sh ; { \
	  echo "/* generated by Makefile.devel from version.sh */" ; \
	  echo "#define PACKAGE_NAME \"GNU CLISP\"" ; \
	  echo "#define PACKAGE_TARNAME \"clisp\"" ; \
	  echo "#define PACKAGE_VERSION \"$$VERSION_NUMBER ($$RELEASE_DATE)\"" ; \
	  echo "#define PACKAGE_STRING \"GNU CLISP $$VERSION_NUMBER ($$RELEASE_DATE)\"" ; \
	  echo "#define PACKAGE_BUGREPORT \"http://clisp.org/\""; \
	} > src/version.h

# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# Translate Linux assembler syntax to portable (macro-ized) assembler syntax.

src/ari_asm_alpha-macro.c : src/ari_asm_alpha.d src/asm-alpha.sh
	cd src \
	  && sed -f ../utils/comment5.sed ari_asm_alpha.d | $(CPP) - | grep -v '^#' | grep -v '^ *#line' | sed -e 's,% ,%,g' -e 's,\. ,.,g' > ari_asm_alpha-linux.s \
	  && { ./asm-alpha.sh < ari_asm_alpha-linux.s; cat noexecstack.h; } > ari_asm_alpha-macro.c \
	  && rm -f ari_asm_alpha-linux.s
src/sp_asm_alpha-macro.c : src/sp_asm_alpha.d src/asm-alpha.sh
	cd src \
	  && sed -f ../utils/comment5.sed sp_asm_alpha.d | $(CPP) - | grep -v '^#' | grep -v '^ *#line' | sed -e 's,% ,%,g' -e 's,\. ,.,g' > sp_asm_alpha-linux.s \
	  && { ./asm-alpha.sh < sp_asm_alpha-linux.s; cat noexecstack.h; } > sp_asm_alpha-macro.c \
	  && rm -f sp_asm_alpha-linux.s

src/ari_asm_arm-macro.c : src/ari_asm_arm.d src/asm-arm.sh
	cd src \
	  && sed -f ../utils/comment5.sed ari_asm_arm.d | $(CPP) - | grep -v '^#' | grep -v '^ *#line' | sed -e 's,% ,%,g' -e 's,\. ,.,g' > ari_asm_arm-linux.s \
	  && { echo '#include "asm-arm.h"'; ./asm-arm.sh < ari_asm_arm-linux.s | sed -e 's,%%,#,g'; cat noexecstack-arm.h; } > ari_asm_arm-macro.c \
	  && rm -f ari_asm_arm-linux.s
src/sp_asm_arm-macro.c : src/sp_asm_arm.d src/asm-arm.sh
	cd src \
	  && sed -f ../utils/comment5.sed sp_asm_arm.d | $(CPP) - | grep -v '^#' | grep -v '^ *#line' | sed -e 's,% ,%,g' -e 's,\. ,.,g' > sp_asm_arm-linux.s \
	  && { echo '#include "asm-arm.h"'; ./asm-arm.sh < sp_asm_arm-linux.s | sed -e 's,%%,#,g'; cat noexecstack-arm.h; } > sp_asm_arm-macro.c \
	  && rm -f sp_asm_arm-linux.s

src/ari_asm_arm64-macro.c : src/ari_asm_arm64.d src/asm-arm.sh
	cd src \
	  && sed -f ../utils/comment5.sed ari_asm_arm64.d | $(CPP) - | grep -v '^#' | grep -v '^ *#line' | sed -e 's,% ,%,g' -e 's,\. ,.,g' > ari_asm_arm64-linux.s \
	  && { echo '#include "asm-arm.h"'; ./asm-arm.sh < ari_asm_arm64-linux.s; cat noexecstack-arm.h; } > ari_asm_arm64-macro.c \
	  && rm -f ari_asm_arm64-linux.s
src/sp_asm_arm64-macro.c : src/sp_asm_arm64.d src/asm-arm.sh
	cd src \
	  && sed -f ../utils/comment5.sed sp_asm_arm64.d | $(CPP) - | grep -v '^#' | grep -v '^ *#line' | sed -e 's,% ,%,g' -e 's,\. ,.,g' > sp_asm_arm64-linux.s \
	  && { echo '#include "asm-arm.h"'; ./asm-arm.sh < sp_asm_arm64-linux.s; cat noexecstack-arm.h; } > sp_asm_arm64-macro.c \
	  && rm -f sp_asm_arm64-linux.s

src/ari_asm_hppa-macro.c : src/ari_asm_hppa.d src/asm-hppa.sh
	cd src \
	  && sed -f ../utils/comment5.sed ari_asm_hppa.d | $(CPP) - | grep -v '^#' | grep -v '^ *#line' | sed -e 's,% ,%,g' -e 's,\. ,.,g' > ari_asm_hppa-linux.s \
	  && { echo '#include "asm-hppa.h"'; ./asm-hppa.sh < ari_asm_hppa-linux.s; cat noexecstack.h; } > ari_asm_hppa-macro.c \
	  && rm -f ari_asm_hppa-linux.s
src/sp_asm_hppa-macro.c : src/sp_asm_hppa.d src/asm-hppa.sh
	cd src \
	  && sed -f ../utils/comment5.sed sp_asm_hppa.d | $(CPP) - | grep -v '^#' | grep -v '^ *#line' | sed -e 's,% ,%,g' -e 's,\. ,.,g' > sp_asm_hppa-linux.s \
	  && { echo '#include "asm-hppa.h"'; ./asm-hppa.sh < sp_asm_hppa-linux.s; cat noexecstack.h; } > sp_asm_hppa-macro.c \
	  && rm -f sp_asm_hppa-linux.s

src/ari_asm_hppa64-macro.c : src/ari_asm_hppa64.d src/asm-hppa64.sh
	cd src \
	  && sed -f ../utils/comment5.sed ari_asm_hppa64.d | $(CPP) - | grep -v '^#' | grep -v '^ *#line' | sed -e 's,% ,%,g' -e 's,\. ,.,g' > ari_asm_hppa64-linux.s \
	  && { echo '#include "asm-hppa64.h"'; ./asm-hppa64.sh < ari_asm_hppa64-linux.s; cat noexecstack.h; } > ari_asm_hppa64-macro.c \
	  && rm -f ari_asm_hppa64-linux.s
src/sp_asm_hppa64-macro.c : src/sp_asm_hppa64.d src/asm-hppa64.sh
	cd src \
	  && sed -f ../utils/comment5.sed sp_asm_hppa64.d | $(CPP) - | grep -v '^#' | grep -v '^ *#line' | sed -e 's,% ,%,g' -e 's,\. ,.,g' > sp_asm_hppa64-linux.s \
	  && { echo '#include "asm-hppa64.h"'; ./asm-hppa64.sh < sp_asm_hppa64-linux.s; cat noexecstack.h; } > sp_asm_hppa64-macro.c \
	  && rm -f sp_asm_hppa64-linux.s

src/ari_asm_i386-macro.c : src/ari_asm_i386.d src/asm-i386.sh
	cd src \
	  && sed -f ../utils/comment5.sed ari_asm_i386.d | $(CPP) - | grep -v '^#' | grep -v '^ *#line' | sed -e 's,% ,%,g' -e 's,\. ,.,g' > ari_asm_i386-linux.s \
	  && { echo '#include "asm-i386.h"'; sed -e '/\.align.*,0x90$$/d' < ari_asm_i386-linux.s | ./asm-i386.sh | sed -e 's,!!,#,g'; cat noexecstack.h; } > ari_asm_i386-macro.c \
	  && rm -f ari_asm_i386-linux.s
src/sp_asm_i386-macro.c : src/sp_asm_i386.d src/asm-i386.sh
	cd src \
	  && sed -f ../utils/comment5.sed sp_asm_i386.d | $(CPP) - | grep -v '^#' | grep -v '^ *#line' | sed -e 's,% ,%,g' -e 's,\. ,.,g' > sp_asm_i386-linux.s \
	  && { echo '#include "asm-i386.h"'; sed -e '/\.align.*,0x90$$/d' < sp_asm_i386-linux.s | ./asm-i386.sh | sed -e 's,!!,#,g'; cat noexecstack.h; } > sp_asm_i386-macro.c \
	  && rm -f sp_asm_i386-linux.s

src/ari_asm_ia64-macro.c : src/ari_asm_ia64.d
	cd src \
	  && sed -f ../utils/comment5.sed ari_asm_ia64.d | $(CPP) - | grep -v '^#' | grep -v '^ *#line' | sed -e 's,% ,%,g' -e 's,\. ,.,g' > ari_asm_ia64-linux.s \
	  && cat ari_asm_ia64-linux.s noexecstack.h > ari_asm_ia64-macro.c \
	  && rm -f ari_asm_ia64-linux.s
src/sp_asm_ia64-macro.c : src/sp_asm_ia64.d
	cd src \
	  && sed -f ../utils/comment5.sed sp_asm_ia64.d | $(CPP) - | grep -v '^#' | grep -v '^ *#line' | sed -e 's,% ,%,g' -e 's,\. ,.,g' > sp_asm_ia64-linux.s \
	  && cat sp_asm_ia64-linux.s noexecstack.h > sp_asm_ia64-macro.c \
	  && rm -f sp_asm_ia64-linux.s

src/ari_asm_m68k-macro.c : src/ari_asm_m68k.d src/asm-m68k.sh
	cd src \
	  && sed -f ../utils/comment5.sed ari_asm_m68k.d | sed -e 's,!,//,g' | $(CPP) - | grep -v '^#' | grep -v '^ *#line' | sed -e 's,% ,%,g' -e 's,\. ,.,g' -e 's,//,!,g' > ari_asm_m68k-linux.s \
	  && { echo '#include "asm-m68k.h"'; ./asm-m68k.sh motorola < ari_asm_m68k-linux.s; cat noexecstack.h; } > ari_asm_m68k-macro.c \
	  && rm -f ari_asm_m68k-linux.s
src/sp_asm_m68k-macro.c : src/sp_asm_m68k.d src/asm-m68k.sh
	cd src \
	  && sed -f ../utils/comment5.sed sp_asm_m68k.d | sed -e 's,!,//,g' | $(CPP) - | grep -v '^#' | grep -v '^ *#line' | sed -e 's,% ,%,g' -e 's,\. ,.,g' -e 's,//,!,g' > sp_asm_m68k-linux.s \
	  && { echo '#include "asm-m68k.h"'; ./asm-m68k.sh motorola < sp_asm_m68k-linux.s; cat noexecstack.h; } > sp_asm_m68k-macro.c \
	  && rm -f sp_asm_m68k-linux.s

src/ari_asm_mips-macro.c : src/ari_asm_mips.d src/asm-mips.sh
	cd src \
	  && sed -f ../utils/comment5.sed ari_asm_mips.d | $(CPP) - | grep -v '^#' | grep -v '^ *#line' | sed -e 's,% ,%,g' -e 's,\. ,.,g' > ari_asm_mips-linux.s \
	  && { echo '#include "asm-mips.h"'; ./asm-mips.sh < ari_asm_mips-linux.s | sed -e 's,%%,#,g'; } > ari_asm_mips-macro.c \
	  && rm -f ari_asm_mips-linux.s
src/sp_asm_mips-macro.c : src/sp_asm_mips.d src/asm-mips.sh
	cd src \
	  && sed -f ../utils/comment5.sed sp_asm_mips.d | $(CPP) - | grep -v '^#' | grep -v '^ *#line' | sed -e 's,% ,%,g' -e 's,\. ,.,g' > sp_asm_mips-linux.s \
	  && { echo '#include "asm-mips.h"'; ./asm-mips.sh < sp_asm_mips-linux.s | sed -e 's,%%,#,g'; } > sp_asm_mips-macro.c \
	  && rm -f sp_asm_mips-linux.s

src/ari_asm_mipsn32-macro.c : src/ari_asm_mipsn32.d src/asm-mips.sh
	cd src \
	  && sed -f ../utils/comment5.sed ari_asm_mipsn32.d | $(CPP) - | grep -v '^#' | grep -v '^ *#line' | sed -e 's,% ,%,g' -e 's,\. ,.,g' > ari_asm_mipsn32-linux.s \
	  && { echo '#include "asm-mips.h"'; ./asm-mips.sh < ari_asm_mipsn32-linux.s | sed -e 's,%%,#,g'; } > ari_asm_mipsn32-macro.c \
	  && rm -f ari_asm_mipsn32-linux.s
src/sp_asm_mipsn32-macro.c : src/sp_asm_mipsn32.d src/asm-mips.sh
	cd src \
	  && sed -f ../utils/comment5.sed sp_asm_mipsn32.d | $(CPP) - | grep -v '^#' | grep -v '^ *#line' | sed -e 's,% ,%,g' -e 's,\. ,.,g' > sp_asm_mipsn32-linux.s \
	  && { echo '#include "asm-mips.h"'; ./asm-mips.sh < sp_asm_mipsn32-linux.s | sed -e 's,%%,#,g'; } > sp_asm_mipsn32-macro.c \
	  && rm -f sp_asm_mipsn32-linux.s

src/ari_asm_mips64-macro.c : src/ari_asm_mips64.d src/asm-mips.sh
	cd src \
	  && sed -f ../utils/comment5.sed ari_asm_mips64.d | $(CPP) - | grep -v '^#' | grep -v '^ *#line' | sed -e 's,% ,%,g' -e 's,\. ,.,g' > ari_asm_mips64-linux.s \
	  && { echo '#include "asm-mips.h"'; ./asm-mips.sh < ari_asm_mips64-linux.s | sed -e 's,%%,#,g'; } > ari_asm_mips64-macro.c \
	  && rm -f ari_asm_mips64-linux.s
src/sp_asm_mips64-macro.c : src/sp_asm_mips64.d src/asm-mips.sh
	cd src \
	  && sed -f ../utils/comment5.sed sp_asm_mips64.d | $(CPP) - | grep -v '^#' | grep -v '^ *#line' | sed -e 's,% ,%,g' -e 's,\. ,.,g' > sp_asm_mips64-linux.s \
	  && { echo '#include "asm-mips.h"'; ./asm-mips.sh < sp_asm_mips64-linux.s | sed -e 's,%%,#,g'; } > sp_asm_mips64-macro.c \
	  && rm -f sp_asm_mips64-linux.s

src/ari_asm_powerpc-macro.c : src/ari_asm_powerpc.d src/asm-powerpc.sh
	cd src \
	  && sed -f ../utils/comment5.sed ari_asm_powerpc.d | $(CPP) - | grep -v '^#' | grep -v '^ *#line' | sed -e 's,% ,%,g' -e 's,\. ,.,g' > ari_asm_powerpc-linux.s \
	  && { ./asm-powerpc.sh < ari_asm_powerpc-linux.s; cat noexecstack.h; } > ari_asm_powerpc-macro.c \
	  && rm -f ari_asm_powerpc-linux.s
src/sp_asm_powerpc-macro.c : src/sp_asm_powerpc.d src/asm-powerpc.sh
	cd src \
	  && sed -f ../utils/comment5.sed sp_asm_powerpc.d | $(CPP) - | grep -v '^#' | grep -v '^ *#line' | sed -e 's,% ,%,g' -e 's,\. ,.,g' > sp_asm_powerpc-linux.s \
	  && { ./asm-powerpc.sh < sp_asm_powerpc-linux.s; cat noexecstack.h; } > sp_asm_powerpc-macro.c \
	  && rm -f sp_asm_powerpc-linux.s

src/ari_asm_powerpc64-macro.c : src/ari_asm_powerpc64.d src/asm-powerpc.sh
	cd src \
	  && sed -f ../utils/comment5.sed ari_asm_powerpc64.d | $(CPP) - | grep -v '^#' | grep -v '^ *#line' | sed -e 's,% ,%,g' -e 's,\. ,.,g' > ari_asm_powerpc64-linux.s \
	  && { ./asm-powerpc.sh < ari_asm_powerpc64-linux.s; cat noexecstack.h; } > ari_asm_powerpc64-macro.c \
	  && rm -f ari_asm_powerpc64-linux.s
src/sp_asm_powerpc64-macro.c : src/sp_asm_powerpc64.d src/asm-powerpc.sh
	cd src \
	  && sed -f ../utils/comment5.sed sp_asm_powerpc64.d | $(CPP) - | grep -v '^#' | grep -v '^ *#line' | sed -e 's,% ,%,g' -e 's,\. ,.,g' > sp_asm_powerpc64-linux.s \
	  && { ./asm-powerpc.sh < sp_asm_powerpc64-linux.s; cat noexecstack.h; } > sp_asm_powerpc64-macro.c \
	  && rm -f sp_asm_powerpc64-linux.s

src/ari_asm_s390-macro.c : src/ari_asm_s390.d src/asm-s390.sh
	cd src \
	  && sed -f ../utils/comment5.sed ari_asm_s390.d | $(CPP) - | grep -v '^#' | grep -v '^ *#line' | sed -e 's,% ,%,g' -e 's,\. ,.,g' > ari_asm_s390-linux.s \
	  && { ./asm-s390.sh < ari_asm_s390-linux.s; cat noexecstack.h; } > ari_asm_s390-macro.c \
	  && rm -f ari_asm_s390-linux.s
src/sp_asm_s390-macro.c : src/sp_asm_s390.d src/asm-s390.sh
	cd src \
	  && sed -f ../utils/comment5.sed sp_asm_s390.d | $(CPP) - | grep -v '^#' | grep -v '^ *#line' | sed -e 's,% ,%,g' -e 's,\. ,.,g' > sp_asm_s390-linux.s \
	  && { ./asm-s390.sh < sp_asm_s390-linux.s; cat noexecstack.h; } > sp_asm_s390-macro.c \
	  && rm -f sp_asm_s390-linux.s

src/ari_asm_s390x-macro.c : src/ari_asm_s390x.d src/asm-s390.sh
	cd src \
	  && sed -f ../utils/comment5.sed ari_asm_s390x.d | $(CPP) - | grep -v '^#' | grep -v '^ *#line' | sed -e 's,% ,%,g' -e 's,\. ,.,g' > ari_asm_s390x-linux.s \
	  && { ./asm-s390.sh < ari_asm_s390x-linux.s; cat noexecstack.h; } > ari_asm_s390x-macro.c \
	  && rm -f ari_asm_s390x-linux.s
src/sp_asm_s390x-macro.c : src/sp_asm_s390x.d src/asm-s390.sh
	cd src \
	  && sed -f ../utils/comment5.sed sp_asm_s390x.d | $(CPP) - | grep -v '^#' | grep -v '^ *#line' | sed -e 's,% ,%,g' -e 's,\. ,.,g' > sp_asm_s390x-linux.s \
	  && { ./asm-s390.sh < sp_asm_s390x-linux.s; cat noexecstack.h; } > sp_asm_s390x-macro.c \
	  && rm -f sp_asm_s390x-linux.s

src/ari_asm_sparc-macro.c : src/ari_asm_sparc.d src/asm-sparc.sh
	cd src \
	  && sed -f ../utils/comment5.sed ari_asm_sparc.d | $(CPP) - | grep -v '^#' | grep -v '^ *#line' | sed -e 's,% ,%,g' -e 's,\. ,.,g' > ari_asm_sparc-linux.s \
	  && { echo '#include "asm-sparc.h"'; ./asm-sparc.sh < ari_asm_sparc-linux.s | sed -e 's,%%,#,g'; cat noexecstack.h; } > ari_asm_sparc-macro.c \
	  && rm -f ari_asm_sparc-linux.s
src/sp_asm_sparc-macro.c : src/sp_asm_sparc.d src/asm-sparc.sh
	cd src \
	  && sed -f ../utils/comment5.sed sp_asm_sparc.d | $(CPP) - | grep -v '^#' | grep -v '^ *#line' | sed -e 's,% ,%,g' -e 's,\. ,.,g' > sp_asm_sparc-linux.s \
	  && { echo '#include "asm-sparc.h"'; ./asm-sparc.sh < sp_asm_sparc-linux.s | sed -e 's,%%,#,g'; cat noexecstack.h; } > sp_asm_sparc-macro.c \
	  && rm -f sp_asm_sparc-linux.s

src/ari_asm_sparc64-macro.c : src/ari_asm_sparc64.d src/asm-sparc.sh
	cd src \
	  && sed -f ../utils/comment5.sed ari_asm_sparc64.d | $(CPP) - | grep -v '^#' | grep -v '^ *#line' | sed -e 's,% ,%,g' -e 's,\. ,.,g' > ari_asm_sparc64-linux.s \
	  && { echo '#include "asm-sparc.h"'; ./asm-sparc.sh < ari_asm_sparc64-linux.s | sed -e 's,%%,#,g'; cat noexecstack.h; } > ari_asm_sparc64-macro.c \
	  && rm -f ari_asm_sparc64-linux.s
src/sp_asm_sparc64-macro.c : src/sp_asm_sparc64.d src/asm-sparc.sh
	cd src \
	  && sed -f ../utils/comment5.sed sp_asm_sparc64.d | $(CPP) - | grep -v '^#' | grep -v '^ *#line' | sed -e 's,% ,%,g' -e 's,\. ,.,g' > sp_asm_sparc64-linux.s \
	  && { echo '#include "asm-sparc.h"'; ./asm-sparc.sh < sp_asm_sparc64-linux.s | sed -e 's,%%,#,g'; cat noexecstack.h; } > sp_asm_sparc64-macro.c \
	  && rm -f sp_asm_sparc64-linux.s

src/ari_asm_x86_64-macro.c : src/ari_asm_x86_64.d src/asm-x86_64.sh
	cd src \
	  && sed -f ../utils/comment5.sed ari_asm_x86_64.d | $(CPP) - | grep -v '^#' | grep -v '^ *#line' | sed -e 's,% ,%,g' -e 's,\. ,.,g' > ari_asm_x86_64-linux.s \
	  && { echo '#include "asm-x86_64.h"'; ./asm-x86_64.sh < ari_asm_x86_64-linux.s; cat noexecstack.h; } > ari_asm_x86_64-macro.c \
	  && rm -f ari_asm_x86_64-linux.s
src/sp_asm_x86_64-macro.c : src/sp_asm_x86_64.d src/asm-x86_64.sh
	cd src \
	  && sed -f ../utils/comment5.sed sp_asm_x86_64.d | $(CPP) - | grep -v '^#' | grep -v '^ *#line' | sed -e 's,% ,%,g' -e 's,\. ,.,g' > sp_asm_x86_64-linux.s \
	  && { echo '#include "asm-x86_64.h"'; ./asm-x86_64.sh < sp_asm_x86_64-linux.s; cat noexecstack.h; } > sp_asm_x86_64-macro.c \
	  && rm -f sp_asm_x86_64-linux.s

# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

# ------------------------------------------------------------------------------
# Create Makefiles for Windows platform.

MAKEMAKE_TMP=src/makemake

makefiles : win32msvc/makefile.msvc7 win32msvc/makefile.msvc6
	$(RM) $(MAKEMAKE_TMP)

win32msvc/makefile.msvc6 : $(MAKEMAKE_TMP)
	cd src && ./makemake --with-dynamic-ffi --without-dynamic-modules \
		win32msvc msvc6 > ../win32msvc/makefile.msvc6

win32msvc/makefile.msvc7 : $(MAKEMAKE_TMP)
	cd src && ./makemake --with-dynamic-ffi --without-dynamic-modules \
		win32msvc msvc7 > ../win32msvc/makefile.msvc7

$(MAKEMAKE_TMP) : src/makemake.in version.sh
	. ./version.sh; \
	  sed -e "s/@PACKAGE_VERSION@/$${VERSION_NUMBER}/g" \
	      -e "s/@CLISP_DECOLONIZE@/echo $$x/" src/makemake.in  \
	      -e "s/@module_configure_flags@/--disable-option-checking/" \
	      -e "s,@SHELL@,/bin/sh," > $(MAKEMAKE_TMP)
	chmod a+x $(MAKEMAKE_TMP)

# ------------------------------------------------------------------------------
# Internationalization: Create the POT and PO files.

# Requires a build in the 'build' directory.
CLISP=$(CURDIR)/build/clisp

potfiles :
	cd src/po && CLISP='$(CLISP)' $(MAKE) -f Makefile.devel && $(MAKE) -f Makefile.devel clean

# ------------------------------------------------------------------------------
# Regenerate the HTML formatted documentation from XML (DocBook) format.

htmldoc:
	make -C doc all html

# ------------------------------------------------------------------------------


# ==============================================================================
# Targets that create files for use in the distribution. Run only occasionally.

# ------------------------------------------------------------------------------
# Fetch the most recent gnulib.

GNULIB_GIT = https://git.savannah.gnu.org/git/gnulib.git
GNULIB_CHECKOUT := gnulib

update-gnulib:
	if test -d $(GNULIB_CHECKOUT); then \
	  cd $(GNULIB_CHECKOUT) ; git pull ; \
	else \
	  git clone "$(GNULIB_GIT)" $(GNULIB_CHECKOUT) ; \
	fi

# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# Regenerate all files created from gnulib.

GNULIB_CORE = no-c++ stdint stdbool havelib gettext localcharset stdlib \
	unistd alloca-opt environ lstat stat readlink sys_uio sys_select \
	mkfifo mknod mkstemp mkdtemp getloadavg bind accept listen recv send \
	getsockopt shutdown connect socket setsockopt getsockname getpeername \
	uniwidth/width streq uniname/uniname unitypes link-follow close select \
	host-cpu-c-abi socklen sockets fd-hook setenv unsetenv errno ioctl \
	arpa_inet netinet_in inet_ntop inet_pton socketlib strerror_r-posix \
	nocrash libsigsegv gnu-make gettimeofday getpagesize sys_time sys_wait \
	vma-iter c-strtod noreturn libunistring-optional crypto/sha1
GNULIB_SYSCALLS = mktime strftime strptime strverscmp uname fnmatch-gnu
GNULIB_IMPORTS = $(GNULIB_CORE) $(GNULIB_SYSCALLS) regex recvfrom sendto
GNULIB_IMPORTED_LOG = /tmp/gnulib-imported.log

gnulib-imported : update-gnulib force
	$(RMRF) src/glm4 src/gllib
	$(RM) configure.ac; ln -sv src/configure.in configure.ac
	$(RM) src/glm4/gnulib-cache.m4 $(GNULIB_IMPORTED_LOG)
	abs_gnulib_dir=`cd $(GNULIB_CHECKOUT) && pwd`; \
	(cd src && \
	  $$abs_gnulib_dir/gnulib-tool \
		--source-base=gllib --m4-base=glm4 --aux-dir=build-aux \
		--import --no-vc-files --no-libtool --no-changelog \
		--avoid=xalloc-die \
		$(GNULIB_IMPORTS) 2>&1 | tee -a $(GNULIB_IMPORTED_LOG) )
	$(RM) configure.ac src/gl*/*~
	cd src/glm4; \
	for f in *.m4; do \
	  if test -f ../m4/$$f; then \
	    echo == $$f; \
	    if cmp $$f ../m4/$$f; then \
	      cd ../m4; $(GIT) rm -f $$f; cd ../glm4; \
	    fi; \
	  fi; \
	done
	$(GIT) checkout -- src/gllib/Makefile.in src/gllib/README src/glm4/README
	$(GIT) status --short | grep -v '^ M '; test $$? = 1
	@echo the import log is in $(GNULIB_IMPORTED_LOG)

# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# Fetch and regenerate other build infrastructure files.

# it is important to get ltmain.sh and libtool.m4 from the same version of
# libtool. Don't rely on what's installed in /usr/share or similar.
LIBTOOL_VERSION = 2.4.7
LIBTOOL_SOURCE_FILE = libtool-$(LIBTOOL_VERSION).tar.gz
LIBTOOL_SOURCE_URL = https://ftp.gnu.org/gnu/libtool/$(LIBTOOL_SOURCE_FILE)
# an alternative way to update libtool files is "cd src; libtoolize --copy"
AUTOMAKE_VERSION = 1.16.5
AUTOMAKE_GIT = https://git.savannah.gnu.org/cgit/automake.git/plain/lib/
GTK_GIT_ROOT = https://gitlab.gnome.org/GNOME/gtk/-/raw
GNULIB_AUX=config.guess config.rpath config.sub

# it is important not to have "*.m4" targets with ": force" dependencies
# because otherwise every make will rebuild all configures
build-aux-update : update-gnulib force
	for f in $(GNULIB_AUX); do \
	  $(CP) $(GNULIB_CHECKOUT)/build-aux/$$f src/build-aux; \
	done
	for f in ar-lib compile depcomp install-sh missing ylwrap; do \
	  $(WGET) -O src/build-aux/$$f $(AUTOMAKE_GIT)$$f?v$(AUTOMAKE_VERSION); \
	done
	chmod +x src/build-aux/compile src/build-aux/ylwrap
	$(RMRF) libtool-$(LIBTOOL_VERSION) $(LIBTOOL_SOURCE_FILE)
	test -f $(LIBTOOL_SOURCE_FILE) || $(WGET) $(LIBTOOL_SOURCE_URL)
	$(RMRF) libtool-$(LIBTOOL_VERSION)
	gunzip -c < $(LIBTOOL_SOURCE_FILE) | tar xf -
	$(CP) libtool-$(LIBTOOL_VERSION)/build-aux/ltmain.sh src/build-aux/ltmain.sh
	chmod +x src/build-aux/ltmain.sh
	for f in libtool ltoptions ltsugar ltversion lt~obsolete; do \
	  $(CP) libtool-$(LIBTOOL_VERSION)/m4/$$f.m4 src/m4/; \
	done
	$(RMRF) libtool-$(LIBTOOL_VERSION) $(LIBTOOL_SOURCE_FILE)
	cd src/m4; $(RM) gtk-2.0.m4; $(WGET) -O gtk-2.0.m4 '$(GTK_GIT_ROOT)/gtk-2-24/m4macros/gtk-2.0.m4?ref_type=heads'
	cd src/m4; $(RM) gtk-3.0.m4; $(WGET) -O gtk-3.0.m4 '$(GTK_GIT_ROOT)/gtk-3-22/m4macros/gtk-3.0.m4?ref_type=heads'

# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

# ------------------------------------------------------------------------------

GMALLOC_URL = https://git.savannah.gnu.org/cgit/emacs.git/plain/src/gmalloc.c

update-gmalloc : force
	$(WGET) -O src/gmalloc.c $(GMALLOC_URL)

# ------------------------------------------------------------------------------

ASDF_URL = https://common-lisp.net/project/asdf/asdf.lisp

update-asdf : force
	$(WGET) -O modules/asdf/asdf.lisp $(ASDF_URL)

# ------------------------------------------------------------------------------


# ==============================================================================
# Targets to verify the quality of the distribution.

# ------------------------------------------------------------------------------
# Fetch/update the ANSI CL compliance test suite.

all : update-ansi-tests

ANSITESTS_REPO = https://gitlab.common-lisp.net/ansi-test/ansi-test.git

update-ansi-tests:
	if test -d ansi-tests; then \
	  cd ansi-tests && \
	  git pull; \
	else \
	  git clone $(ANSITESTS_REPO) ansi-tests; \
	fi

# ------------------------------------------------------------------------------
# Quality assurance of generated man page documentation.

# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

view-man :
	grep -v '^#[ie]' doc/_clisp.1 | $(GROFF) -Tascii | less

# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

# all possible browsers, some might not be present, but we do not care
# list GUI first because they put themselves into background
BROWSERS=firefox mozilla netscape opera links lynx

view-html :
	grep -v '^#[ie]' doc/_clisp.html > /tmp/clisp.html
	for b in $(BROWSERS); do $$b /tmp/clisp.html; done

# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

# ------------------------------------------------------------------------------
# Build and test all essential memory models.

# Options to pass to configure.
MULTIBUILD_MODULES = --with-module=asdf --with-module=rawsock
MULTIBUILD_EXTRAS =
MULTIBUILD_OPTIONS = $(MULTIBUILD_EXTRAS) $(MULTIBUILD_MODULES)
# Compiler options to pass as part of CFLAGS.
MULTIBUILD_CFLAGS = -g

# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# Build and test various configurations, in order to fix bootstrapping problems
# when porting to a 32-bit machine.
#
# Prerequisite: Set the environment variable MULTIBUILD_32_OPTIONS, e.g.
# MULTIBUILD_32_OPTIONS="--with-libsigsegv-prefix=/arch/x86-linux/gnu-inst-libsigsegv/2.11 --with-libffcall-prefix=/arch/x86-linux/gnu-inst-libffcall/1.13pre"
# To build on a 64-bit machine where 64-bit compilation is the default,
# also set the environment variables CC and CXX, for example
# CC="gcc -m32" CXX="g++ -m32"
#
# Use with "make -k", then collects the build-porting32-*/cbcstep*.log.

# Build various configurations. Assumes $CC is GCC and $CXX is GNU g++.
multibuild-porting32-gcc: \
  build-porting32-gcc-portability \
  build-porting32-gcc-safety3 \
  build-porting32-gcc-heapcodes \
  build-porting32-gcc-one_free_bit_heapcodes-malloc \
  build-porting32-gcc-one_free_bit_heapcodes-trivialmap \
  build-porting32-gcc-kernelvoid32_heapcodes \
  build-porting32-gcc-heapcodes-spvw_pages \
  build-porting32-gcc-typecodes-spvw_pure_pages \
  build-porting32-gcc-typecodes-spvw_mixed_pages \
  build-porting32-gcc-heapcodes-spvw_mixed_blocks \
  build-porting32-gcc-typecodes-spvw_mixed_blocks-malloc \
  build-porting32-gcc-typecodes-spvw_mixed_blocks-trivialmap \
  build-porting32-gcc-spvw_pure_blocks \
  build-porting32-gcc-wide \
  build-porting32-gcc-limited_memory \
  build-porting32-gcc-old_gc \
  build-porting32-gcc-multithread_gc \
  build-porting32-gcc-generational_gc-old_gc \
  build-porting32-gcc-generational_gc-multithread_gc \
  build-porting32-gcc-safety0 \
  build-porting32-gcc-safety0-optimized \
  build-porting32-gcc-debug_gcsafety

# A build that favours portability over optimization.
build-porting32-gcc-portability:
	$(RMRF) $@
	CFLAGS="-O $(MULTIBUILD_CFLAGS)" \
	CPPFLAGS="" \
	  ./configure --cbcx $(MULTIBUILD_OPTIONS) $(MULTIBUILD_32_OPTIONS) --enable-portability $@

# Nearly the default. Just with some low-cost safety.
build-porting32-gcc-safety3:
	$(RMRF) $@
	CFLAGS="-O $(MULTIBUILD_CFLAGS)" \
	CPPFLAGS="-DNO_ARI_ASM -DNO_SP_ASM -DSAFETY=3" \
	  ./configure --cbcx $(MULTIBUILD_OPTIONS) $(MULTIBUILD_32_OPTIONS) --disable-portability $@

# Force HEAPCODES.
build-porting32-gcc-heapcodes:
	$(RMRF) $@
	CFLAGS="-O $(MULTIBUILD_CFLAGS)" \
	CPPFLAGS="-DNO_ARI_ASM -DNO_SP_ASM -DSAFETY=3 -DHEAPCODES" \
	  ./configure --cbcx $(MULTIBUILD_OPTIONS) $(MULTIBUILD_32_OPTIONS) --disable-portability $@

# Force ONE_FREE_BIT_HEAPCODES (no use of mmap).
build-porting32-gcc-one_free_bit_heapcodes-malloc:
	$(RMRF) $@
	CFLAGS="-O $(MULTIBUILD_CFLAGS)" \
	CPPFLAGS="-DNO_ARI_ASM -DNO_SP_ASM -DSAFETY=3 -DONE_FREE_BIT_HEAPCODES -DNO_TRIVIALMAP" \
	  ./configure --cbcx $(MULTIBUILD_OPTIONS) $(MULTIBUILD_32_OPTIONS) --disable-portability $@

# Force ONE_FREE_BIT_HEAPCODES with TRIVIALMAP_MEMORY.
build-porting32-gcc-one_free_bit_heapcodes-trivialmap:
	$(RMRF) $@
	CFLAGS="-O $(MULTIBUILD_CFLAGS)" \
	CPPFLAGS="-DNO_ASM -DNO_ARI_ASM -DNO_SP_ASM -DNO_FAST_DISPATCH -DONE_FREE_BIT_HEAPCODES -DTRIVIALMAP_MEMORY" \
	  ./configure --cbcx $(MULTIBUILD_OPTIONS) $(MULTIBUILD_32_OPTIONS) --disable-portability $@

# Force KERNELVOID32_HEAPCODES.
build-porting32-gcc-kernelvoid32_heapcodes:
	$(RMRF) $@
	CFLAGS="-O $(MULTIBUILD_CFLAGS)" \
	CPPFLAGS="-DNO_ASM -DNO_ARI_ASM -DNO_SP_ASM -DNO_FAST_DISPATCH -DKERNELVOID32_HEAPCODES" \
	  ./configure --cbcx $(MULTIBUILD_OPTIONS) $(MULTIBUILD_32_OPTIONS) --disable-portability $@

# Force HEAPCODES with SPVW_PAGES (no use of mmap).
build-porting32-gcc-heapcodes-spvw_pages:
	$(RMRF) $@
	CFLAGS="-O $(MULTIBUILD_CFLAGS)" \
	CPPFLAGS="-DNO_ARI_ASM -DNO_SP_ASM -DSAFETY=3 -DHEAPCODES -DNO_SINGLEMAP -DNO_TRIVIALMAP" \
	  ./configure --cbcx $(MULTIBUILD_OPTIONS) $(MULTIBUILD_32_OPTIONS) --disable-portability $@

# Force TYPECODES with SPVW_PURE_PAGES (no use of mmap).
build-porting32-gcc-typecodes-spvw_pure_pages:
	$(RMRF) $@
	CFLAGS="-O $(MULTIBUILD_CFLAGS)" \
	CPPFLAGS="-DNO_ARI_ASM -DNO_SP_ASM -DSAFETY=3 -DTYPECODES -DNO_SINGLEMAP -DNO_TRIVIALMAP -DPREFER_PURE_PAGES" \
	  ./configure --cbcx $(MULTIBUILD_OPTIONS) $(MULTIBUILD_32_OPTIONS) --disable-portability $@

# Force TYPECODES with SPVW_MIXED_PAGES (no use of mmap).
build-porting32-gcc-typecodes-spvw_mixed_pages:
	$(RMRF) $@
	CFLAGS="-O $(MULTIBUILD_CFLAGS)" \
	CPPFLAGS="-DNO_ARI_ASM -DNO_SP_ASM -DSAFETY=3 -DTYPECODES -DNO_SINGLEMAP -DNO_TRIVIALMAP" \
	  ./configure --cbcx $(MULTIBUILD_OPTIONS) $(MULTIBUILD_32_OPTIONS) --disable-portability $@

# Force HEAPCODES with SPVW_MIXED_BLOCKS.
# Possible further options: -DCONS_HEAP_GROWS_UP or -DCONS_HEAP_GROWS_DOWN.
build-porting32-gcc-heapcodes-spvw_mixed_blocks:
	$(RMRF) $@
	CFLAGS="-O $(MULTIBUILD_CFLAGS)" \
	CPPFLAGS="-DNO_ARI_ASM -DNO_SP_ASM -DSAFETY=3 -DHEAPCODES -DNO_SINGLEMAP" \
	  ./configure --cbcx $(MULTIBUILD_OPTIONS) $(MULTIBUILD_32_OPTIONS) --disable-portability $@

# Force TYPECODES with SPVW_MIXED_BLOCKS (no use of mmap).
# Possible further options: -DCONS_HEAP_GROWS_UP or -DCONS_HEAP_GROWS_DOWN.
build-porting32-gcc-typecodes-spvw_mixed_blocks-malloc:
	$(RMRF) $@
	CFLAGS="-O $(MULTIBUILD_CFLAGS)" \
	CPPFLAGS="-DNO_ARI_ASM -DNO_SP_ASM -DSAFETY=3 -DTYPECODES -DNO_SINGLEMAP -DNO_TRIVIALMAP -DNO_VIRTUAL_MEMORY" \
	  ./configure --cbcx $(MULTIBUILD_OPTIONS) $(MULTIBUILD_32_OPTIONS) --disable-portability $@

# Force TYPECODES with SPVW_MIXED_BLOCKS with TRIVIALMAP_MEMORY.
# Possible further options: -DCONS_HEAP_GROWS_UP or -DCONS_HEAP_GROWS_DOWN.
build-porting32-gcc-typecodes-spvw_mixed_blocks-trivialmap:
	$(RMRF) $@
	CFLAGS="-O $(MULTIBUILD_CFLAGS)" \
	CPPFLAGS="-DNO_ASM -DNO_ARI_ASM -DNO_SP_ASM -DNO_FAST_DISPATCH -DTYPECODES -DNO_SINGLEMAP -DTRIVIALMAP_MEMORY" \
	  ./configure --cbcx $(MULTIBUILD_OPTIONS) $(MULTIBUILD_32_OPTIONS) --disable-portability $@

# Force SPVW_PURE_BLOCKS (equivalent to SINGLEMAP_MEMORY).
build-porting32-gcc-spvw_pure_blocks:
	$(RMRF) $@
	CFLAGS="-O $(MULTIBUILD_CFLAGS)" \
	CPPFLAGS="-DNO_ASM -DNO_ARI_ASM -DNO_SP_ASM -DNO_FAST_DISPATCH -DTYPECODES -DSINGLEMAP_MEMORY" \
	  ./configure --cbcx $(MULTIBUILD_OPTIONS) $(MULTIBUILD_32_OPTIONS) --disable-portability $@

# Force WIDE_SOFT.
build-porting32-gcc-wide:
	$(RMRF) $@
	CFLAGS="-O $(MULTIBUILD_CFLAGS)" \
	CPPFLAGS="-DNO_ARI_ASM -DNO_SP_ASM -DSAFETY=3 -DWIDE" \
	  ./configure --cbcx $(MULTIBUILD_OPTIONS) $(MULTIBUILD_32_OPTIONS) --disable-portability $@

# Force SPVW_MIXED_BLOCKS_OPPOSITE with limited memory size (honor -m option),
build-porting32-gcc-limited_memory:
	$(RMRF) $@
	CFLAGS="-O $(MULTIBUILD_CFLAGS)" \
	CPPFLAGS="-DNO_ARI_ASM -DNO_SP_ASM -DSAFETY=3 -DNO_VIRTUAL_MEMORY -DNO_ADDRESS_SPACE_ASSUMPTIONS" \
	  ./configure --cbcx $(MULTIBUILD_OPTIONS) $(MULTIBUILD_32_OPTIONS) --disable-portability $@

build-porting32-gcc-old_gc:
	$(RMRF) $@
	CFLAGS="-O $(MULTIBUILD_CFLAGS)" \
	CPPFLAGS="-DNO_ARI_ASM -DNO_SP_ASM -DSAFETY=3 -DNO_GENERATIONAL_GC -DOLD_GC" \
	  ./configure --cbcx $(MULTIBUILD_OPTIONS) $(MULTIBUILD_32_OPTIONS) --disable-portability $@

build-porting32-gcc-multithread_gc:
	$(RMRF) $@
	CFLAGS="-O $(MULTIBUILD_CFLAGS)" \
	CPPFLAGS="-DNO_ARI_ASM -DNO_SP_ASM -DSAFETY=3 -DNO_GENERATIONAL_GC" \
	  ./configure --cbcx $(MULTIBUILD_OPTIONS) $(MULTIBUILD_32_OPTIONS) --disable-portability $@

build-porting32-gcc-generational_gc-old_gc:
	$(RMRF) $@
	CFLAGS="-O $(MULTIBUILD_CFLAGS)" \
	CPPFLAGS="-DNO_ARI_ASM -DNO_SP_ASM -DSAFETY=3 -DGENERATIONAL_GC -DOLD_GC" \
	  ./configure --cbcx $(MULTIBUILD_OPTIONS) $(MULTIBUILD_32_OPTIONS) --disable-portability $@

build-porting32-gcc-generational_gc-multithread_gc:
	$(RMRF) $@
	CFLAGS="-O $(MULTIBUILD_CFLAGS)" \
	CPPFLAGS="-DNO_ARI_ASM -DNO_SP_ASM -DSAFETY=3 -DGENERATIONAL_GC" \
	  ./configure --cbcx $(MULTIBUILD_OPTIONS) $(MULTIBUILD_32_OPTIONS) --disable-portability $@

build-porting32-gcc-safety0:
	$(RMRF) $@
	CFLAGS="-O $(MULTIBUILD_CFLAGS)" \
	CPPFLAGS="" \
	  ./configure --cbcx $(MULTIBUILD_OPTIONS) $(MULTIBUILD_32_OPTIONS) --disable-portability $@

build-porting32-gcc-safety0-optimized:
	$(RMRF) $@
	CFLAGS="-O2 -fexpensive-optimizations $(MULTIBUILD_CFLAGS)" \
	CPPFLAGS="" \
	  ./configure --cbcx $(MULTIBUILD_OPTIONS) $(MULTIBUILD_32_OPTIONS) --disable-portability $@

build-porting32-gcc-debug_gcsafety:
	$(RMRF) $@
	ulimit -c unlimited; \
	CC="$${CXX-g++}" \
	CFLAGS="$(MULTIBUILD_CFLAGS)" \
	CPPFLAGS="" \
	  ./configure --cbcx $(MULTIBUILD_OPTIONS) $(MULTIBUILD_32_OPTIONS) --disable-portability --with-debug $@

# This build is only useful to test the assembly-language code ari*.d.
build-porting32-gcc-ari_asm:
	$(RMRF) $@
	CFLAGS="-O $(MULTIBUILD_CFLAGS)" \
	CPPFLAGS="-DNO_ASM" \
	  ./configure --cbcx $(MULTIBUILD_OPTIONS) $(MULTIBUILD_32_OPTIONS) --disable-portability $@

# This build is only useful to test the assembly-language code ari*.d.
build-porting32-gcc-debug_ari_asm:
	$(RMRF) $@
	CFLAGS="-O $(MULTIBUILD_CFLAGS)" \
	CPPFLAGS="-DNO_ASM -DDEBUG_ARI_ASM" \
	  ./configure --cbcx $(MULTIBUILD_OPTIONS) $(MULTIBUILD_32_OPTIONS) --disable-portability $@

# This build is only useful to test the GCC asm macros in arilev0.d.
build-porting32-gcc-arilev0-asm:
	$(RMRF) $@
	CFLAGS="-O $(MULTIBUILD_CFLAGS)" \
	CPPFLAGS="-DNO_ARI_ASM" \
	  ./configure --cbcx $(MULTIBUILD_OPTIONS) $(MULTIBUILD_32_OPTIONS) --disable-portability $@

# Build various configurations. Assumes $CC is not GCC.
# Put the optimization options into $CC.
multibuild-porting32-cc: \
  build-porting32-cc-portability \
  build-porting32-cc-safety3 \
  build-porting32-cc-heapcodes \
  build-porting32-cc-one_free_bit_heapcodes-malloc \
  build-porting32-cc-one_free_bit_heapcodes-trivialmap \
  build-porting32-cc-kernelvoid32_heapcodes \
  build-porting32-cc-heapcodes-spvw_pages \
  build-porting32-cc-typecodes-spvw_pure_pages \
  build-porting32-cc-typecodes-spvw_mixed_pages \
  build-porting32-cc-heapcodes-spvw_mixed_blocks \
  build-porting32-cc-typecodes-spvw_mixed_blocks-malloc \
  build-porting32-cc-typecodes-spvw_mixed_blocks-trivialmap \
  build-porting32-cc-spvw_pure_blocks \
  build-porting32-cc-wide \
  build-porting32-cc-limited_memory \
  build-porting32-cc-old_gc \
  build-porting32-cc-multithread_gc \
  build-porting32-cc-generational_gc-old_gc \
  build-porting32-cc-generational_gc-multithread_gc \
  build-porting32-cc-safety0

# A build that favours portability over optimization.
build-porting32-cc-portability:
	$(RMRF) $@
	CFLAGS="$(MULTIBUILD_CFLAGS)" \
	CPPFLAGS="" \
	  ./configure --cbcx $(MULTIBUILD_OPTIONS) $(MULTIBUILD_32_OPTIONS) --enable-portability $@

# Nearly the default. Just with some low-cost safety.
build-porting32-cc-safety3:
	$(RMRF) $@
	CFLAGS="$(MULTIBUILD_CFLAGS)" \
	CPPFLAGS="-DNO_ARI_ASM -DNO_SP_ASM -DSAFETY=3" \
	  ./configure --cbcx $(MULTIBUILD_OPTIONS) $(MULTIBUILD_32_OPTIONS) --disable-portability $@

# Force HEAPCODES.
build-porting32-cc-heapcodes:
	$(RMRF) $@
	CFLAGS="$(MULTIBUILD_CFLAGS)" \
	CPPFLAGS="-DNO_ARI_ASM -DNO_SP_ASM -DSAFETY=3 -DHEAPCODES" \
	  ./configure --cbcx $(MULTIBUILD_OPTIONS) $(MULTIBUILD_32_OPTIONS) --disable-portability $@

# Force ONE_FREE_BIT_HEAPCODES (no use of mmap).
build-porting32-cc-one_free_bit_heapcodes-malloc:
	$(RMRF) $@
	CFLAGS="$(MULTIBUILD_CFLAGS)" \
	CPPFLAGS="-DNO_ARI_ASM -DNO_SP_ASM -DSAFETY=3 -DONE_FREE_BIT_HEAPCODES -DNO_TRIVIALMAP" \
	  ./configure --cbcx $(MULTIBUILD_OPTIONS) $(MULTIBUILD_32_OPTIONS) --disable-portability $@

# Force ONE_FREE_BIT_HEAPCODES with TRIVIALMAP_MEMORY.
build-porting32-cc-one_free_bit_heapcodes-trivialmap:
	$(RMRF) $@
	CFLAGS="$(MULTIBUILD_CFLAGS)" \
	CPPFLAGS="-DNO_ASM -DNO_ARI_ASM -DNO_SP_ASM -DNO_FAST_DISPATCH -DONE_FREE_BIT_HEAPCODES -DTRIVIALMAP_MEMORY" \
	  ./configure --cbcx $(MULTIBUILD_OPTIONS) $(MULTIBUILD_32_OPTIONS) --disable-portability $@

# Force KERNELVOID32_HEAPCODES.
build-porting32-cc-kernelvoid32_heapcodes:
	$(RMRF) $@
	CFLAGS="$(MULTIBUILD_CFLAGS)" \
	CPPFLAGS="-DNO_ASM -DNO_ARI_ASM -DNO_SP_ASM -DNO_FAST_DISPATCH -DKERNELVOID32_HEAPCODES" \
	  ./configure --cbcx $(MULTIBUILD_OPTIONS) $(MULTIBUILD_32_OPTIONS) --disable-portability $@

# Force HEAPCODES with SPVW_PAGES (no use of mmap).
build-porting32-cc-heapcodes-spvw_pages:
	$(RMRF) $@
	CFLAGS="$(MULTIBUILD_CFLAGS)" \
	CPPFLAGS="-DNO_ARI_ASM -DNO_SP_ASM -DSAFETY=3 -DHEAPCODES -DNO_SINGLEMAP -DNO_TRIVIALMAP" \
	  ./configure --cbcx $(MULTIBUILD_OPTIONS) $(MULTIBUILD_32_OPTIONS) --disable-portability $@

# Force TYPECODES with SPVW_PURE_PAGES (no use of mmap).
build-porting32-cc-typecodes-spvw_pure_pages:
	$(RMRF) $@
	CFLAGS="$(MULTIBUILD_CFLAGS)" \
	CPPFLAGS="-DNO_ARI_ASM -DNO_SP_ASM -DSAFETY=3 -DTYPECODES -DNO_SINGLEMAP -DNO_TRIVIALMAP -DPREFER_PURE_PAGES" \
	  ./configure --cbcx $(MULTIBUILD_OPTIONS) $(MULTIBUILD_32_OPTIONS) --disable-portability $@

# Force TYPECODES with SPVW_MIXED_PAGES (no use of mmap).
build-porting32-cc-typecodes-spvw_mixed_pages:
	$(RMRF) $@
	CFLAGS="$(MULTIBUILD_CFLAGS)" \
	CPPFLAGS="-DNO_ARI_ASM -DNO_SP_ASM -DSAFETY=3 -DTYPECODES -DNO_SINGLEMAP -DNO_TRIVIALMAP" \
	  ./configure --cbcx $(MULTIBUILD_OPTIONS) $(MULTIBUILD_32_OPTIONS) --disable-portability $@

# Force HEAPCODES with SPVW_MIXED_BLOCKS.
# Possible further options: -DCONS_HEAP_GROWS_UP or -DCONS_HEAP_GROWS_DOWN.
build-porting32-cc-heapcodes-spvw_mixed_blocks:
	$(RMRF) $@
	CFLAGS="$(MULTIBUILD_CFLAGS)" \
	CPPFLAGS="-DNO_ARI_ASM -DNO_SP_ASM -DSAFETY=3 -DHEAPCODES -DNO_SINGLEMAP" \
	  ./configure --cbcx $(MULTIBUILD_OPTIONS) $(MULTIBUILD_32_OPTIONS) --disable-portability $@

# Force TYPECODES with SPVW_MIXED_BLOCKS (no use of mmap).
# Possible further options: -DCONS_HEAP_GROWS_UP or -DCONS_HEAP_GROWS_DOWN.
build-porting32-cc-typecodes-spvw_mixed_blocks-malloc:
	$(RMRF) $@
	CFLAGS="$(MULTIBUILD_CFLAGS)" \
	CPPFLAGS="-DNO_ARI_ASM -DNO_SP_ASM -DSAFETY=3 -DTYPECODES -DNO_SINGLEMAP -DNO_TRIVIALMAP -DNO_VIRTUAL_MEMORY" \
	  ./configure --cbcx $(MULTIBUILD_OPTIONS) $(MULTIBUILD_32_OPTIONS) --disable-portability $@

# Force TYPECODES with SPVW_MIXED_BLOCKS with TRIVIALMAP_MEMORY.
# Possible further options: -DCONS_HEAP_GROWS_UP or -DCONS_HEAP_GROWS_DOWN.
build-porting32-cc-typecodes-spvw_mixed_blocks-trivialmap:
	$(RMRF) $@
	CFLAGS="$(MULTIBUILD_CFLAGS)" \
	CPPFLAGS="-DNO_ASM -DNO_ARI_ASM -DNO_SP_ASM -DNO_FAST_DISPATCH -DTYPECODES -DNO_SINGLEMAP -DTRIVIALMAP_MEMORY" \
	  ./configure --cbcx $(MULTIBUILD_OPTIONS) $(MULTIBUILD_32_OPTIONS) --disable-portability $@

# Force SPVW_PURE_BLOCKS (equivalent to SINGLEMAP_MEMORY).
build-porting32-cc-spvw_pure_blocks:
	$(RMRF) $@
	CFLAGS="$(MULTIBUILD_CFLAGS)" \
	CPPFLAGS="-DNO_ASM -DNO_ARI_ASM -DNO_SP_ASM -DNO_FAST_DISPATCH -DTYPECODES -DSINGLEMAP_MEMORY" \
	  ./configure --cbcx $(MULTIBUILD_OPTIONS) $(MULTIBUILD_32_OPTIONS) --disable-portability $@

# Force WIDE_SOFT.
build-porting32-cc-wide:
	$(RMRF) $@
	CFLAGS="$(MULTIBUILD_CFLAGS)" \
	CPPFLAGS="-DNO_ARI_ASM -DNO_SP_ASM -DSAFETY=3 -DWIDE" \
	  ./configure --cbcx $(MULTIBUILD_OPTIONS) $(MULTIBUILD_32_OPTIONS) $@

# Force SPVW_MIXED_BLOCKS_OPPOSITE with limited memory size (honor -m option),
build-porting32-cc-limited_memory:
	$(RMRF) $@
	CFLAGS="$(MULTIBUILD_CFLAGS)" \
	CPPFLAGS="-DNO_ARI_ASM -DNO_SP_ASM -DSAFETY=3 -DNO_VIRTUAL_MEMORY -DNO_ADDRESS_SPACE_ASSUMPTIONS" \
	  ./configure --cbcx $(MULTIBUILD_OPTIONS) $(MULTIBUILD_32_OPTIONS) --disable-portability $@

build-porting32-cc-old_gc:
	$(RMRF) $@
	CFLAGS="$(MULTIBUILD_CFLAGS)" \
	CPPFLAGS="-DNO_ARI_ASM -DNO_SP_ASM -DSAFETY=3 -DNO_GENERATIONAL_GC -DOLD_GC" \
	  ./configure --cbcx $(MULTIBUILD_OPTIONS) $(MULTIBUILD_32_OPTIONS) --disable-portability $@

build-porting32-cc-multithread_gc:
	$(RMRF) $@
	CFLAGS="$(MULTIBUILD_CFLAGS)" \
	CPPFLAGS="-DNO_ARI_ASM -DNO_SP_ASM -DSAFETY=3 -DNO_GENERATIONAL_GC" \
	  ./configure --cbcx $(MULTIBUILD_OPTIONS) $(MULTIBUILD_32_OPTIONS) --disable-portability $@

build-porting32-cc-generational_gc-old_gc:
	$(RMRF) $@
	CFLAGS="$(MULTIBUILD_CFLAGS)" \
	CPPFLAGS="-DNO_ARI_ASM -DNO_SP_ASM -DSAFETY=3 -DGENERATIONAL_GC -DOLD_GC" \
	  ./configure --cbcx $(MULTIBUILD_OPTIONS) $(MULTIBUILD_32_OPTIONS) --disable-portability $@

build-porting32-cc-generational_gc-multithread_gc:
	$(RMRF) $@
	CFLAGS="$(MULTIBUILD_CFLAGS)" \
	CPPFLAGS="-DNO_ARI_ASM -DNO_SP_ASM -DSAFETY=3 -DGENERATIONAL_GC" \
	  ./configure --cbcx $(MULTIBUILD_OPTIONS) $(MULTIBUILD_32_OPTIONS) --disable-portability $@

build-porting32-cc-safety0:
	$(RMRF) $@
	CFLAGS="$(MULTIBUILD_CFLAGS)" \
	CPPFLAGS="" \
	  ./configure --cbcx $(MULTIBUILD_OPTIONS) $(MULTIBUILD_32_OPTIONS) --disable-portability $@

# This build is only useful to test the assembly-language code ari*.d.
build-porting32-cc-ari_asm:
	$(RMRF) $@
	CFLAGS="$(MULTIBUILD_CFLAGS)" \
	CPPFLAGS="-DNO_ASM" \
	  ./configure --cbcx $(MULTIBUILD_OPTIONS) $(MULTIBUILD_32_OPTIONS) --disable-portability $@

# This build is only useful to test the assembly-language code ari*.d.
build-porting32-cc-debug_ari_asm:
	$(RMRF) $@
	CFLAGS="$(MULTIBUILD_CFLAGS)" \
	CPPFLAGS="-DNO_ASM -DDEBUG_ARI_ASM" \
	  ./configure --cbcx $(MULTIBUILD_OPTIONS) $(MULTIBUILD_32_OPTIONS) --disable-portability $@

# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# Build and test various configurations, in order to fix bootstrapping problems
# when porting to a 64-bit machine.
#
# Prerequisite: Set the environment variable MULTIBUILD_64_OPTIONS, e.g.
# MULTIBUILD_64_OPTIONS="--with-libsigsegv-prefix=/arch/x86_64-linux-gnu/gnu-inst-libsigsegv/2.11 --with-libffcall-prefix=/arch/x86_64-linux-gnu/gnu-inst-libffcall/1.13pre"
# To build on a 64-bit machine where 32-bit compilation is the default,
# also set the environment variables CC and CXX, for example
# CC="gcc -m64" CXX="g++ -m64"
#
# Use with "make -k", then collects the build-porting64-*/cbcstep*.log.

# Build various configurations. Assumes $CC is GCC and $CXX is GNU g++.
multibuild-porting64-gcc: \
  build-porting64-gcc-portability \
  build-porting64-gcc-safety3 \
  build-porting64-gcc-heapcodes \
  build-porting64-gcc-one_free_bit_heapcodes-malloc \
  build-porting64-gcc-one_free_bit_heapcodes-trivialmap \
  build-porting64-gcc-generic64_heapcodes \
  build-porting64-gcc-heapcodes-spvw_pages \
  build-porting64-gcc-typecodes-spvw_pure_pages \
  build-porting64-gcc-typecodes-spvw_mixed_pages \
  build-porting64-gcc-heapcodes-spvw_mixed_blocks \
  build-porting64-gcc-typecodes-spvw_mixed_blocks-malloc \
  build-porting64-gcc-typecodes-spvw_mixed_blocks-trivialmap \
  build-porting64-gcc-spvw_pure_blocks \
  build-porting64-gcc-limited_memory \
  build-porting64-gcc-old_gc \
  build-porting64-gcc-multithread_gc \
  build-porting64-gcc-generational_gc-old_gc \
  build-porting64-gcc-generational_gc-multithread_gc \
  build-porting64-gcc-safety0 \
  build-porting64-gcc-safety0-optimized \
  build-porting64-gcc-debug_gcsafety

# A build that favours portability over optimization.
build-porting64-gcc-portability:
	$(RMRF) $@
	CFLAGS="-O $(MULTIBUILD_CFLAGS)" \
	CPPFLAGS="" \
	  ./configure --cbcx $(MULTIBUILD_OPTIONS) $(MULTIBUILD_64_OPTIONS) --enable-portability $@

# Nearly the default. Just with some low-cost safety.
build-porting64-gcc-safety3:
	$(RMRF) $@
	CFLAGS="-O $(MULTIBUILD_CFLAGS)" \
	CPPFLAGS="-DNO_ARI_ASM -DNO_SP_ASM -DSAFETY=3" \
	  ./configure --cbcx $(MULTIBUILD_OPTIONS) $(MULTIBUILD_64_OPTIONS) --disable-portability $@

# Force HEAPCODES.
build-porting64-gcc-heapcodes:
	$(RMRF) $@
	CFLAGS="-O $(MULTIBUILD_CFLAGS)" \
	CPPFLAGS="-DNO_ARI_ASM -DNO_SP_ASM -DSAFETY=3 -DHEAPCODES" \
	  ./configure --cbcx $(MULTIBUILD_OPTIONS) $(MULTIBUILD_64_OPTIONS) --disable-portability $@

# Force ONE_FREE_BIT_HEAPCODES (no use of mmap).
build-porting64-gcc-one_free_bit_heapcodes-malloc:
	$(RMRF) $@
	CFLAGS="-O $(MULTIBUILD_CFLAGS)" \
	CPPFLAGS="-DNO_ARI_ASM -DNO_SP_ASM -DSAFETY=3 -DONE_FREE_BIT_HEAPCODES -DNO_TRIVIALMAP" \
	  ./configure --cbcx $(MULTIBUILD_OPTIONS) $(MULTIBUILD_64_OPTIONS) --disable-portability $@

# Force ONE_FREE_BIT_HEAPCODES with TRIVIALMAP_MEMORY.
build-porting64-gcc-one_free_bit_heapcodes-trivialmap:
	$(RMRF) $@
	CFLAGS="-O $(MULTIBUILD_CFLAGS)" \
	CPPFLAGS="-DNO_ASM -DNO_ARI_ASM -DNO_SP_ASM -DNO_FAST_DISPATCH -DONE_FREE_BIT_HEAPCODES -DTRIVIALMAP_MEMORY" \
	  ./configure --cbcx $(MULTIBUILD_OPTIONS) $(MULTIBUILD_64_OPTIONS) --disable-portability $@

# Force GENERIC64_HEAPCODES.
build-porting64-gcc-generic64_heapcodes:
	$(RMRF) $@
	CFLAGS="-O $(MULTIBUILD_CFLAGS)" \
	CPPFLAGS="-DNO_ASM -DNO_ARI_ASM -DNO_SP_ASM -DNO_FAST_DISPATCH -DGENERIC64_HEAPCODES" \
	  ./configure --cbcx $(MULTIBUILD_OPTIONS) $(MULTIBUILD_64_OPTIONS) --disable-portability $@

# Force HEAPCODES with SPVW_PAGES (no use of mmap).
build-porting64-gcc-heapcodes-spvw_pages:
	$(RMRF) $@
	CFLAGS="-O $(MULTIBUILD_CFLAGS)" \
	CPPFLAGS="-DNO_ARI_ASM -DNO_SP_ASM -DSAFETY=3 -DHEAPCODES -DNO_SINGLEMAP -DNO_TRIVIALMAP" \
	  ./configure --cbcx $(MULTIBUILD_OPTIONS) $(MULTIBUILD_64_OPTIONS) --disable-portability $@

# Force TYPECODES with SPVW_PURE_PAGES (no use of mmap).
build-porting64-gcc-typecodes-spvw_pure_pages:
	$(RMRF) $@
	CFLAGS="-O $(MULTIBUILD_CFLAGS)" \
	CPPFLAGS="-DNO_ARI_ASM -DNO_SP_ASM -DSAFETY=3 -DTYPECODES -DNO_SINGLEMAP -DNO_TRIVIALMAP -DPREFER_PURE_PAGES" \
	  ./configure --cbcx $(MULTIBUILD_OPTIONS) $(MULTIBUILD_64_OPTIONS) --disable-portability $@

# Force TYPECODES with SPVW_MIXED_PAGES (no use of mmap).
build-porting64-gcc-typecodes-spvw_mixed_pages:
	$(RMRF) $@
	CFLAGS="-O $(MULTIBUILD_CFLAGS)" \
	CPPFLAGS="-DNO_ARI_ASM -DNO_SP_ASM -DSAFETY=3 -DTYPECODES -DNO_SINGLEMAP -DNO_TRIVIALMAP" \
	  ./configure --cbcx $(MULTIBUILD_OPTIONS) $(MULTIBUILD_64_OPTIONS) --disable-portability $@

# Force HEAPCODES with SPVW_MIXED_BLOCKS.
# Possible further options: -DCONS_HEAP_GROWS_UP or -DCONS_HEAP_GROWS_DOWN.
build-porting64-gcc-heapcodes-spvw_mixed_blocks:
	$(RMRF) $@
	CFLAGS="-O $(MULTIBUILD_CFLAGS)" \
	CPPFLAGS="-DNO_ARI_ASM -DNO_SP_ASM -DSAFETY=3 -DHEAPCODES -DNO_SINGLEMAP" \
	  ./configure --cbcx $(MULTIBUILD_OPTIONS) $(MULTIBUILD_64_OPTIONS) --disable-portability $@

# Force TYPECODES with SPVW_MIXED_BLOCKS (no use of mmap).
# Possible further options: -DCONS_HEAP_GROWS_UP or -DCONS_HEAP_GROWS_DOWN.
build-porting64-gcc-typecodes-spvw_mixed_blocks-malloc:
	$(RMRF) $@
	CFLAGS="-O $(MULTIBUILD_CFLAGS)" \
	CPPFLAGS="-DNO_ARI_ASM -DNO_SP_ASM -DSAFETY=3 -DTYPECODES -DNO_SINGLEMAP -DNO_TRIVIALMAP -DNO_VIRTUAL_MEMORY" \
	  ./configure --cbcx $(MULTIBUILD_OPTIONS) $(MULTIBUILD_64_OPTIONS) --disable-portability $@

# Force TYPECODES with SPVW_MIXED_BLOCKS with TRIVIALMAP_MEMORY.
# Possible further options: -DCONS_HEAP_GROWS_UP or -DCONS_HEAP_GROWS_DOWN.
build-porting64-gcc-typecodes-spvw_mixed_blocks-trivialmap:
	$(RMRF) $@
	CFLAGS="-O $(MULTIBUILD_CFLAGS)" \
	CPPFLAGS="-DNO_ASM -DNO_ARI_ASM -DNO_SP_ASM -DNO_FAST_DISPATCH -DTYPECODES -DNO_SINGLEMAP -DTRIVIALMAP_MEMORY" \
	  ./configure --cbcx $(MULTIBUILD_OPTIONS) $(MULTIBUILD_64_OPTIONS) --disable-portability $@

# Force SPVW_PURE_BLOCKS (equivalent to SINGLEMAP_MEMORY).
build-porting64-gcc-spvw_pure_blocks:
	$(RMRF) $@
	CFLAGS="-O $(MULTIBUILD_CFLAGS)" \
	CPPFLAGS="-DNO_ASM -DNO_ARI_ASM -DNO_SP_ASM -DNO_FAST_DISPATCH -DTYPECODES -DSINGLEMAP_MEMORY" \
	  ./configure --cbcx $(MULTIBUILD_OPTIONS) $(MULTIBUILD_64_OPTIONS) --disable-portability $@

# Force SPVW_MIXED_BLOCKS_OPPOSITE with limited memory size (honor -m option),
build-porting64-gcc-limited_memory:
	$(RMRF) $@
	CFLAGS="-O $(MULTIBUILD_CFLAGS)" \
	CPPFLAGS="-DNO_ARI_ASM -DNO_SP_ASM -DSAFETY=3 -DNO_VIRTUAL_MEMORY -DNO_ADDRESS_SPACE_ASSUMPTIONS" \
	  ./configure --cbcx $(MULTIBUILD_OPTIONS) $(MULTIBUILD_64_OPTIONS) --disable-portability $@

build-porting64-gcc-old_gc:
	$(RMRF) $@
	CFLAGS="-O $(MULTIBUILD_CFLAGS)" \
	CPPFLAGS="-DNO_ARI_ASM -DNO_SP_ASM -DSAFETY=3 -DNO_GENERATIONAL_GC -DOLD_GC" \
	  ./configure --cbcx $(MULTIBUILD_OPTIONS) $(MULTIBUILD_64_OPTIONS) --disable-portability $@

build-porting64-gcc-multithread_gc:
	$(RMRF) $@
	CFLAGS="-O $(MULTIBUILD_CFLAGS)" \
	CPPFLAGS="-DNO_ARI_ASM -DNO_SP_ASM -DSAFETY=3 -DNO_GENERATIONAL_GC" \
	  ./configure --cbcx $(MULTIBUILD_OPTIONS) $(MULTIBUILD_64_OPTIONS) --disable-portability $@

build-porting64-gcc-generational_gc-old_gc:
	$(RMRF) $@
	CFLAGS="-O $(MULTIBUILD_CFLAGS)" \
	CPPFLAGS="-DNO_ARI_ASM -DNO_SP_ASM -DSAFETY=3 -DGENERATIONAL_GC -DOLD_GC" \
	  ./configure --cbcx $(MULTIBUILD_OPTIONS) $(MULTIBUILD_64_OPTIONS) --disable-portability $@

build-porting64-gcc-generational_gc-multithread_gc:
	$(RMRF) $@
	CFLAGS="-O $(MULTIBUILD_CFLAGS)" \
	CPPFLAGS="-DNO_ARI_ASM -DNO_SP_ASM -DSAFETY=3 -DGENERATIONAL_GC" \
	  ./configure --cbcx $(MULTIBUILD_OPTIONS) $(MULTIBUILD_64_OPTIONS) --disable-portability $@

build-porting64-gcc-safety0:
	$(RMRF) $@
	CFLAGS="-O $(MULTIBUILD_CFLAGS)" \
	CPPFLAGS="" \
	  ./configure --cbcx $(MULTIBUILD_OPTIONS) $(MULTIBUILD_64_OPTIONS) --disable-portability $@

build-porting64-gcc-safety0-optimized:
	$(RMRF) $@
	CFLAGS="-O2 -fexpensive-optimizations $(MULTIBUILD_CFLAGS)" \
	CPPFLAGS="" \
	  ./configure --cbcx $(MULTIBUILD_OPTIONS) $(MULTIBUILD_64_OPTIONS) --disable-portability $@

build-porting64-gcc-debug_gcsafety:
	$(RMRF) $@
	ulimit -c unlimited; \
	CC="$${CXX-g++}" \
	CFLAGS="$(MULTIBUILD_CFLAGS)" \
	CPPFLAGS="" \
	  ./configure --cbcx $(MULTIBUILD_OPTIONS) $(MULTIBUILD_64_OPTIONS) --disable-portability --with-debug $@

# This build is only useful to test the assembly-language code ari*.d.
build-porting64-gcc-ari_asm:
	$(RMRF) $@
	CFLAGS="-O $(MULTIBUILD_CFLAGS)" \
	CPPFLAGS="-DNO_ASM" \
	  ./configure --cbcx $(MULTIBUILD_OPTIONS) $(MULTIBUILD_64_OPTIONS) --disable-portability $@

# This build is only useful to test the assembly-language code ari*.d.
build-porting64-gcc-debug_ari_asm:
	$(RMRF) $@
	CFLAGS="-O $(MULTIBUILD_CFLAGS)" \
	CPPFLAGS="-DNO_ASM -DDEBUG_ARI_ASM" \
	  ./configure --cbcx $(MULTIBUILD_OPTIONS) $(MULTIBUILD_64_OPTIONS) --disable-portability $@

# This build is only useful to test the GCC asm macros in arilev0.d.
build-porting64-gcc-arilev0-asm:
	$(RMRF) $@
	CFLAGS="-O $(MULTIBUILD_CFLAGS)" \
	CPPFLAGS="-DNO_ARI_ASM" \
	  ./configure --cbcx $(MULTIBUILD_OPTIONS) $(MULTIBUILD_64_OPTIONS) --disable-portability $@

# Build various configurations. Assumes $CC is not GCC.
# Put the optimization options into $CC.
multibuild-porting64-cc: \
  build-porting64-cc-portability \
  build-porting64-cc-safety3 \
  build-porting64-cc-heapcodes \
  build-porting64-cc-one_free_bit_heapcodes-malloc \
  build-porting64-cc-one_free_bit_heapcodes-trivialmap \
  build-porting64-cc-generic64_heapcodes \
  build-porting64-cc-heapcodes-spvw_pages \
  build-porting64-cc-typecodes-spvw_pure_pages \
  build-porting64-cc-typecodes-spvw_mixed_pages \
  build-porting64-cc-heapcodes-spvw_mixed_blocks \
  build-porting64-cc-typecodes-spvw_mixed_blocks-malloc \
  build-porting64-cc-typecodes-spvw_mixed_blocks-trivialmap \
  build-porting64-cc-spvw_pure_blocks \
  build-porting64-cc-limited_memory \
  build-porting64-cc-old_gc \
  build-porting64-cc-multithread_gc \
  build-porting64-cc-generational_gc-old_gc \
  build-porting64-cc-generational_gc-multithread_gc \
  build-porting64-cc-safety0

# A build that favours portability over optimization.
build-porting64-cc-portability:
	$(RMRF) $@
	CFLAGS="$(MULTIBUILD_CFLAGS)" \
	CPPFLAGS="" \
	  ./configure --cbcx $(MULTIBUILD_OPTIONS) $(MULTIBUILD_64_OPTIONS) --enable-portability $@

# Nearly the default. Just with some low-cost safety.
build-porting64-cc-safety3:
	$(RMRF) $@
	CFLAGS="$(MULTIBUILD_CFLAGS)" \
	CPPFLAGS="-DNO_ARI_ASM -DNO_SP_ASM -DSAFETY=3" \
	  ./configure --cbcx $(MULTIBUILD_OPTIONS) $(MULTIBUILD_64_OPTIONS) --disable-portability $@

# Force HEAPCODES.
build-porting64-cc-heapcodes:
	$(RMRF) $@
	CFLAGS="$(MULTIBUILD_CFLAGS)" \
	CPPFLAGS="-DNO_ARI_ASM -DNO_SP_ASM -DSAFETY=3 -DHEAPCODES" \
	  ./configure --cbcx $(MULTIBUILD_OPTIONS) $(MULTIBUILD_64_OPTIONS) --disable-portability $@

# Force ONE_FREE_BIT_HEAPCODES (no use of mmap).
build-porting64-cc-one_free_bit_heapcodes-malloc:
	$(RMRF) $@
	CFLAGS="$(MULTIBUILD_CFLAGS)" \
	CPPFLAGS="-DNO_ARI_ASM -DNO_SP_ASM -DSAFETY=3 -DONE_FREE_BIT_HEAPCODES -DNO_TRIVIALMAP" \
	  ./configure --cbcx $(MULTIBUILD_OPTIONS) $(MULTIBUILD_64_OPTIONS) --disable-portability $@

# Force ONE_FREE_BIT_HEAPCODES with TRIVIALMAP_MEMORY.
build-porting64-cc-one_free_bit_heapcodes-trivialmap:
	$(RMRF) $@
	CFLAGS="$(MULTIBUILD_CFLAGS)" \
	CPPFLAGS="-DNO_ASM -DNO_ARI_ASM -DNO_SP_ASM -DNO_FAST_DISPATCH -DONE_FREE_BIT_HEAPCODES -DTRIVIALMAP_MEMORY" \
	  ./configure --cbcx $(MULTIBUILD_OPTIONS) $(MULTIBUILD_64_OPTIONS) --disable-portability $@

# Force GENERIC64_HEAPCODES.
build-porting64-cc-generic64_heapcodes:
	$(RMRF) $@
	CFLAGS="$(MULTIBUILD_CFLAGS)" \
	CPPFLAGS="-DNO_ASM -DNO_ARI_ASM -DNO_SP_ASM -DNO_FAST_DISPATCH -DGENERIC64_HEAPCODES" \
	  ./configure --cbcx $(MULTIBUILD_OPTIONS) $(MULTIBUILD_64_OPTIONS) --disable-portability $@

# Force HEAPCODES with SPVW_PAGES (no use of mmap).
build-porting64-cc-heapcodes-spvw_pages:
	$(RMRF) $@
	CFLAGS="$(MULTIBUILD_CFLAGS)" \
	CPPFLAGS="-DNO_ARI_ASM -DNO_SP_ASM -DSAFETY=3 -DHEAPCODES -DNO_SINGLEMAP -DNO_TRIVIALMAP" \
	  ./configure --cbcx $(MULTIBUILD_OPTIONS) $(MULTIBUILD_64_OPTIONS) --disable-portability $@

# Force TYPECODES with SPVW_PURE_PAGES (no use of mmap).
build-porting64-cc-typecodes-spvw_pure_pages:
	$(RMRF) $@
	CFLAGS="$(MULTIBUILD_CFLAGS)" \
	CPPFLAGS="-DNO_ARI_ASM -DNO_SP_ASM -DSAFETY=3 -DTYPECODES -DNO_SINGLEMAP -DNO_TRIVIALMAP -DPREFER_PURE_PAGES" \
	  ./configure --cbcx $(MULTIBUILD_OPTIONS) $(MULTIBUILD_64_OPTIONS) --disable-portability $@

# Force TYPECODES with SPVW_MIXED_PAGES (no use of mmap).
build-porting64-cc-typecodes-spvw_mixed_pages:
	$(RMRF) $@
	CFLAGS="$(MULTIBUILD_CFLAGS)" \
	CPPFLAGS="-DNO_ARI_ASM -DNO_SP_ASM -DSAFETY=3 -DTYPECODES -DNO_SINGLEMAP -DNO_TRIVIALMAP" \
	  ./configure --cbcx $(MULTIBUILD_OPTIONS) $(MULTIBUILD_64_OPTIONS) --disable-portability $@

# Force HEAPCODES with SPVW_MIXED_BLOCKS.
# Possible further options: -DCONS_HEAP_GROWS_UP or -DCONS_HEAP_GROWS_DOWN.
build-porting64-cc-heapcodes-spvw_mixed_blocks:
	$(RMRF) $@
	CFLAGS="$(MULTIBUILD_CFLAGS)" \
	CPPFLAGS="-DNO_ARI_ASM -DNO_SP_ASM -DSAFETY=3 -DHEAPCODES -DNO_SINGLEMAP" \
	  ./configure --cbcx $(MULTIBUILD_OPTIONS) $(MULTIBUILD_64_OPTIONS) --disable-portability $@

# Force TYPECODES with SPVW_MIXED_BLOCKS (no use of mmap).
# Possible further options: -DCONS_HEAP_GROWS_UP or -DCONS_HEAP_GROWS_DOWN.
build-porting64-cc-typecodes-spvw_mixed_blocks-malloc:
	$(RMRF) $@
	CFLAGS="$(MULTIBUILD_CFLAGS)" \
	CPPFLAGS="-DNO_ARI_ASM -DNO_SP_ASM -DSAFETY=3 -DTYPECODES -DNO_SINGLEMAP -DNO_TRIVIALMAP -DNO_VIRTUAL_MEMORY" \
	  ./configure --cbcx $(MULTIBUILD_OPTIONS) $(MULTIBUILD_64_OPTIONS) --disable-portability $@

# Force TYPECODES with SPVW_MIXED_BLOCKS with TRIVIALMAP_MEMORY.
# Possible further options: -DCONS_HEAP_GROWS_UP or -DCONS_HEAP_GROWS_DOWN.
build-porting64-cc-typecodes-spvw_mixed_blocks-trivialmap:
	$(RMRF) $@
	CFLAGS="$(MULTIBUILD_CFLAGS)" \
	CPPFLAGS="-DNO_ASM -DNO_ARI_ASM -DNO_SP_ASM -DNO_FAST_DISPATCH -DTYPECODES -DNO_SINGLEMAP -DTRIVIALMAP_MEMORY" \
	  ./configure --cbcx $(MULTIBUILD_OPTIONS) $(MULTIBUILD_64_OPTIONS) --disable-portability $@

# Force SPVW_PURE_BLOCKS (equivalent to SINGLEMAP_MEMORY).
build-porting64-cc-spvw_pure_blocks:
	$(RMRF) $@
	CFLAGS="$(MULTIBUILD_CFLAGS)" \
	CPPFLAGS="-DNO_ASM -DNO_ARI_ASM -DNO_SP_ASM -DNO_FAST_DISPATCH -DTYPECODES -DSINGLEMAP_MEMORY" \
	  ./configure --cbcx $(MULTIBUILD_OPTIONS) $(MULTIBUILD_64_OPTIONS) --disable-portability $@

# Force SPVW_MIXED_BLOCKS_OPPOSITE with limited memory size (honor -m option),
build-porting64-cc-limited_memory:
	$(RMRF) $@
	CFLAGS="$(MULTIBUILD_CFLAGS)" \
	CPPFLAGS="-DNO_ARI_ASM -DNO_SP_ASM -DSAFETY=3 -DNO_VIRTUAL_MEMORY -DNO_ADDRESS_SPACE_ASSUMPTIONS" \
	  ./configure --cbcx $(MULTIBUILD_OPTIONS) $(MULTIBUILD_64_OPTIONS) --disable-portability $@

build-porting64-cc-old_gc:
	$(RMRF) $@
	CFLAGS="$(MULTIBUILD_CFLAGS)" \
	CPPFLAGS="-DNO_ARI_ASM -DNO_SP_ASM -DSAFETY=3 -DNO_GENERATIONAL_GC -DOLD_GC" \
	  ./configure --cbcx $(MULTIBUILD_OPTIONS) $(MULTIBUILD_64_OPTIONS) --disable-portability $@

build-porting64-cc-multithread_gc:
	$(RMRF) $@
	CFLAGS="$(MULTIBUILD_CFLAGS)" \
	CPPFLAGS="-DNO_ARI_ASM -DNO_SP_ASM -DSAFETY=3 -DNO_GENERATIONAL_GC" \
	  ./configure --cbcx $(MULTIBUILD_OPTIONS) $(MULTIBUILD_64_OPTIONS) --disable-portability $@

build-porting64-cc-generational_gc-old_gc:
	$(RMRF) $@
	CFLAGS="$(MULTIBUILD_CFLAGS)" \
	CPPFLAGS="-DNO_ARI_ASM -DNO_SP_ASM -DSAFETY=3 -DGENERATIONAL_GC -DOLD_GC" \
	  ./configure --cbcx $(MULTIBUILD_OPTIONS) $(MULTIBUILD_64_OPTIONS) --disable-portability $@

build-porting64-cc-generational_gc-multithread_gc:
	$(RMRF) $@
	CFLAGS="$(MULTIBUILD_CFLAGS)" \
	CPPFLAGS="-DNO_ARI_ASM -DNO_SP_ASM -DSAFETY=3 -DGENERATIONAL_GC" \
	  ./configure --cbcx $(MULTIBUILD_OPTIONS) $(MULTIBUILD_64_OPTIONS) --disable-portability $@

build-porting64-cc-safety0:
	$(RMRF) $@
	CFLAGS="$(MULTIBUILD_CFLAGS)" \
	CPPFLAGS="" \
	  ./configure --cbcx $(MULTIBUILD_OPTIONS) $(MULTIBUILD_64_OPTIONS) --disable-portability $@

# This build is only useful to test the assembly-language code ari*.d.
build-porting64-cc-ari_asm:
	$(RMRF) $@
	CFLAGS="$(MULTIBUILD_CFLAGS)" \
	CPPFLAGS="-DNO_ASM" \
	  ./configure --cbcx $(MULTIBUILD_OPTIONS) $(MULTIBUILD_64_OPTIONS) --disable-portability $@

# This build is only useful to test the assembly-language code ari*.d.
build-porting64-cc-debug_ari_asm:
	$(RMRF) $@
	CFLAGS="$(MULTIBUILD_CFLAGS)" \
	CPPFLAGS="-DNO_ASM -DDEBUG_ARI_ASM" \
	  ./configure --cbcx $(MULTIBUILD_OPTIONS) $(MULTIBUILD_64_OPTIONS) --disable-portability $@

# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# Build and test various configurations that are supposed to work on a
# specified platform.

# Sort order: Keep this list sorted by
#   1. word size (32-bit before 64-bit),
#   2. operating system (Linux, *BSD, Mac OS X, proprietary Unices, Windows)
#   3. CPU and ABI (alphabetically, x86_64 mapping to amd64)

# 32-bit platforms:

# Linux/x86_64 with 32-bit x32 ABI
# TODO: build-porting32-gcc-typecodes-spvw_mixed_blocks-trivialmap
# currently works only without GENERATIONAL_GC.
multibuild-linux-x86_64-32: \
  build-porting32-gcc-portability \
  build-porting32-gcc-safety3 \
  build-porting32-gcc-heapcodes \
  build-porting32-gcc-one_free_bit_heapcodes-malloc \
  build-porting32-gcc-one_free_bit_heapcodes-trivialmap \
  build-porting32-gcc-kernelvoid32_heapcodes \
  build-porting32-gcc-heapcodes-spvw_pages \
  build-porting32-gcc-heapcodes-spvw_mixed_blocks \
  build-porting32-gcc-typecodes-spvw_mixed_blocks-trivialmap \
  build-porting32-gcc-spvw_pure_blocks \
  build-porting32-gcc-wide \
  build-porting32-gcc-limited_memory \
  build-porting32-gcc-old_gc \
  build-porting32-gcc-multithread_gc \
  build-porting32-gcc-generational_gc-old_gc \
  build-porting32-gcc-generational_gc-multithread_gc \
  build-porting32-gcc-safety0 \
  build-porting32-gcc-safety0-optimized \
  build-porting32-gcc-debug_gcsafety

# Linux/arm
multibuild-linux-arm: \
  build-porting32-gcc-portability \
  build-porting32-gcc-safety3 \
  build-porting32-gcc-typecodes-spvw_mixed_blocks-trivialmap \
  build-porting32-gcc-wide \
  build-porting32-gcc-limited_memory \
  build-porting32-gcc-old_gc \
  build-porting32-gcc-multithread_gc \
  build-porting32-gcc-generational_gc-old_gc \
  build-porting32-gcc-generational_gc-multithread_gc \
  build-porting32-gcc-safety0 \
  build-porting32-gcc-safety0-optimized \
  build-porting32-gcc-debug_gcsafety \
  build-porting32-gcc-debug_ari_asm

# Linux/hppa
multibuild-linux-hppa: \
  build-porting32-gcc-portability \
  build-porting32-gcc-safety3 \
  build-porting32-gcc-heapcodes \
  build-porting32-gcc-one_free_bit_heapcodes-malloc \
  build-porting32-gcc-one_free_bit_heapcodes-trivialmap \
  build-porting32-gcc-kernelvoid32_heapcodes \
  build-porting32-gcc-heapcodes-spvw_pages \
  build-porting32-gcc-heapcodes-spvw_mixed_blocks \
  build-porting32-gcc-typecodes-spvw_mixed_blocks-trivialmap \
  build-porting32-gcc-spvw_pure_blocks \
  build-porting32-gcc-wide \
  build-porting32-gcc-limited_memory \
  build-porting32-gcc-old_gc \
  build-porting32-gcc-multithread_gc \
  build-porting32-gcc-safety0 \
  build-porting32-gcc-safety0-optimized \
  build-porting32-gcc-debug_gcsafety \
  build-porting32-gcc-debug_ari_asm

# Linux/i386
multibuild-linux-i386: \
  build-porting32-gcc-portability \
  build-porting32-gcc-safety3 \
  build-porting32-gcc-heapcodes \
  build-porting32-gcc-one_free_bit_heapcodes-trivialmap \
  build-porting32-gcc-kernelvoid32_heapcodes \
  build-porting32-gcc-heapcodes-spvw_pages \
  build-porting32-gcc-heapcodes-spvw_mixed_blocks \
  build-porting32-gcc-wide \
  build-porting32-gcc-limited_memory \
  build-porting32-gcc-old_gc \
  build-porting32-gcc-multithread_gc \
  build-porting32-gcc-generational_gc-old_gc \
  build-porting32-gcc-generational_gc-multithread_gc \
  build-porting32-gcc-safety0 \
  build-porting32-gcc-safety0-optimized \
  build-porting32-gcc-debug_gcsafety \
  build-porting32-gcc-debug_ari_asm

# Linux/m68k
multibuild-linux-m68k: \
  build-porting32-gcc-portability \
  build-porting32-gcc-safety3 \
  build-porting32-gcc-heapcodes \
  build-porting32-gcc-one_free_bit_heapcodes-malloc \
  build-porting32-gcc-kernelvoid32_heapcodes \
  build-porting32-gcc-heapcodes-spvw_pages \
  build-porting32-gcc-heapcodes-spvw_mixed_blocks \
  build-porting32-gcc-typecodes-spvw_mixed_blocks-trivialmap \
  build-porting32-gcc-spvw_pure_blocks \
  build-porting32-gcc-wide \
  build-porting32-gcc-limited_memory \
  build-porting32-gcc-old_gc \
  build-porting32-gcc-multithread_gc \
  build-porting32-gcc-safety0 \
  build-porting32-gcc-safety0-optimized \
  build-porting32-gcc-debug_gcsafety

# Linux/mipseb and Linux/mipsel with o32 ABI
multibuild-linux-mips-32: \
  build-porting32-gcc-portability \
  build-porting32-gcc-safety3 \
  build-porting32-gcc-heapcodes \
  build-porting32-gcc-one_free_bit_heapcodes-malloc \
  build-porting32-gcc-one_free_bit_heapcodes-trivialmap \
  build-porting32-gcc-kernelvoid32_heapcodes \
  build-porting32-gcc-heapcodes-spvw_pages \
  build-porting32-gcc-heapcodes-spvw_mixed_blocks \
  build-porting32-gcc-wide \
  build-porting32-gcc-limited_memory \
  build-porting32-gcc-old_gc \
  build-porting32-gcc-multithread_gc \
  build-porting32-gcc-safety0 \
  build-porting32-gcc-safety0-optimized \
  build-porting32-gcc-debug_gcsafety \
  build-porting32-gcc-debug_ari_asm

# Linux/mipseb and Linux/mipsel with n32 ABI
multibuild-linux-mips-n32: \
  build-porting32-gcc-portability \
  build-porting32-gcc-safety3 \
  build-porting32-gcc-heapcodes \
  build-porting32-gcc-one_free_bit_heapcodes-malloc \
  build-porting32-gcc-one_free_bit_heapcodes-trivialmap \
  build-porting32-gcc-kernelvoid32_heapcodes \
  build-porting32-gcc-heapcodes-spvw_pages \
  build-porting32-gcc-heapcodes-spvw_mixed_blocks \
  build-porting32-gcc-spvw_pure_blocks \
  build-porting32-gcc-wide \
  build-porting32-gcc-limited_memory \
  build-porting32-gcc-old_gc \
  build-porting32-gcc-multithread_gc \
  build-porting32-gcc-safety0 \
  build-porting32-gcc-safety0-optimized \
  build-porting32-gcc-debug_gcsafety \
  build-porting32-gcc-debug_ari_asm

# Linux/powerpc64 with 32-bit ABI
multibuild-linux-powerpc: \
  build-porting32-gcc-portability \
  build-porting32-gcc-safety3 \
  build-porting32-gcc-heapcodes \
  build-porting32-gcc-one_free_bit_heapcodes-malloc \
  build-porting32-gcc-one_free_bit_heapcodes-trivialmap \
  build-porting32-gcc-kernelvoid32_heapcodes \
  build-porting32-gcc-heapcodes-spvw_pages \
  build-porting32-gcc-heapcodes-spvw_mixed_blocks \
  build-porting32-gcc-wide \
  build-porting32-gcc-limited_memory \
  build-porting32-gcc-old_gc \
  build-porting32-gcc-multithread_gc \
  build-porting32-gcc-generational_gc-old_gc \
  build-porting32-gcc-generational_gc-multithread_gc \
  build-porting32-gcc-safety0 \
  build-porting32-gcc-safety0-optimized \
  build-porting32-gcc-debug_gcsafety

# Linux/s390x with 32-bit ABI
multibuild-linux-s390: \
  build-porting32-gcc-portability \
  build-porting32-gcc-safety3 \
  build-porting32-gcc-heapcodes \
  build-porting32-gcc-one_free_bit_heapcodes-malloc \
  build-porting32-gcc-one_free_bit_heapcodes-trivialmap \
  build-porting32-gcc-kernelvoid32_heapcodes \
  build-porting32-gcc-heapcodes-spvw_pages \
  build-porting32-gcc-heapcodes-spvw_mixed_blocks \
  build-porting32-gcc-spvw_pure_blocks \
  build-porting32-gcc-wide \
  build-porting32-gcc-limited_memory \
  build-porting32-gcc-old_gc \
  build-porting32-gcc-multithread_gc \
  build-porting32-gcc-generational_gc-old_gc \
  build-porting32-gcc-generational_gc-multithread_gc \
  build-porting32-gcc-safety0 \
  build-porting32-gcc-safety0-optimized \
  build-porting32-gcc-debug_gcsafety

# Linux/sparc64 with 32-bit ABI
multibuild-linux-sparc: \
  build-porting32-gcc-portability \
  build-porting32-gcc-safety3 \
  build-porting32-gcc-heapcodes \
  build-porting32-gcc-one_free_bit_heapcodes-malloc \
  build-porting32-gcc-one_free_bit_heapcodes-trivialmap \
  build-porting32-gcc-kernelvoid32_heapcodes \
  build-porting32-gcc-heapcodes-spvw_pages \
  build-porting32-gcc-heapcodes-spvw_mixed_blocks \
  build-porting32-gcc-wide \
  build-porting32-gcc-limited_memory \
  build-porting32-gcc-old_gc \
  build-porting32-gcc-multithread_gc \
  build-porting32-gcc-generational_gc-old_gc \
  build-porting32-gcc-generational_gc-multithread_gc \
  build-porting32-gcc-safety0 \
  build-porting32-gcc-safety0-optimized \
  build-porting32-gcc-debug_gcsafety \
  build-porting32-gcc-debug_ari_asm

# Hurd/i386
multibuild-hurd-i386: \
  build-porting32-gcc-portability \
  build-porting32-gcc-safety3 \
  build-porting32-gcc-heapcodes \
  build-porting32-gcc-one_free_bit_heapcodes-malloc \
  build-porting32-gcc-one_free_bit_heapcodes-trivialmap \
  build-porting32-gcc-kernelvoid32_heapcodes \
  build-porting32-gcc-heapcodes-spvw_pages \
  build-porting32-gcc-heapcodes-spvw_mixed_blocks \
  build-porting32-gcc-wide \
  build-porting32-gcc-limited_memory \
  build-porting32-gcc-old_gc \
  build-porting32-gcc-multithread_gc \
  build-porting32-gcc-generational_gc-old_gc \
  build-porting32-gcc-generational_gc-multithread_gc \
  build-porting32-gcc-safety0 \
  build-porting32-gcc-safety0-optimized \
  build-porting32-gcc-debug_gcsafety \
  build-porting32-gcc-debug_ari_asm

# FreeBSD/i386
multibuild-freebsd-i386: \
  build-porting32-gcc-portability \
  build-porting32-gcc-safety3 \
  build-porting32-gcc-heapcodes \
  build-porting32-gcc-one_free_bit_heapcodes-malloc \
  build-porting32-gcc-one_free_bit_heapcodes-trivialmap \
  build-porting32-gcc-kernelvoid32_heapcodes \
  build-porting32-gcc-heapcodes-spvw_pages \
  build-porting32-gcc-heapcodes-spvw_mixed_blocks \
  build-porting32-gcc-wide \
  build-porting32-gcc-limited_memory \
  build-porting32-gcc-old_gc \
  build-porting32-gcc-multithread_gc \
  build-porting32-gcc-generational_gc-old_gc \
  build-porting32-gcc-generational_gc-multithread_gc \
  build-porting32-gcc-safety0 \
  build-porting32-gcc-safety0-optimized \
  build-porting32-gcc-debug_ari_asm

# GNU/kFreeBSD/i386
multibuild-freebsd-gnu-i386: \
  build-porting32-gcc-portability \
  build-porting32-gcc-safety3 \
  build-porting32-gcc-heapcodes \
  build-porting32-gcc-one_free_bit_heapcodes-malloc \
  build-porting32-gcc-one_free_bit_heapcodes-trivialmap \
  build-porting32-gcc-kernelvoid32_heapcodes \
  build-porting32-gcc-heapcodes-spvw_pages \
  build-porting32-gcc-heapcodes-spvw_mixed_blocks \
  build-porting32-gcc-wide \
  build-porting32-gcc-limited_memory \
  build-porting32-gcc-old_gc \
  build-porting32-gcc-multithread_gc \
  build-porting32-gcc-generational_gc-old_gc \
  build-porting32-gcc-generational_gc-multithread_gc \
  build-porting32-gcc-safety0 \
  build-porting32-gcc-safety0-optimized \
  build-porting32-gcc-debug_gcsafety \
  build-porting32-gcc-debug_ari_asm

# DragonFly/i386
multibuild-dragonfly-i386: multibuild-freebsd-i386

# NetBSD/i386
multibuild-netbsd-i386: \
  build-porting32-gcc-portability \
  build-porting32-gcc-safety3 \
  build-porting32-gcc-heapcodes \
  build-porting32-gcc-one_free_bit_heapcodes-malloc \
  build-porting32-gcc-one_free_bit_heapcodes-trivialmap \
  build-porting32-gcc-kernelvoid32_heapcodes \
  build-porting32-gcc-heapcodes-spvw_pages \
  build-porting32-gcc-heapcodes-spvw_mixed_blocks \
  build-porting32-gcc-typecodes-spvw_mixed_blocks-trivialmap \
  build-porting32-gcc-spvw_pure_blocks \
  build-porting32-gcc-wide \
  build-porting32-gcc-limited_memory \
  build-porting32-gcc-old_gc \
  build-porting32-gcc-multithread_gc \
  build-porting32-gcc-generational_gc-old_gc \
  build-porting32-gcc-generational_gc-multithread_gc \
  build-porting32-gcc-safety0 \
  build-porting32-gcc-safety0-optimized \
  build-porting32-gcc-debug_gcsafety \
  build-porting32-gcc-debug_ari_asm

# NetBSD/sparc
multibuild-netbsd-sparc: \
  build-porting32-gcc-portability \
  build-porting32-gcc-safety3 \
  build-porting32-gcc-heapcodes \
  build-porting32-gcc-one_free_bit_heapcodes-malloc \
  build-porting32-gcc-one_free_bit_heapcodes-trivialmap \
  build-porting32-gcc-kernelvoid32_heapcodes \
  build-porting32-gcc-heapcodes-spvw_pages \
  build-porting32-gcc-heapcodes-spvw_mixed_blocks \
  build-porting32-gcc-typecodes-spvw_mixed_blocks-trivialmap \
  build-porting32-gcc-wide \
  build-porting32-gcc-limited_memory \
  build-porting32-gcc-old_gc \
  build-porting32-gcc-multithread_gc \
  build-porting32-gcc-safety0 \
  build-porting32-gcc-safety0-optimized \
  build-porting32-gcc-debug_gcsafety \
  build-porting32-gcc-debug_ari_asm

# OpenBSD/i386
# Note: build-porting32-gcc-debug_gcsafety has compilation failures on some
# OpenBSD versions.
multibuild-openbsd-i386: \
  build-porting32-gcc-portability \
  build-porting32-gcc-safety3 \
  build-porting32-gcc-heapcodes \
  build-porting32-gcc-kernelvoid32_heapcodes \
  build-porting32-gcc-heapcodes-spvw_pages \
  build-porting32-gcc-heapcodes-spvw_mixed_blocks \
  build-porting32-gcc-wide \
  build-porting32-gcc-limited_memory \
  build-porting32-gcc-old_gc \
  build-porting32-gcc-multithread_gc \
  build-porting32-gcc-generational_gc-old_gc \
  build-porting32-gcc-generational_gc-multithread_gc \
  build-porting32-gcc-safety0 \
  build-porting32-gcc-safety0-optimized \
  build-porting32-gcc-debug_gcsafety \
  build-porting32-gcc-debug_ari_asm

# Mac OS X/i386
multibuild-macosx-i386: \
  build-porting32-gcc-portability \
  build-porting32-gcc-safety3 \
  build-porting32-gcc-heapcodes \
  build-porting32-gcc-one_free_bit_heapcodes-malloc \
  build-porting32-gcc-one_free_bit_heapcodes-trivialmap \
  build-porting32-gcc-kernelvoid32_heapcodes \
  build-porting32-gcc-heapcodes-spvw_pages \
  build-porting32-gcc-heapcodes-spvw_mixed_blocks \
  build-porting32-gcc-typecodes-spvw_mixed_blocks-trivialmap \
  build-porting32-gcc-spvw_pure_blocks \
  build-porting32-gcc-wide \
  build-porting32-gcc-limited_memory \
  build-porting32-gcc-old_gc \
  build-porting32-gcc-multithread_gc \
  build-porting32-gcc-generational_gc-old_gc \
  build-porting32-gcc-generational_gc-multithread_gc \
  build-porting32-gcc-safety0 \
  build-porting32-gcc-safety0-optimized \
  build-porting32-gcc-debug_gcsafety \
  build-porting32-gcc-debug_ari_asm

# Mac OS X/PowerPC
# Note: The two generational_gc builds
# don't work on Mac OS X 10.5/x86_64 with CC="gcc -arch ppc",
# but they do work on Mac OS X 10.5/PowerPC.
multibuild-macosx-powerpc: \
  build-porting32-gcc-portability \
  build-porting32-gcc-safety3 \
  build-porting32-gcc-heapcodes \
  build-porting32-gcc-one_free_bit_heapcodes-malloc \
  build-porting32-gcc-one_free_bit_heapcodes-trivialmap \
  build-porting32-gcc-kernelvoid32_heapcodes \
  build-porting32-gcc-heapcodes-spvw_pages \
  build-porting32-gcc-heapcodes-spvw_mixed_blocks \
  build-porting32-gcc-typecodes-spvw_mixed_blocks-trivialmap \
  build-porting32-gcc-spvw_pure_blocks \
  build-porting32-gcc-wide \
  build-porting32-gcc-limited_memory \
  build-porting32-gcc-old_gc \
  build-porting32-gcc-multithread_gc \
  build-porting32-gcc-generational_gc-old_gc \
  build-porting32-gcc-generational_gc-multithread_gc \
  build-porting32-gcc-safety0 \
  build-porting32-gcc-safety0-optimized \
  build-porting32-gcc-debug_gcsafety

# AIX/POWER with 32-bit ABI
multibuild-aix-powerpc-32-xlc: \
  build-porting32-cc-portability \
  build-porting32-cc-safety3 \
  build-porting32-cc-heapcodes \
  build-porting32-cc-one_free_bit_heapcodes-malloc \
  build-porting32-cc-one_free_bit_heapcodes-trivialmap \
  build-porting32-cc-heapcodes-spvw_pages \
  build-porting32-cc-heapcodes-spvw_mixed_blocks \
  build-porting32-cc-wide \
  build-porting32-cc-limited_memory \
  build-porting32-cc-old_gc \
  build-porting32-cc-multithread_gc \
  build-porting32-cc-generational_gc-old_gc \
  build-porting32-cc-generational_gc-multithread_gc \
  build-porting32-cc-safety0
multibuild-aix-powerpc-32-gcc: \
  build-porting32-gcc-portability \
  build-porting32-gcc-safety3 \
  build-porting32-gcc-heapcodes \
  build-porting32-gcc-one_free_bit_heapcodes-malloc \
  build-porting32-gcc-one_free_bit_heapcodes-trivialmap \
  build-porting32-gcc-kernelvoid32_heapcodes \
  build-porting32-gcc-heapcodes-spvw_pages \
  build-porting32-gcc-heapcodes-spvw_mixed_blocks \
  build-porting32-gcc-wide \
  build-porting32-gcc-limited_memory \
  build-porting32-gcc-old_gc \
  build-porting32-gcc-multithread_gc \
  build-porting32-gcc-generational_gc-old_gc \
  build-porting32-gcc-generational_gc-multithread_gc \
  build-porting32-gcc-safety0 \
  build-porting32-gcc-safety0-optimized \
  build-porting32-gcc-debug_gcsafety

# Solaris/x86_64 with 32-bit ABI
# Note: build-porting32-cc-portability and build-porting32-cc-wide are not
# enabled, because Sun cc has problems with WIDE_SOFT.
multibuild-solaris-i386-cc: \
  build-porting32-cc-safety3 \
  build-porting32-cc-heapcodes \
  build-porting32-cc-one_free_bit_heapcodes-malloc \
  build-porting32-cc-one_free_bit_heapcodes-trivialmap \
  build-porting32-cc-kernelvoid32_heapcodes \
  build-porting32-cc-heapcodes-spvw_pages \
  build-porting32-cc-heapcodes-spvw_mixed_blocks \
  build-porting32-cc-spvw_pure_blocks \
  build-porting32-cc-old_gc \
  build-porting32-cc-multithread_gc \
  build-porting32-cc-generational_gc-old_gc \
  build-porting32-cc-generational_gc-multithread_gc \
  build-porting32-cc-safety0 \
  build-porting32-cc-debug_ari_asm
# TODO build-porting32-gcc-debug_gcsafety currently has compilation failures.
multibuild-solaris-i386-gcc: \
  build-porting32-gcc-portability \
  build-porting32-gcc-safety3 \
  build-porting32-gcc-heapcodes \
  build-porting32-gcc-one_free_bit_heapcodes-malloc \
  build-porting32-gcc-one_free_bit_heapcodes-trivialmap \
  build-porting32-gcc-kernelvoid32_heapcodes \
  build-porting32-gcc-heapcodes-spvw_pages \
  build-porting32-gcc-heapcodes-spvw_mixed_blocks \
  build-porting32-gcc-spvw_pure_blocks \
  build-porting32-gcc-wide \
  build-porting32-gcc-limited_memory \
  build-porting32-gcc-old_gc \
  build-porting32-gcc-multithread_gc \
  build-porting32-gcc-generational_gc-old_gc \
  build-porting32-gcc-generational_gc-multithread_gc \
  build-porting32-gcc-safety0 \
  build-porting32-gcc-safety0-optimized \
  build-porting32-gcc-debug_gcsafety \
  build-porting32-gcc-debug_ari_asm

# Solaris/sparc64 with 32-bit ABI
# Note: build-porting32-cc-portability and build-porting32-cc-wide are not
# enabled, because Sun cc has problems with WIDE_SOFT.
multibuild-solaris-sparc-cc: \
  build-porting32-cc-safety3 \
  build-porting32-cc-heapcodes \
  build-porting32-cc-one_free_bit_heapcodes-malloc \
  build-porting32-cc-one_free_bit_heapcodes-trivialmap \
  build-porting32-cc-heapcodes-spvw_pages \
  build-porting32-cc-heapcodes-spvw_mixed_blocks \
  build-porting32-cc-spvw_pure_blocks \
  build-porting32-cc-old_gc \
  build-porting32-cc-multithread_gc \
  build-porting32-cc-generational_gc-old_gc \
  build-porting32-cc-generational_gc-multithread_gc \
  build-porting32-cc-safety0
# TODO build-porting32-gcc-debug_gcsafety currently has compilation failures.
multibuild-solaris-sparc-gcc: \
  build-porting32-gcc-portability \
  build-porting32-gcc-safety3 \
  build-porting32-gcc-heapcodes \
  build-porting32-gcc-one_free_bit_heapcodes-malloc \
  build-porting32-gcc-one_free_bit_heapcodes-trivialmap \
  build-porting32-gcc-kernelvoid32_heapcodes \
  build-porting32-gcc-heapcodes-spvw_pages \
  build-porting32-gcc-heapcodes-spvw_mixed_blocks \
  build-porting32-gcc-spvw_pure_blocks \
  build-porting32-gcc-wide \
  build-porting32-gcc-limited_memory \
  build-porting32-gcc-old_gc \
  build-porting32-gcc-multithread_gc \
  build-porting32-gcc-generational_gc-old_gc \
  build-porting32-gcc-generational_gc-multithread_gc \
  build-porting32-gcc-safety0 \
  build-porting32-gcc-safety0-optimized \
  build-porting32-gcc-debug_gcsafety

# Haiku/i386
multibuild-haiku-32: \
  build-porting32-gcc-portability \
  build-porting32-gcc-safety3 \
  build-porting32-gcc-heapcodes \
  build-porting32-gcc-one_free_bit_heapcodes-malloc \
  build-porting32-gcc-kernelvoid32_heapcodes \
  build-porting32-gcc-heapcodes-spvw_pages \
  build-porting32-gcc-heapcodes-spvw_mixed_blocks \
  build-porting32-gcc-wide \
  build-porting32-gcc-limited_memory \
  build-porting32-gcc-old_gc \
  build-porting32-gcc-multithread_gc \
  build-porting32-gcc-safety0 \
  build-porting32-gcc-safety0-optimized \
  build-porting32-gcc-debug_gcsafety

# Minix/i386
multibuild-minix-i386: \
  build-porting32-gcc-portability \
  build-porting32-gcc-safety3 \
  build-porting32-gcc-heapcodes \
  build-porting32-gcc-one_free_bit_heapcodes-malloc \
  build-porting32-gcc-one_free_bit_heapcodes-trivialmap \
  build-porting32-gcc-kernelvoid32_heapcodes \
  build-porting32-gcc-heapcodes-spvw_pages \
  build-porting32-gcc-heapcodes-spvw_mixed_blocks \
  build-porting32-gcc-typecodes-spvw_mixed_blocks-trivialmap \
  build-porting32-gcc-spvw_pure_blocks \
  build-porting32-gcc-wide \
  build-porting32-gcc-old_gc \
  build-porting32-gcc-multithread_gc \
  build-porting32-gcc-safety0 \
  build-porting32-gcc-safety0-optimized \
  build-porting32-gcc-debug_ari_asm

# Cygwin, running on Windows 10 (64-bit)
multibuild-cygwin-32: multibuild-porting32-gcc # TODO

# mingw, running on Windows 10 (64-bit)
multibuild-mingw-32: multibuild-porting32-gcc # TODO

# 64-bit platforms:

# Linux/x86_64
multibuild-linux-x86_64: \
  build-porting64-gcc-portability \
  build-porting64-gcc-safety3 \
  build-porting64-gcc-heapcodes \
  build-porting64-gcc-one_free_bit_heapcodes-malloc \
  build-porting64-gcc-one_free_bit_heapcodes-trivialmap \
  build-porting64-gcc-generic64_heapcodes \
  build-porting64-gcc-heapcodes-spvw_pages \
  build-porting64-gcc-typecodes-spvw_pure_pages \
  build-porting64-gcc-typecodes-spvw_mixed_pages \
  build-porting64-gcc-heapcodes-spvw_mixed_blocks \
  build-porting64-gcc-typecodes-spvw_mixed_blocks-malloc \
  build-porting64-gcc-typecodes-spvw_mixed_blocks-trivialmap \
  build-porting64-gcc-limited_memory \
  build-porting64-gcc-old_gc \
  build-porting64-gcc-multithread_gc \
  build-porting64-gcc-generational_gc-old_gc \
  build-porting64-gcc-generational_gc-multithread_gc \
  build-porting64-gcc-safety0 \
  build-porting64-gcc-safety0-optimized \
  build-porting64-gcc-debug_gcsafety

# Linux/arm64
multibuild-linux-arm64: \
  build-porting64-gcc-portability \
  build-porting64-gcc-safety3 \
  build-porting64-gcc-heapcodes \
  build-porting64-gcc-one_free_bit_heapcodes-malloc \
  build-porting64-gcc-one_free_bit_heapcodes-trivialmap \
  build-porting64-gcc-generic64_heapcodes \
  build-porting64-gcc-heapcodes-spvw_pages \
  build-porting64-gcc-typecodes-spvw_pure_pages \
  build-porting64-gcc-typecodes-spvw_mixed_pages \
  build-porting64-gcc-heapcodes-spvw_mixed_blocks \
  build-porting64-gcc-typecodes-spvw_mixed_blocks-malloc \
  build-porting64-gcc-typecodes-spvw_mixed_blocks-trivialmap \
  build-porting64-gcc-limited_memory \
  build-porting64-gcc-old_gc \
  build-porting64-gcc-multithread_gc \
  build-porting64-gcc-generational_gc-old_gc \
  build-porting64-gcc-generational_gc-multithread_gc \
  build-porting64-gcc-safety0 \
  build-porting64-gcc-safety0-optimized \
  build-porting64-gcc-debug_gcsafety

# Linux/alpha
multibuild-linux-alpha: \
  build-porting64-gcc-portability \
  build-porting64-gcc-safety3 \
  build-porting64-gcc-heapcodes \
  build-porting64-gcc-one_free_bit_heapcodes-malloc \
  build-porting64-gcc-one_free_bit_heapcodes-trivialmap \
  build-porting64-gcc-generic64_heapcodes \
  build-porting64-gcc-heapcodes-spvw_pages \
  build-porting64-gcc-typecodes-spvw_pure_pages \
  build-porting64-gcc-typecodes-spvw_mixed_pages \
  build-porting64-gcc-heapcodes-spvw_mixed_blocks \
  build-porting64-gcc-typecodes-spvw_mixed_blocks-malloc \
  build-porting64-gcc-typecodes-spvw_mixed_blocks-trivialmap \
  build-porting64-gcc-spvw_pure_blocks \
  build-porting64-gcc-limited_memory \
  build-porting64-gcc-old_gc \
  build-porting64-gcc-multithread_gc \
  build-porting64-gcc-generational_gc-old_gc \
  build-porting64-gcc-generational_gc-multithread_gc \
  build-porting64-gcc-safety0 \
  build-porting64-gcc-safety0-optimized

# Linux/ia64
multibuild-linux-ia64: \
  build-porting64-gcc-portability \
  build-porting64-gcc-safety3 \
  build-porting64-gcc-heapcodes \
  build-porting64-gcc-one_free_bit_heapcodes-malloc \
  build-porting64-gcc-one_free_bit_heapcodes-trivialmap \
  build-porting64-gcc-generic64_heapcodes \
  build-porting64-gcc-heapcodes-spvw_pages \
  build-porting64-gcc-heapcodes-spvw_mixed_blocks \
  build-porting64-gcc-typecodes-spvw_mixed_blocks-trivialmap \
  build-porting64-gcc-spvw_pure_blocks \
  build-porting64-gcc-limited_memory \
  build-porting64-gcc-old_gc \
  build-porting64-gcc-multithread_gc \
  build-porting64-gcc-generational_gc-old_gc \
  build-porting64-gcc-generational_gc-multithread_gc \
  build-porting64-gcc-safety0 \
  build-porting64-gcc-safety0-optimized \
  build-porting64-gcc-debug_gcsafety

# Linux/mips64eb and Linux/mips64el with 64-bit ABI
multibuild-linux-mips-64: \
  build-porting64-gcc-portability \
  build-porting64-gcc-safety3 \
  build-porting64-gcc-heapcodes \
  build-porting64-gcc-one_free_bit_heapcodes-malloc \
  build-porting64-gcc-one_free_bit_heapcodes-trivialmap \
  build-porting64-gcc-generic64_heapcodes \
  build-porting64-gcc-heapcodes-spvw_pages \
  build-porting64-gcc-typecodes-spvw_pure_pages \
  build-porting64-gcc-typecodes-spvw_mixed_pages \
  build-porting64-gcc-heapcodes-spvw_mixed_blocks \
  build-porting64-gcc-typecodes-spvw_mixed_blocks-malloc \
  build-porting64-gcc-typecodes-spvw_mixed_blocks-trivialmap \
  build-porting64-gcc-limited_memory \
  build-porting64-gcc-old_gc \
  build-porting64-gcc-multithread_gc \
  build-porting64-gcc-safety0 \
  build-porting64-gcc-safety0-optimized \
  build-porting64-gcc-debug_gcsafety \
  build-porting64-gcc-debug_ari_asm

# Linux/powerpc64
multibuild-linux-powerpc64: \
  build-porting64-gcc-portability \
  build-porting64-gcc-safety3 \
  build-porting64-gcc-heapcodes \
  build-porting64-gcc-one_free_bit_heapcodes-malloc \
  build-porting64-gcc-one_free_bit_heapcodes-trivialmap \
  build-porting64-gcc-generic64_heapcodes \
  build-porting64-gcc-heapcodes-spvw_pages \
  build-porting64-gcc-typecodes-spvw_pure_pages \
  build-porting64-gcc-typecodes-spvw_mixed_pages \
  build-porting64-gcc-heapcodes-spvw_mixed_blocks \
  build-porting64-gcc-typecodes-spvw_mixed_blocks-malloc \
  build-porting64-gcc-typecodes-spvw_mixed_blocks-trivialmap \
  build-porting64-gcc-spvw_pure_blocks \
  build-porting64-gcc-limited_memory \
  build-porting64-gcc-old_gc \
  build-porting64-gcc-multithread_gc \
  build-porting64-gcc-generational_gc-old_gc \
  build-porting64-gcc-generational_gc-multithread_gc \
  build-porting64-gcc-safety0 \
  build-porting64-gcc-safety0-optimized \
  build-porting64-gcc-debug_gcsafety

# Linux/powerpc64le
multibuild-linux-powerpc64le: \
  build-porting64-gcc-portability \
  build-porting64-gcc-safety3 \
  build-porting64-gcc-heapcodes \
  build-porting64-gcc-one_free_bit_heapcodes-malloc \
  build-porting64-gcc-one_free_bit_heapcodes-trivialmap \
  build-porting64-gcc-generic64_heapcodes \
  build-porting64-gcc-heapcodes-spvw_pages \
  build-porting64-gcc-typecodes-spvw_pure_pages \
  build-porting64-gcc-typecodes-spvw_mixed_pages \
  build-porting64-gcc-heapcodes-spvw_mixed_blocks \
  build-porting64-gcc-typecodes-spvw_mixed_blocks-malloc \
  build-porting64-gcc-typecodes-spvw_mixed_blocks-trivialmap \
  build-porting64-gcc-spvw_pure_blocks \
  build-porting64-gcc-limited_memory \
  build-porting64-gcc-old_gc \
  build-porting64-gcc-multithread_gc \
  build-porting64-gcc-generational_gc-old_gc \
  build-porting64-gcc-generational_gc-multithread_gc \
  build-porting64-gcc-safety0 \
  build-porting64-gcc-safety0-optimized \
  build-porting64-gcc-debug_gcsafety

# Linux/riscv64
multibuild-linux-riscv64: \
  build-porting64-gcc-portability \
  build-porting64-gcc-safety3 \
  build-porting64-gcc-heapcodes \
  build-porting64-gcc-one_free_bit_heapcodes-malloc \
  build-porting64-gcc-one_free_bit_heapcodes-trivialmap \
  build-porting64-gcc-generic64_heapcodes \
  build-porting64-gcc-heapcodes-spvw_pages \
  build-porting64-gcc-typecodes-spvw_pure_pages \
  build-porting64-gcc-typecodes-spvw_mixed_pages \
  build-porting64-gcc-heapcodes-spvw_mixed_blocks \
  build-porting64-gcc-typecodes-spvw_mixed_blocks-malloc \
  build-porting64-gcc-typecodes-spvw_mixed_blocks-trivialmap \
  build-porting64-gcc-spvw_pure_blocks \
  build-porting64-gcc-limited_memory \
  build-porting64-gcc-old_gc \
  build-porting64-gcc-multithread_gc \
  build-porting64-gcc-safety0 \
  build-porting64-gcc-safety0-optimized \
  build-porting64-gcc-debug_gcsafety

# Linux/s390x
multibuild-linux-s390x: \
  build-porting64-gcc-portability \
  build-porting64-gcc-safety3 \
  build-porting64-gcc-heapcodes \
  build-porting64-gcc-generic64_heapcodes \
  build-porting64-gcc-heapcodes-spvw_pages \
  build-porting64-gcc-typecodes-spvw_pure_pages \
  build-porting64-gcc-typecodes-spvw_mixed_pages \
  build-porting64-gcc-heapcodes-spvw_mixed_blocks \
  build-porting64-gcc-typecodes-spvw_mixed_blocks-malloc \
  build-porting64-gcc-typecodes-spvw_mixed_blocks-trivialmap \
  build-porting64-gcc-spvw_pure_blocks \
  build-porting64-gcc-limited_memory \
  build-porting64-gcc-old_gc \
  build-porting64-gcc-multithread_gc \
  build-porting64-gcc-generational_gc-old_gc \
  build-porting64-gcc-generational_gc-multithread_gc \
  build-porting64-gcc-safety0 \
  build-porting64-gcc-safety0-optimized

# Linux/sparc64
multibuild-linux-sparc64: \
  build-porting64-gcc-portability \
  build-porting64-gcc-safety3 \
  build-porting64-gcc-heapcodes \
  build-porting64-gcc-one_free_bit_heapcodes-malloc \
  build-porting64-gcc-one_free_bit_heapcodes-trivialmap \
  build-porting64-gcc-generic64_heapcodes \
  build-porting64-gcc-heapcodes-spvw_pages \
  build-porting64-gcc-heapcodes-spvw_mixed_blocks \
  build-porting64-gcc-spvw_pure_blocks \
  build-porting64-gcc-limited_memory \
  build-porting64-gcc-old_gc \
  build-porting64-gcc-multithread_gc \
  build-porting64-gcc-generational_gc-old_gc \
  build-porting64-gcc-generational_gc-multithread_gc \
  build-porting64-gcc-safety0 \
  build-porting64-gcc-safety0-optimized \
  build-porting64-gcc-debug_gcsafety \
  build-porting64-gcc-debug_ari_asm

# FreeBSD/x86_64
multibuild-freebsd-x86_64: \
  build-porting64-gcc-portability \
  build-porting64-gcc-safety3 \
  build-porting64-gcc-heapcodes \
  build-porting64-gcc-one_free_bit_heapcodes-malloc \
  build-porting64-gcc-one_free_bit_heapcodes-trivialmap \
  build-porting64-gcc-generic64_heapcodes \
  build-porting64-gcc-heapcodes-spvw_pages \
  build-porting64-gcc-typecodes-spvw_pure_pages \
  build-porting64-gcc-typecodes-spvw_mixed_pages \
  build-porting64-gcc-heapcodes-spvw_mixed_blocks \
  build-porting64-gcc-typecodes-spvw_mixed_blocks-malloc \
  build-porting64-gcc-typecodes-spvw_mixed_blocks-trivialmap \
  build-porting64-gcc-spvw_pure_blocks \
  build-porting64-gcc-limited_memory \
  build-porting64-gcc-old_gc \
  build-porting64-gcc-multithread_gc \
  build-porting64-gcc-generational_gc-old_gc \
  build-porting64-gcc-generational_gc-multithread_gc \
  build-porting64-gcc-safety0 \
  build-porting64-gcc-safety0-optimized

# GNU/kFreeBSD/x86_64
multibuild-freebsd-gnu-x86_64: \
  build-porting64-gcc-portability \
  build-porting64-gcc-safety3 \
  build-porting64-gcc-heapcodes \
  build-porting64-gcc-one_free_bit_heapcodes-malloc \
  build-porting64-gcc-one_free_bit_heapcodes-trivialmap \
  build-porting64-gcc-generic64_heapcodes \
  build-porting64-gcc-heapcodes-spvw_pages \
  build-porting64-gcc-typecodes-spvw_pure_pages \
  build-porting64-gcc-typecodes-spvw_mixed_pages \
  build-porting64-gcc-heapcodes-spvw_mixed_blocks \
  build-porting64-gcc-typecodes-spvw_mixed_blocks-malloc \
  build-porting64-gcc-typecodes-spvw_mixed_blocks-trivialmap \
  build-porting64-gcc-spvw_pure_blocks \
  build-porting64-gcc-limited_memory \
  build-porting64-gcc-old_gc \
  build-porting64-gcc-multithread_gc \
  build-porting64-gcc-generational_gc-old_gc \
  build-porting64-gcc-generational_gc-multithread_gc \
  build-porting64-gcc-safety0 \
  build-porting64-gcc-safety0-optimized \
  build-porting64-gcc-debug_gcsafety

# FreeBSD/arm64
multibuild-freebsd-arm64: \
  build-porting64-gcc-portability \
  build-porting64-gcc-safety3 \
  build-porting64-gcc-heapcodes \
  build-porting64-gcc-one_free_bit_heapcodes-malloc \
  build-porting64-gcc-one_free_bit_heapcodes-trivialmap \
  build-porting64-gcc-generic64_heapcodes \
  build-porting64-gcc-heapcodes-spvw_pages \
  build-porting64-gcc-typecodes-spvw_pure_pages \
  build-porting64-gcc-typecodes-spvw_mixed_pages \
  build-porting64-gcc-heapcodes-spvw_mixed_blocks \
  build-porting64-gcc-typecodes-spvw_mixed_blocks-malloc \
  build-porting64-gcc-typecodes-spvw_mixed_blocks-trivialmap \
  build-porting64-gcc-spvw_pure_blocks \
  build-porting64-gcc-limited_memory \
  build-porting64-gcc-old_gc \
  build-porting64-gcc-multithread_gc \
  build-porting64-gcc-generational_gc-old_gc \
  build-porting64-gcc-generational_gc-multithread_gc \
  build-porting64-gcc-safety0 \
  build-porting64-gcc-safety0-optimized \
  build-porting64-gcc-debug_gcsafety

# NetBSD/x86_64
multibuild-netbsd-x86_64: \
  build-porting64-gcc-portability \
  build-porting64-gcc-safety3 \
  build-porting64-gcc-heapcodes \
  build-porting64-gcc-one_free_bit_heapcodes-malloc \
  build-porting64-gcc-one_free_bit_heapcodes-trivialmap \
  build-porting64-gcc-generic64_heapcodes \
  build-porting64-gcc-heapcodes-spvw_pages \
  build-porting64-gcc-typecodes-spvw_pure_pages \
  build-porting64-gcc-typecodes-spvw_mixed_pages \
  build-porting64-gcc-heapcodes-spvw_mixed_blocks \
  build-porting64-gcc-typecodes-spvw_mixed_blocks-malloc \
  build-porting64-gcc-typecodes-spvw_mixed_blocks-trivialmap \
  build-porting64-gcc-spvw_pure_blocks \
  build-porting64-gcc-limited_memory \
  build-porting64-gcc-old_gc \
  build-porting64-gcc-multithread_gc \
  build-porting64-gcc-generational_gc-old_gc \
  build-porting64-gcc-generational_gc-multithread_gc \
  build-porting64-gcc-safety0 \
  build-porting64-gcc-safety0-optimized \
  build-porting64-gcc-debug_gcsafety

# NetBSD/sparc64
multibuild-netbsd-sparc64: multibuild-porting64-gcc # TODO

# OpenBSD/x86_64
# Note: build-porting64-gcc-debug_gcsafety has compilation failures on some
# OpenBSD versions.
multibuild-openbsd-x86_64: \
  build-porting64-gcc-portability \
  build-porting64-gcc-safety3 \
  build-porting64-gcc-heapcodes \
  build-porting64-gcc-one_free_bit_heapcodes-malloc \
  build-porting64-gcc-one_free_bit_heapcodes-trivialmap \
  build-porting64-gcc-generic64_heapcodes \
  build-porting64-gcc-heapcodes-spvw_pages \
  build-porting64-gcc-typecodes-spvw_pure_pages \
  build-porting64-gcc-typecodes-spvw_mixed_pages \
  build-porting64-gcc-heapcodes-spvw_mixed_blocks \
  build-porting64-gcc-typecodes-spvw_mixed_blocks-malloc \
  build-porting64-gcc-typecodes-spvw_mixed_blocks-trivialmap \
  build-porting64-gcc-limited_memory \
  build-porting64-gcc-old_gc \
  build-porting64-gcc-multithread_gc \
  build-porting64-gcc-generational_gc-old_gc \
  build-porting64-gcc-generational_gc-multithread_gc \
  build-porting64-gcc-safety0 \
  build-porting64-gcc-safety0-optimized \
  build-porting64-gcc-debug_gcsafety

# Mac OS X/x86_64
# Note: build-porting64-gcc-debug_gcsafety has compilation failures on some
# Mac OS X versions.
multibuild-macosx-x86_64: \
  build-porting64-gcc-portability \
  build-porting64-gcc-safety3 \
  build-porting64-gcc-heapcodes \
  build-porting64-gcc-one_free_bit_heapcodes-malloc \
  build-porting64-gcc-one_free_bit_heapcodes-trivialmap \
  build-porting64-gcc-generic64_heapcodes \
  build-porting64-gcc-heapcodes-spvw_pages \
  build-porting64-gcc-heapcodes-spvw_mixed_blocks \
  build-porting64-gcc-spvw_pure_blocks \
  build-porting64-gcc-limited_memory \
  build-porting64-gcc-old_gc \
  build-porting64-gcc-multithread_gc \
  build-porting64-gcc-generational_gc-old_gc \
  build-porting64-gcc-generational_gc-multithread_gc \
  build-porting64-gcc-safety0 \
  build-porting64-gcc-safety0-optimized \
  build-porting64-gcc-debug_gcsafety

# macOS 11/arm64
multibuild-macosx-arm64: \
  build-porting64-gcc-portability \
  build-porting64-gcc-safety3 \
  build-porting64-gcc-heapcodes \
  build-porting64-gcc-one_free_bit_heapcodes-malloc \
  build-porting64-gcc-one_free_bit_heapcodes-trivialmap \
  build-porting64-gcc-generic64_heapcodes \
  build-porting64-gcc-heapcodes-spvw_pages \
  build-porting64-gcc-typecodes-spvw_pure_pages \
  build-porting64-gcc-typecodes-spvw_mixed_pages \
  build-porting64-gcc-heapcodes-spvw_mixed_blocks \
  build-porting64-gcc-typecodes-spvw_mixed_blocks-malloc \
  build-porting64-gcc-typecodes-spvw_mixed_blocks-trivialmap \
  build-porting64-gcc-spvw_pure_blocks \
  build-porting64-gcc-limited_memory \
  build-porting64-gcc-old_gc \
  build-porting64-gcc-multithread_gc \
  build-porting64-gcc-generational_gc-old_gc \
  build-porting64-gcc-generational_gc-multithread_gc \
  build-porting64-gcc-safety0 \
  build-porting64-gcc-safety0-optimized \
  build-porting64-gcc-debug_gcsafety

# AIX/POWER with 64-bit ABI
multibuild-aix-powerpc-64-xlc: \
  build-porting64-cc-portability \
  build-porting64-cc-safety3 \
  build-porting64-cc-heapcodes \
  build-porting64-cc-one_free_bit_heapcodes-malloc \
  build-porting64-cc-one_free_bit_heapcodes-trivialmap \
  build-porting64-cc-heapcodes-spvw_pages \
  build-porting64-cc-heapcodes-spvw_mixed_blocks \
  build-porting64-cc-spvw_pure_blocks \
  build-porting64-cc-limited_memory \
  build-porting64-cc-old_gc \
  build-porting64-cc-multithread_gc \
  build-porting64-cc-generational_gc-old_gc \
  build-porting64-cc-generational_gc-multithread_gc \
  build-porting64-cc-safety0
multibuild-aix-powerpc-64-gcc: \
  build-porting64-gcc-portability \
  build-porting64-gcc-safety3 \
  build-porting64-gcc-heapcodes \
  build-porting64-gcc-one_free_bit_heapcodes-malloc \
  build-porting64-gcc-one_free_bit_heapcodes-trivialmap \
  build-porting64-gcc-generic64_heapcodes \
  build-porting64-gcc-heapcodes-spvw_pages \
  build-porting64-gcc-heapcodes-spvw_mixed_blocks \
  build-porting64-gcc-spvw_pure_blocks \
  build-porting64-gcc-limited_memory \
  build-porting64-gcc-old_gc \
  build-porting64-gcc-multithread_gc \
  build-porting64-gcc-generational_gc-old_gc \
  build-porting64-gcc-generational_gc-multithread_gc \
  build-porting64-gcc-safety0 \
  build-porting64-gcc-safety0-optimized \
  build-porting64-gcc-debug_gcsafety

# Solaris/x86_64 with 64-bit ABI
# Note: The builds
#   build-porting64-cc-typecodes-spvw_pure_pages
#   build-porting64-cc-typecodes-spvw_mixed_pages
#   build-porting64-cc-typecodes-spvw_mixed_blocks-malloc
#   build-porting64-cc-typecodes-spvw_mixed_blocks-trivialmap
#   build-porting64-cc-limited_memory
# do not work, because cc miscompiles spvwtabs.o when at least -xO1 is enabled,
# and according to the Sun Studio 12 documentation
# <https://docs.oracle.com/cd/E19205-01/819-5265/bjavm/index.html>:
# "If you specify an optimization level, there is no option for turning
#  optimization off."
multibuild-solaris-x86_64-cc: \
  build-porting64-cc-portability \
  build-porting64-cc-safety3 \
  build-porting64-cc-heapcodes \
  build-porting64-cc-one_free_bit_heapcodes-malloc \
  build-porting64-cc-one_free_bit_heapcodes-trivialmap \
  build-porting64-cc-generic64_heapcodes \
  build-porting64-cc-heapcodes-spvw_pages \
  build-porting64-cc-heapcodes-spvw_mixed_blocks \
  build-porting64-cc-spvw_pure_blocks \
  build-porting64-cc-old_gc \
  build-porting64-cc-multithread_gc \
  build-porting64-cc-generational_gc-old_gc \
  build-porting64-cc-generational_gc-multithread_gc \
  build-porting64-cc-safety0
# TODO build-porting64-gcc-debug_gcsafety currently has compilation failures.
multibuild-solaris-x86_64-gcc: \
  build-porting64-gcc-portability \
  build-porting64-gcc-safety3 \
  build-porting64-gcc-heapcodes \
  build-porting64-gcc-one_free_bit_heapcodes-malloc \
  build-porting64-gcc-one_free_bit_heapcodes-trivialmap \
  build-porting64-gcc-generic64_heapcodes \
  build-porting64-gcc-heapcodes-spvw_pages \
  build-porting64-gcc-typecodes-spvw_pure_pages \
  build-porting64-gcc-typecodes-spvw_mixed_pages \
  build-porting64-gcc-heapcodes-spvw_mixed_blocks \
  build-porting64-gcc-typecodes-spvw_mixed_blocks-malloc \
  build-porting64-gcc-typecodes-spvw_mixed_blocks-trivialmap \
  build-porting64-gcc-spvw_pure_blocks \
  build-porting64-gcc-limited_memory \
  build-porting64-gcc-old_gc \
  build-porting64-gcc-multithread_gc \
  build-porting64-gcc-generational_gc-old_gc \
  build-porting64-gcc-generational_gc-multithread_gc \
  build-porting64-gcc-safety0 \
  build-porting64-gcc-safety0-optimized \
  build-porting64-gcc-debug_gcsafety

# Solaris/sparc64 with 64-bit ABI
multibuild-solaris-sparc64-cc: \
  build-porting64-cc-portability \
  build-porting64-cc-safety3 \
  build-porting64-cc-heapcodes \
  build-porting64-cc-one_free_bit_heapcodes-malloc \
  build-porting64-cc-one_free_bit_heapcodes-trivialmap \
  build-porting64-cc-generic64_heapcodes \
  build-porting64-cc-heapcodes-spvw_pages \
  build-porting64-cc-heapcodes-spvw_mixed_blocks \
  build-porting64-cc-spvw_pure_blocks \
  build-porting64-cc-limited_memory \
  build-porting64-cc-old_gc \
  build-porting64-cc-multithread_gc \
  build-porting64-cc-generational_gc-old_gc \
  build-porting64-cc-generational_gc-multithread_gc \
  build-porting64-cc-safety0
# TODO build-porting64-gcc-debug_gcsafety currently has compilation failures.
multibuild-solaris-sparc64-gcc: \
  build-porting64-gcc-portability \
  build-porting64-gcc-safety3 \
  build-porting64-gcc-heapcodes \
  build-porting64-gcc-one_free_bit_heapcodes-malloc \
  build-porting64-gcc-one_free_bit_heapcodes-trivialmap \
  build-porting64-gcc-generic64_heapcodes \
  build-porting64-gcc-heapcodes-spvw_pages \
  build-porting64-gcc-heapcodes-spvw_mixed_blocks \
  build-porting64-gcc-spvw_pure_blocks \
  build-porting64-gcc-limited_memory \
  build-porting64-gcc-old_gc \
  build-porting64-gcc-multithread_gc \
  build-porting64-gcc-generational_gc-old_gc \
  build-porting64-gcc-generational_gc-multithread_gc \
  build-porting64-gcc-safety0 \
  build-porting64-gcc-safety0-optimized \
  build-porting64-gcc-debug_gcsafety

# Haiku/x86_64
# Notes:
# - build-porting64-gcc-typecodes-spvw_mixed_pages sometimes crashes in cbcstep2 (loadmem_update)
multibuild-haiku-64: \
  build-porting64-gcc-portability \
  build-porting64-gcc-safety3 \
  build-porting64-gcc-heapcodes \
  build-porting64-gcc-one_free_bit_heapcodes-malloc \
  build-porting64-gcc-one_free_bit_heapcodes-trivialmap \
  build-porting64-gcc-generic64_heapcodes \
  build-porting64-gcc-heapcodes-spvw_pages \
  build-porting64-gcc-typecodes-spvw_pure_pages \
  build-porting64-gcc-typecodes-spvw_mixed_pages \
  build-porting64-gcc-heapcodes-spvw_mixed_blocks \
  build-porting64-gcc-typecodes-spvw_mixed_blocks-malloc \
  build-porting64-gcc-typecodes-spvw_mixed_blocks-trivialmap \
  build-porting64-gcc-limited_memory \
  build-porting64-gcc-old_gc \
  build-porting64-gcc-multithread_gc \
  build-porting64-gcc-generational_gc-old_gc \
  build-porting64-gcc-generational_gc-multithread_gc \
  build-porting64-gcc-safety0 \
  build-porting64-gcc-safety0-optimized \
  build-porting64-gcc-debug_gcsafety

# Cygwin, running on Windows 10 (64-bit)
multibuild-cygwin-64: \
  build-porting64-gcc-portability \
  build-porting64-gcc-typecodes-spvw_pure_pages \
  build-porting64-gcc-typecodes-spvw_mixed_pages \
  build-porting64-gcc-typecodes-spvw_mixed_blocks-malloc \
  build-porting64-gcc-safety0 \
  build-porting64-gcc-safety0-optimized \
  build-porting64-gcc-debug_gcsafety

# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# Build and test all essential memory models on a Mac OS X/PowerPC machine.
# Old and long untested.

#multibuild-darwin-powerpc: \
#	build-darwin-powerpc-one_free_bit-spvw_mixed_blocks-staggered	\
#	build-darwin-powerpc-one_free_bit-spvw_mixed_blocks-opposite	\
#	build-darwin-powerpc-one_free_bit-spvw_mixed_blocks-opposite-fixedmemsize \
#	build-darwin-powerpc-one_free_bit-spvw_mixed_pages		\
#	build-darwin-powerpc-kernelvoid32-spvw_mixed_blocks-staggered	\
#	build-darwin-powerpc-kernelvoid32-spvw_mixed_blocks-opposite	\
#	build-darwin-powerpc-kernelvoid32-spvw_mixed_blocks-opposite-fixedmemsize \
#	build-darwin-powerpc-kernelvoid32-spvw_mixed_pages		\
#	build-darwin-powerpc-spvw_pure_blocks			\
#	build-darwin-powerpc-wide
#build-darwin-powerpc-one_free_bit-spvw_mixed_blocks-staggered:
#	$(RMRF) $@
#	CFLAGS="-O $(MULTIBUILD_CFLAGS)" \
#	CPPFLAGS="-DONE_FREE_BIT_HEAPCODES -DCONS_HEAP_GROWS_UP" \
#	  ./configure --cbcx $(MULTIBUILD_OPTIONS) --disable-portability $@
#build-darwin-powerpc-one_free_bit-spvw_mixed_blocks-opposite:
#	$(RMRF) $@
#	CFLAGS="-O $(MULTIBUILD_CFLAGS)" \
#	CPPFLAGS="-DONE_FREE_BIT_HEAPCODES -DCONS_HEAP_GROWS_DOWN" \
#	  ./configure --cbcx $(MULTIBUILD_OPTIONS) --disable-portability $@
#build-darwin-powerpc-one_free_bit-spvw_mixed_blocks-opposite-fixedmemsize:
#	$(RMRF) $@
#	CFLAGS="-O $(MULTIBUILD_CFLAGS)" \
#	CPPFLAGS="-DONE_FREE_BIT_HEAPCODES -DNO_VIRTUAL_MEMORY -DNO_TRIVIALMAP" \
#	  ./configure --cbcx $(MULTIBUILD_OPTIONS) --disable-portability $@
#build-darwin-powerpc-one_free_bit-spvw_mixed_pages:
#	$(RMRF) $@
#	CFLAGS="-O $(MULTIBUILD_CFLAGS)" \
#	CPPFLAGS="-DONE_FREE_BIT_HEAPCODES -DNO_SINGLEMAP -DNO_TRIVIALMAP" \
#	  ./configure --cbcx $(MULTIBUILD_OPTIONS) --disable-portability $@
#build-darwin-powerpc-kernelvoid32-spvw_mixed_blocks-staggered:
#	$(RMRF) $@
#	CFLAGS="-O $(MULTIBUILD_CFLAGS)" \
#	CPPFLAGS="-DKERNELVOID32_HEAPCODES -DCONS_HEAP_GROWS_UP" \
#	  ./configure --cbcx $(MULTIBUILD_OPTIONS) --disable-portability $@
#build-darwin-powerpc-kernelvoid32-spvw_mixed_blocks-opposite:
#	$(RMRF) $@
#	CFLAGS="-O $(MULTIBUILD_CFLAGS)" \
#	CPPFLAGS="-DKERNELVOID32_HEAPCODES -DCONS_HEAP_GROWS_DOWN" \
#	  ./configure --cbcx $(MULTIBUILD_OPTIONS) --disable-portability $@
#build-darwin-powerpc-kernelvoid32-spvw_mixed_blocks-opposite-fixedmemsize:
#	$(RMRF) $@
#	CFLAGS="-O $(MULTIBUILD_CFLAGS)" \
#	CPPFLAGS="-DKERNELVOID32_HEAPCODES -DNO_VIRTUAL_MEMORY -DNO_TRIVIALMAP" \
#	  ./configure --cbcx $(MULTIBUILD_OPTIONS) --disable-portability $@
#build-darwin-powerpc-kernelvoid32-spvw_mixed_pages:
#	$(RMRF) $@
#	CFLAGS="-O $(MULTIBUILD_CFLAGS)" \
#	CPPFLAGS="-DKERNELVOID32_HEAPCODES -DNO_SINGLEMAP -DNO_TRIVIALMAP" \
#	  ./configure --cbcx $(MULTIBUILD_OPTIONS) --disable-portability $@
#build-darwin-powerpc-spvw_pure_blocks:
#	$(RMRF) $@
#	CFLAGS="-O $(MULTIBUILD_CFLAGS)" \
#	CPPFLAGS="-DTYPECODES" \
#	  ./configure --cbcx $(MULTIBUILD_OPTIONS) --disable-portability $@
#build-darwin-powerpc-wide:
#	$(RMRF) $@
#	CFLAGS="-O $(MULTIBUILD_CFLAGS)" \
#	CPPFLAGS="-DWIDE" \
#	  ./configure --cbcx $(MULTIBUILD_OPTIONS) --disable-portability $@

# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

# ------------------------------------------------------------------------------

# Bootstrap SBCL.
SBCL_VERSION = 0.8.15
SBCL_SOURCE_FILE = sbcl-$(SBCL_VERSION)-source.tar.bz2
SBCL_SOURCE_URL = http://www.haible.de/bruno/$(SBCL_SOURCE_FILE)
check-sbcl:
	./configure --cbc build-for-sbcl
	test -f $(SBCL_SOURCE_FILE) || $(WGET) $(SBCL_SOURCE_URL)
	$(RMRF) sbcl-$(SBCL_VERSION)
	bunzip2 -c < $(SBCL_SOURCE_FILE) | tar xvf -
	clisp=$(CURDIR)/build-for-sbcl/clisp; \
	cd sbcl-$(SBCL_VERSION) && sh make.sh $$clisp

# ------------------------------------------------------------------------------


# ==============================================================================
# Targets for miscelleanous tasks for developers.

# ------------------------------------------------------------------------------
# Check syntactic well-formed-ness of XML (DocBook) format documentation files.
# Run after every change of doc/*.xml.

check-doc :
	cd doc && make check

# ------------------------------------------------------------------------------
# Download prerequisites of 'htmldoc' target.

# This must not be in "all" because this downloads 23MB XSL + 500kB DTD.
update-docbook-utils :
	make -C doc docbook-xsl docbook-dtd

# ------------------------------------------------------------------------------
# Create files that help navigating in the source code using Emacs.

SRCDIRS=src utils benchmarks emacs modules sacla-tests tests
TAGS : force
	$(CTAGS) -e -R --langmap=c:.c.d.f $(SRCDIRS)

tags : force
	$(CTAGS) -R --langmap=c:.c.d.f $(SRCDIRS)

# ------------------------------------------------------------------------------

# Build a GCC from source.
# Note that this requires ca. 1 GB of disk space.
GCC_VERSION = 3.4.3
GCC_SOURCE_FILE = gcc-$(GCC_VERSION).tar.bz2
GCC_SOURCE_URL = http://ftp.gnu.org/gnu/gcc/gcc-$(GCC_VERSION)/$(GCC_SOURCE_FILE)
# Put here the --prefix that you would like to use for installing gcc.
# It should *not* be the same --prefix as you use for other programs.
GCC_INSTALL_DIR = $(shell dirname $$(dirname $$(which clisp | head -1)))/inst-gcc-$(GCC_VERSION)

install-gcc:
	test -f $(GCC_SOURCE_FILE) || $(WGET) $(GCC_SOURCE_URL)
	$(RMRF) gcc-$(GCC_VERSION) gcc-$(GCC_VERSION)-build
	bunzip2 -c < $(GCC_SOURCE_FILE) | tar xvf -
	mkdir gcc-$(GCC_VERSION)-build
	gcc_install_dir='$(GCC_INSTALL_DIR)' ; \
	cd gcc-$(GCC_VERSION)-build && ../gcc-$(GCC_VERSION)/configure --prefix="$$gcc_install_dir" --enable-shared --enable-threads `if grep __GLIBC__ /usr/include/features.h > /dev/null 2>/dev/null; then echo --enable-__cxa_atexit; fi` --enable-version-specific-runtime-libs --enable-languages=c,c++ --enable-nls
	cd gcc-$(GCC_VERSION)-build && make bootstrap
	cd gcc-$(GCC_VERSION)-build && make install
	$(RMRF) gcc-$(GCC_VERSION)-build
	$(RMRF) gcc-$(GCC_VERSION)

# ------------------------------------------------------------------------------


# ==============================================================================
# Targets to produce prereleases and releases.

VER=$(shell . ./version.sh ; echo $$VERSION_NUMBER)
REL=$(shell . ./version.sh ; echo $$RELEASE_DATE)

SUFFIX=
# The distribution's top directory is called TOPDIR here.
TOPDIR=clisp-$(VER)$(SUFFIX)

ARCHIVE=../archives/$(VER)

SRC_DIST=$(ARCHIVE)/$(TOPDIR).tar.bz2
SRC_DIST1=$(ARCHIVE)/$(TOPDIR).tar.gz
DOC_DIST=$(ARCHIVE)/$(TOPDIR)-impnotes.zip

SSHUP=podval:~/public_html/clisp/

# ------------------------------------------------------------------------------
# Produce a prerelease.

# 2-3 weeks before a release
# manually: check for new versions of
#  libsvm, netica api, postgresql, berkeley-db, dbus, pcre, readline
pre-release : gnulib-imported build-aux-update update-asdf update-gmalloc tp-mail

# ------------------------------------------------------------------------------
# Produce a release.

# start gpg agent before "make release"!
release : distrib upload tag-release

# ------------------------------------------------------------------------------
# Produce the distribution tarballs for a prerelease or release.

## RELEASE TODO:
# Before doing a "make distrib":
# * update version.sh, src/NEWS, doc/history.xml
# * "make -f Makefile.devel all"
# === Note that for clisp to report its version correctly, src/version.h and
# === src/configure must be regenerated after version.sh is updated
# web pages to be updated:
# * www/index.html, www/impnotes.html, www/clisp.html, www/impnotes/
# dates to be updated (1st release each calendar year):
# * banner in src/spvw.d
# * COPYRIGHT
# * clisp-doc-copyright in doc/impent.xml
# * AC_COPYRIGHT in src/configure.in

## CLISP release announcements go to:
# clisp-announce@lists.sourceforge.net
# info-gnu@gnu.org
# news:comp.lang.lisp
# news:comp.os.linux.announce (linux-announce@news.ornl.gov)
# http://freshmeat.net/projects/clisp/
# https://sourceforge.net/p/clisp/news/new
# WIKIs to be updated: http://en.wikipedia.org/wiki/CLISP

distrib : fixperms src-distrib doc-distrib gnu-distrib

# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

T = $(TOPDIR)
SOURCES1 = $T/ANNOUNCE $T/COPYRIGHT $T/GNU-GPL $T/DEPENDENCIES $T/INSTALL $T/INSTALL.windows $T/SUMMARY $T/configure $T/Makefile.in
SOURCES2 = $T/src
SOURCES4 = $T/utils
SOURCES5 = $T/unix $T/win32msvc
SOURCES6 = $T/modules
# for developers only: $T/benchmarks $T/sacla-tests $T/ansi-tests
SOURCES7 = $T/tests $T/emacs $T/doc $T/Makefile.devel $T/version.sh

SOURCES = $(SOURCES1) $(SOURCES2) $(SOURCES4) $(SOURCES5) $(SOURCES6) $(SOURCES7)

# Assume tar/bzip2/gzip are present
# set this if you are using GNU tar
EXCLUDE=--exclude .git --exclude \*.fas --exclude \*.lib --exclude \*.obj  \
        --exclude \*.exe --exclude \*.mem --exclude \*.o --exclude build   \
        --exclude .hgignore --exclude \*~ --exclude .\#\*                  \
        --exclude $(AUTOCONF_CACHE) --exclude tmp --exclude queued         \
        --exclude libtool-\*.tar.gz --exclude TAGS --exclude tags          \
        `grep '^doc/' .hgignore | sed "s,^doc/,--exclude ,"`               \
         --exclude \*.elc --exclude \*.orig --exclude \*.rej

src-distrib : force
	mkdir -p $(ARCHIVE)
	ln -s . $(TOPDIR)
	tar cvfhj $(SRC_DIST) $(EXCLUDE) $(SOURCES)
	$(RM) $(TOPDIR)
	echo $(SRC_DIST)

# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

$(SRC_DIST1) : $(SRC_DIST)
	bzcat -v $(SRC_DIST) | gzip -9 -v > $(SRC_DIST1)

# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

doc-distrib : force
	mkdir -p $(ARCHIVE)
	ln -s . $(TOPDIR)
	zip -9vor $(DOC_DIST) $(TOPDIR)/doc/html -x \*.cvsignore -x \*.symlinks -x \*CVS\* -x .\#\* -x \*~
	$(RM) $(TOPDIR)

# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

# http://www.gnu.org/prep/maintain/html_node/Automated-Upload-Procedure.html
GPG=gpg --use-agent --yes

GNU_TOP=$(ARCHIVE)/NEWS $(ARCHIVE)/SUMMARY
GNU_SRC=$(SRC_DIST1) $(SRC_DIST)
GNU_DIST=$(GNU_TOP) $(GNU_SRC)
GNU_SYM=$(ARCHIVE)/$(TOPDIR).symlink.directive

gnu-distrib : $(SRC_DIST1) force
	mkdir -p $(ARCHIVE)
	$(CP) src/NEWS SUMMARY $(ARCHIVE)
	for f in $(GNU_DIST); do $(GPG) -b $$f; done
	for f in $(GNU_TOP); do \
		$(RM) $$f.directive; \
		echo "version: 1.1" >> $$f.directive; \
		echo "directory: clisp" >> $$f.directive; \
		echo "filename: "`basename $$f` >> $$f.directive; \
		$(GPG) --clearsign $$f.directive; \
	done
	for f in $(GNU_SRC); do \
		$(RM) $$f.directive; \
		echo "version: 1.1" >> $$f.directive; \
		echo "directory: clisp/release/$(VER)" >> $$f.directive; \
		echo "filename: "`basename $$f` >> $$f.directive; \
		$(GPG) --clearsign $$f.directive; \
	done
	echo "version: 1.1" > $(GNU_SYM)
	echo "directory: clisp/release" >> $(GNU_SYM)
	echo "rmsymlink: latest" >> $(GNU_SYM)
	echo "symlink: $(VER) latest" >> $(GNU_SYM)
	$(GPG) --clearsign $(GNU_SYM)

# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

# ------------------------------------------------------------------------------
# Internationalization: Send a mail to the Translation Project.

TP_EMAIL=coordinator@translationproject.org
MESSAGE_FILE=tp_message
TP_SUFFIX=-pre1

tp-mail : force
	echo "Domain: clisp" > $(MESSAGE_FILE)
	if test -n "$(TP_SUFFIX)"; then \
	  f=`make -f Makefile.devel src-distrib SUFFIX=$(TP_SUFFIX) | tail -n 2 | head -n 1`; \
	  for h in $(SSHUP) ; do scp $$f $${h}; done \
	else f=$(SRC_DIST); fi; f=`basename $$f`; \
	echo "Location: http://clisp.org/beta/$$f" >> $(MESSAGE_FILE); \
	cat $(MESSAGE_FILE); \
	mail -s "CLISP pre-release $$f is available" \
		-c clisp-devel@lists.sf.net $(TP_EMAIL) < $(MESSAGE_FILE)
	$(RM) $(MESSAGE_FILE)

# ------------------------------------------------------------------------------

UPLOAD=$(SRC_DIST) $(SRC_DIST1) $(DOC_DIST) src/NEWS

upload : upload-ssh upload-sf upload-gnu

# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

upload-ssh : $(SRC_DIST1) force
	for h in $(SSHUP) ; do scp $(UPLOAD) $${h}; done

# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

SF_USER = `whoami`

upload-sf : $(SRC_DIST1) force
	scp $(UPLOAD) $(SF_USER),clisp@frs.sf.net:/home/frs/project/c/cl/clisp/clisp/$(VER)/

# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

upload-gnu : force		# gnu-distrib -- do not re-sign everything
	UP=""; for f in $(GNU_DIST); do \
		UP=$${UP}" $$f $$f.sig $$f.directive.asc"; done; \
	lftp ftp://ftp-upload.gnu.org/incoming/ftp -e "mput $${UP} $(GNU_SYM).asc; quit"

# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

# ------------------------------------------------------------------------------

tag-release : force
	$(GIT) tag clisp_$(subst .,_,$(VER))-$(REL)

# ------------------------------------------------------------------------------

# ==============================================================================


force :
