


## backend-per-platform.pkg
## (C) 1999 Lucent Technologies, Bell Laboratories
## Author: Matthias Blume (blume@kurims.kyoto-u.ac.jp)
# Compiled by:
# src/app/make7/Make7.make6# On-demand loading, caching and invocation
# of platform-specific compilers.
#
#
# In directory
#
# src/lib/core/make-compiler
#
# we define cross/compilers for a number of platforms:
#
# ppc-macos.make6
# ppc-unix.make6
# sparc-unix.make6
# x86-unix.make6
# x86-win32.make6
#
# Rather than have all of these in memory at all times
# in the compile servers, we load them one at a time in
# response to specific requests from
#
# src/app/make7/main/compile-server.pkgpackage backend_per_platform {
stipulate
loaded_platforms = REF string_set::empty; # Remember which target compilers we already have in memory.
herein # string_set is from src/app/make7/util/stringset.pkg # This function is invoked (only) from
# src/app/make7/main/compile-server.pkg #
fun invoke
make # This is the standard 'make' entrypoint into src/app/make7/main/make7-g.pkg platform # 'platform' string is architecture+OS, e.g. "x86-linux"
backend_request # See Backend_Request comments in src/app/make7/make-compiler/backend-index.pkg =
{ platform_specific_backend_makefile
=
cat ["$ROOT/src/lib/core/make-compiler/", platform, ".make6"]; # eg. x86-unix -> $ROOT/src/lib/core/make-compiler/x86-unix.make6
if (not (string_set::member (*loaded_platforms, platform_specific_backend_makefile)))
if (make platform_specific_backend_makefile)
loaded_platforms
:=
string_set::add (*loaded_platforms, platform_specific_backend_makefile);
else
raise exception FAIL (cat ["dynamic linkage of ", platform, " platform-specific backend '", platform_specific_backend_makefile, "' failed"]);
fi;
fi;
# The desired platform-specific backend is now
# in memory, and as part of the process of loading it,
#
# src/app/make7/make-compiler/make-compiler-g.pkg #
# will have registered a compile function for it,
# which we now invoke:
#
backend_index::invoke # backend_index is from src/app/make7/make-compiler/backend-index.pkg platform # 'platform' string is architecture+OS, e.g. "x86-linux"
backend_request; # See Backend_Request comments in src/app/make7/make-compiler/backend-index.pkg };
end;
};


