build: Handle CFLAGS, CPPFLAGS for Debian.
This commit is contained in:
parent
c997abcae8
commit
c5bf550fff
|
@ -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\"
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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\
|
||||
|
|
|
@ -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\
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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)}
|
||||
|
|
9
build.sh
9
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
|
||||
|
|
11
configure
vendored
11
configure
vendored
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue