racket/c/Mf-i3nt
Matthew Flatt f78dc5724e add pb (portable bytecode) backend
This commit does four things:

 * Adds "pb.ss" and "pb.c", which implement a portable bytecode
   backend and interpreter that is intended for bootstrapping. A
   single set of pb bootfiles can support bootstrapping on all
   platforms --- as long as the C compiler supports a 64-bit integer
   type. The pb machine supports foreign calls for only a small set of
   recognized prototypes, and it does not support foriegn callables.
   Use `./configure --pb` to build the pb variant.

 * Changes the kernel's casts between `ptr` and `void*` types. In a pb
   build, the `ptr` type can be a 64-bit integer type while `void*` is
   a 32-bit pointer type, so casts must go through an intermediate
   integer type.

 * Adjusts the compiler to accomodate run-time-determined endianness.
   Making the compiler agnostic to word size is not practical, but
   only a few pieces depend on the target machine's endianness, and
   those can generally be deferred to a run-time choice of byte-based
   operations. The one exception is that ftype bit fields are not
   allowed unless accompanied by an explicit endianness declaration.

 * Start reducing duplication among platform-specific makefiles. For
   example, `Mf-ta6osx` chains to `Mf-a6osx` to avoid repeating most
   of it. A lot more can be done here.

original commit: 97533fa9d8b8400b0dc1a890768c7d30c91257e0
2020-07-24 13:13:46 -06:00

63 lines
2.0 KiB
Plaintext

# Mf-i3nt
# Copyright 1984-2017 Cisco Systems, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
m ?= i3nt
Cpu ?= I386
clib=
o = obj
mdobj=windows.$o
mdsrc=windows.c Makefile.$m cs.ico scheme.rc make.bat
mdclean=vs.bat make.bat scheme.res ../bin/$m/*.exp mtscheme.exe* mdscheme.exe*
cross=f
include Mf-base
${Scheme}${cross:f=}: make.bat
cmd.exe /c make.bat
cp ../bin/$m/scheme.exe ../bin/$m/petite.exe
cp ../bin/$m/scheme.pdb ../bin/$m/petite.pdb
make.bat: vs.bat
echo '@echo off' > $@
echo 'set MAKEFLAGS=' >> $@
echo 'vs.bat x86 && nmake /f Makefile.$m /nologo %*' >> $@
chmod +x $@
# -------------------------------------------------------
# For cross-compilation, triggered by setting cross=t o=o
C = ${CC} ${CPPFLAGS} ${warningFlags} ${optFlags} ${CFLAGS} -D__MINGW_USE_VC2005_COMPAT
${Scheme}${cross:t=}: ${Main} ${Kernel} ${KernelLinkDeps}
$C -o ${Scheme} ${Main} ${Kernel} ${mdclib} ${KernelLinkLibs} ${LDFLAGS} -lshell32 -luser32 -lole32 -lrpcrt4 -luuid
.c.$o:
$C -c -D${Cpu} -I${Include} ${zlibInc} ${LZ4Inc} $*.c
${KernelLib}: ${kernelobj}
${AR} ${ARFLAGS} ${KernelLib} ${kernelobj}
${KernelO}: ${kernelobj} ${zlibDep} ${LZ4Dep}
${LD} -r -X -o ${KernelO} ${kernelobj} ${zlibLib} ${LZ4Lib}
../zlib/configure.log:
echo "all:" >> ../zlib/Makefile
echo ' $$(MAKE) -f win32/Makefile.gcc CC="$(CC)" CFLAGS="$(CFLAGS)" AR="$(AR)" RANLIB="$(RANLIB)" RC="$(WINDRES)"' >> ../zlib/Makefile
touch ../zlib/configure.log
../lz4/lib/liblz4.a: ${LZ4Sources}
(cd ../lz4/lib; CC="$(CC)" CFLAGS="$(CFLAGS)" AR="$(AR)" RANLIB="$(RANLIB)" ${MAKE} liblz4.a)