diff --git a/build-aux/build-cc.sh b/build-aux/build-cc.sh index 2cf6e292..97f16c0d 100755 --- a/build-aux/build-cc.sh +++ b/build-aux/build-cc.sh @@ -25,15 +25,16 @@ if [ -n "$BUILD_DEBUG" ]; then fi export CC CFLAGS CPPFLAGS +export CC_CFLAGS CC_CPPFLAGS CC=${CC-gcc} -CFLAGS=${CFLAGS-" +CC_CFLAGS=${CC_CFLAGS-" --std=gnu99 -O0 -g "} -CPPFLAGS=${CPPFLAGS-" +CC_CPPFLAGS=${CC_CPPFLAGS-" -D VERSION=\"$VERSION\" -D MODULEDIR=\"$moduledir\" -D PREFIX=\"$prefix\" diff --git a/build-aux/build-cc32.sh b/build-aux/build-cc32.sh index 24eedfa0..6ad2a73f 100755 --- a/build-aux/build-cc32.sh +++ b/build-aux/build-cc32.sh @@ -25,7 +25,8 @@ if [ -n "$BUILD_DEBUG" ]; then fi moduledir=${moduledir-${datadir}${datadir:+/}module} -export CC32 TCC CPPFLAGS C32FLAGS +export CC32 TCC CPPFLAGS +export CC32 TCC CC32_CPPFLAGS CC32_CFLAGS CC32=${CC32-$(command -v i686-unknown-linux-gnu-gcc)} build-aux/mes-snarf.scm --mes src/gc.c @@ -44,7 +45,7 @@ build-aux/mes-snarf.scm src/posix.c build-aux/mes-snarf.scm src/reader.c build-aux/mes-snarf.scm src/vector.c -CPPFLAGS=${CPPFLAGS-" +CC32_CPPFLAGS=${CC32_CPPFLAGS-" -D VERSION=\"$VERSION\" -D MODULEDIR=\"$moduledir\" -D PREFIX=\"$prefix\" @@ -53,7 +54,7 @@ CPPFLAGS=${CPPFLAGS-" -I include "} -C32FLAGS=${C32FLAGS-" +CC32_CFLAGS=${CC32_CFLAGS-" -std=gnu99 -O0 -fno-stack-protector diff --git a/build-aux/cc-mes.sh b/build-aux/cc-mes.sh index 57e75f6f..3203741f 100755 --- a/build-aux/cc-mes.sh +++ b/build-aux/cc-mes.sh @@ -33,7 +33,7 @@ MESCC=${MESCC-$(command -v mescc)} MES=${MES-$(command -v mes)} [ -z "$MES" ] && MES=src/mes -CPPFLAGS=${CPPFLAGS-" +MES_CPPFLAGS=${MES_CPPFLAGS-" -D VERSION=\"$VERSION\" -D MODULEDIR=\"$moduledir\" -D PREFIX=\"$prefix\" @@ -41,11 +41,11 @@ CPPFLAGS=${CPPFLAGS-" -I lib -I include "} -MESCCFLAGS=${MESCCFLAGS-" +MES_CCFLAGS=${MES_CCFLAGS-" "} if [ -n "$BUILD_DEBUG" ]; then - MESCCFLAGS="$MESCCFLAGS -v" + MES_CFLAGS="$MES_CFLAGS -v" fi c=$1 @@ -63,20 +63,20 @@ else fi if [ -n "$PREPROCESS" ]; then - bash $MESCC $MESCCFLAGS $CPPFLAGS -E -o "$o.E" "$c".c - bash $MESCC $MESCCFLAGS -S "$o".E - bash $MESCC $MESCCFLAGS -c -o "$o".${p}o "$o".S + bash $MESCC $MES_CPPFLAGS $MES_CFLAGS -E -o "$o.E" "$c".c + bash $MESCC $MES_CFLAGS -S "$o".E + bash $MESCC $MES_CFLAGS -c -o "$o".${p}o "$o".S if [ -z "$NOLINK" ]; then - bash $MESCC $MESCCFLAGS -o "$o".${p}out "$o".${p}o $MESCCLIBS + bash $MESCC $MES_CFLAGS -o "$o".${p}out "$o".${p}o $MES_LIBS fi elif [ -n "$COMPILE" ]; then - bash $MESCC $MESCCFLAGS $CPPFLAGS -S -o "$o.S" "$c".c - bash $MESCC $MESCCFLAGS -c -o "$o".${p}o "$o".S + bash $MESCC $MES_CPPFLAGS $MES_CFLAGS -S -o "$o.S" "$c".c + bash $MESCC $MES_CFLAGS -c -o "$o".${p}o "$o".S if [ -z "$NOLINK" ]; then - bash $MESCC $MESCCFLAGS -o "$o".${p}out "$o".${p}o $MESCCLIBS + bash $MESCC $MES_CFLAGS -o "$o".${p}out "$o".${p}o $MES_LIBS fi elif [ -z "$NOLINK" ]; then - bash $MESCC $MESCCFLAGS $CPPFLAGS -o "$o".${p}out "$c".c $MESCCLIBS + bash $MESCC $MES_CPPFLAGS $MES_CFLAGS -o "$o".${p}out "$c".c $MES_LIBS else - bash $MESCC $MESCCFLAGS $CPPFLAGS -c -o "$o".${p}o "$c".c + bash $MESCC $MES_CPPFLAGS $MES_CFLAGS -c -o "$o".${p}o "$c".c fi diff --git a/build-aux/cc.sh b/build-aux/cc.sh index 3d7a2855..d0d4eedf 100755 --- a/build-aux/cc.sh +++ b/build-aux/cc.sh @@ -24,7 +24,7 @@ if [ -n "$BUILD_DEBUG" ]; then set -x fi -CPPFLAGS=${CPPFLAGS-" +CC_CPPFLAGS=${CC_CPPFLAGS-" -D VERSION=\"$VERSION\" -D MODULEDIR=\"$moduledir\" -D PREFIX=\"$prefix\" @@ -33,7 +33,7 @@ CPPFLAGS=${CPPFLAGS-" -I include "} -CFLAGS=${CFLAGS-" +CC_CFLAGS=${CC_CFLAGS-" --std=gnu99 -O0 -g @@ -53,7 +53,9 @@ fi $CC\ -c\ + $CC_CPPFLAGS\ $CPPFLAGS\ + $CC_CFLAGS\ $CFLAGS\ -D WITH_GLIBC=1\ -D POSIX=1\ @@ -62,6 +64,9 @@ $CC\ if [ -z "$NOLINK" ]; then $CC\ + $CC_CPPFLAGS\ + $CPPFLAGS\ + $CC_CFLAGS\ $CFLAGS\ -o "$o".${p}out\ "$o".${p}o\ diff --git a/build-aux/cc32-mes.sh b/build-aux/cc32-mes.sh index 159406dc..a6066a13 100755 --- a/build-aux/cc32-mes.sh +++ b/build-aux/cc32-mes.sh @@ -24,7 +24,7 @@ if [ -n "$BUILD_DEBUG" ]; then set -x fi -CPPFLAGS=${CPPFLAGS-" +CC32_CPPFLAGS=${CC32_CPPFLAGS-" -D VERSION=\"$VERSION\" -D MODULEDIR=\"$moduledir\" -D PREFIX=\"$prefix\" @@ -33,7 +33,7 @@ CPPFLAGS=${CPPFLAGS-" -I include "} -C32FLAGS=${C32FLAGS-" +CC32_CFLAGS=${CC32_CFLAGS-" -std=gnu99 -O0 -fno-builtin @@ -70,14 +70,15 @@ fi $CC32\ -c\ - $CPPFLAGS\ - $C32FLAGS\ + $CC32_CPPFLAGS\ + $CC32_CFLAGS\ -o "$o".${p}o\ "$c".c if [ -z "$NOLINK" ]; then $CC32\ - $C32FLAGS\ + $CC32_CPPFLAGS\ + $CC32_CFLAGS\ -o "$o".${p}out\ lib/$arch/crt1.o\ "$o".${p}o\ diff --git a/build-aux/check-mescc.sh b/build-aux/check-mescc.sh index 26403a31..2d594085 100755 --- a/build-aux/check-mescc.sh +++ b/build-aux/check-mescc.sh @@ -26,7 +26,7 @@ export BLOOD_ELF GUILE HEX2 M1 MES MESCC export M1FLAGS HEX2FLAGS PREPROCESS export MES_ARENA MES_PREFIX MES_SEED export BUILD_DEBUG -export LIBC CC32LIBS MESCCLIBS +export LIBC CC32LIBS MES_LIBS MES=${MES-src/mes} MESCC=${MESCC-scripts/mescc} @@ -161,16 +161,16 @@ total=0 for t in $tests; do if [ -z "${t/[012][0-9]-*/}" ]; then LIBC=c-mini - MESCCLIBS="-l c-mini" + MES_LIBS="-l c-mini" elif [ -z "${t/[78][0-9a-z]-*/}" ]; then LIBC=c+tcc - MESCCLIBS="-l c+tcc" + MES_LIBS="-l c+tcc" elif [ -z "${t/9[0-9]-*/}" ]; then LIBC=c+gnu - MESCCLIBS="-l c+gnu" + MES_LIBS="-l c+gnu" else LIBC=c - MESCCLIBS= + MES_LIBS= fi sh build-aux/test.sh "scaffold/tests/$t" &> scaffold/tests/"$t".log r=$? @@ -279,7 +279,7 @@ broken="$broken #49_bracket_evaluation ; float LIBC=c+gnu -MESCCLIBS="-l c+gnu" +MES_LIBS="-l c+gnu" expect=$(echo $broken | wc -w) ARGS="arg1 arg2 arg3 arg4 arg5" diff --git a/build-aux/export.make b/build-aux/export.make index b1c5eaaa..33d9cf0a 100644 --- a/build-aux/export.make +++ b/build-aux/export.make @@ -70,8 +70,12 @@ ifdef CFLAGS export CFLAGS endif -ifdef C32FLAGS -export C32FLAGS +ifdef CPPFLAGS +export CPPFLAGS +endif + +ifdef CC32_CFLAGS +export CC32_CFLAGS endif ifdef HEX2FLAGS @@ -82,8 +86,8 @@ ifdef M1FLAGS export M1FLAGS endif -ifdef MESCCFLAGS -export MESCCFLAGS +ifdef MES_CFLAGS +export MES_CFLAGS endif ifdef MES_SEED diff --git a/build-aux/test.sh b/build-aux/test.sh index 5030f05e..4cfc0989 100755 --- a/build-aux/test.sh +++ b/build-aux/test.sh @@ -22,7 +22,7 @@ if [ -n "$BUILD_DEBUG" ]; then set -x fi -export LIBC MESCCLIBS +export LIBC MES_LIBS GUILE=${GUILE-$MES} DIFF=${DIFF-$(command -v diff)} diff --git a/build.sh b/build.sh index c273d62f..1da79e9c 100755 --- a/build.sh +++ b/build.sh @@ -42,7 +42,7 @@ datadir=${datadir-$prefix/share/mes} moduledir=${moduledir-${datadir}${datadir:+/}module} set -e -CPPFLAGS=${CPPFLAGS-" +CC_CPPFLAGS=${CC_CPPFLAGS-" -D VERSION=\"$VERSION\" -D MODULEDIR=\"$moduledir\" -D PREFIX=\"$prefix\" @@ -50,12 +50,13 @@ CPPFLAGS=${CPPFLAGS-" -I lib -I include "} -CFLAGS=${CFLAGS-" +CC32_CPPFLAGS=${CC_CPPFLAGS-CC32_CPPFLAGS} +CC_CFLAGS=${CC_CFLAGS-" --std=gnu99 -O0 -g "} -C32FLAGS=${C32FLAGS-" +CC32_FLAGS=${CC32_FLAGS-" --std=gnu99 -O0 -fno-stack-protector @@ -64,7 +65,7 @@ C32FLAGS=${C32FLAGS-" -nostdinc -nostdlib "} -MESCCLAGS=${MESCCFLAGS-" +MES_CFLAGS=${MES_CFLAGS-" "} M1FLAGS=${M1FLAGS-" --LittleEndian diff --git a/configure b/configure index 455ad930..2584d723 100755 --- a/configure +++ b/configure @@ -251,9 +251,10 @@ Some influential environment variables: CC C compiler command CFLAGS C compiler flags CC32 x86 C compiler command - C32FLAGS x86 C compiler flags + CC32_CFLAGS x86 C compiler flags GUILE guile command GUILE_TOOLS guile-tools command + MES_CFLAGS MesCC flags MES_SEED location of mes-seed MESCC_TOOLS_SEED location of mescc-tools-seed TCC tcc C compiler command @@ -288,10 +289,10 @@ Some influential environment variables: (HEX2 (or (getenv "HEX2") "hex2")) (M1 (or (getenv "M1") "M1")) (CFLAGS (getenv "CFLAGS")) - (C32FLAGS (getenv "C32FLAGS")) + (CC32_CFLAGS (getenv "CC32_CFLAGS")) (HEX2FLAGS (getenv "HEX2FLAGS")) (M1FLAGS (getenv "M1FLAGS")) - (MESCCFLAGS (getenv "MESCCFLAGS")) + (MES_CFLAGS (getenv "MES_CFLAGS")) (MES_SEED (or (getenv "MES_SEED") "../mes-seed")) (MESCC_TOOLS_SEED (or (getenv "MESCC_TOOLS_SEED") "../mescc-tools-seed")) (TINYCC_SEED (or (getenv "TINYCC_SEED") "../tinycc-seed"))) @@ -372,10 +373,10 @@ Some influential environment variables: (when disable-silent-rules? (stdout "BUILD_DEBUG:=1\n")) (when CFLAGS (stdout "CFLAGS:=~a\n" CFLAGS)) - (when C32FLAGS (stdout "C32FLAGS:=~a\n" C32FLAGS)) + (when CC32_CFLAGS (stdout "CC32_CFLAGS:=~a\n" CC32_CFLAGS)) (when HEX2FLAGS (stdout "HEX2FLAGS:=~a\n" HEX2FLAGS)) (when M1FLAGS (stdout "M1FLAGS:=~a\n" M1FLAGS)) - (when MESCCFLAGS (stdout "MESCCFLAGS:=~a\n" MESCCFLAGS)))) + (when MES_CFLAGS (stdout "MES_CFLAGS:=~a\n" MES_CFLAGS)))) (format (current-output-port) "\nRun: ~a to build mes