build: Honor user's CFLAGS, CPPFLAGS, LDFLAGS.
* build-aux/build.sh.in (AM_CFLAGS, AM_CPPFLAGS, AM_LDFLAGS): Rename from CFLAGS, CPPFLAGS, LDFLAGS. Export them. * configure: Substitute them. * configure.sh: Likewise. * build-aux/cc.sh (compile, link): Use them. * build-aux/config.make.in (CFLAGS, CPPFLAGS, LDFLAGS): Add substitutable variables. * build-aux/config.sh.in: Likewise. * build-aux/export.make: Export them.
This commit is contained in:
parent
3de6450117
commit
5c16b1ecc1
|
@ -51,40 +51,40 @@ fi
|
||||||
debug=
|
debug=
|
||||||
#debug=-g
|
#debug=-g
|
||||||
|
|
||||||
CFLAGS="
|
AM_CFLAGS="
|
||||||
-static
|
-static
|
||||||
$debug
|
$debug
|
||||||
"
|
"
|
||||||
|
|
||||||
if test $mes_libc = mes; then
|
if test $mes_libc = mes; then
|
||||||
CFLAGS="$CFLAGS
|
AM_CFLAGS="$AM_CFLAGS
|
||||||
-nostdinc
|
-nostdinc
|
||||||
-nostdlib
|
-nostdlib
|
||||||
-fno-builtin
|
-fno-builtin
|
||||||
"
|
"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
CPPFLAGS="
|
AM_CPPFLAGS="
|
||||||
-D HAVE_CONFIG_H=1
|
-D HAVE_CONFIG_H=1
|
||||||
-I ../include
|
-I ../include
|
||||||
-I ${srcdir}/../include
|
-I ${srcdir}/../include
|
||||||
-I ${srcdir}/../include/$mes_kernel/$mes_cpu
|
-I ${srcdir}/../include/$mes_kernel/$mes_cpu
|
||||||
"
|
"
|
||||||
|
|
||||||
LDFLAGS="
|
AM_LDFLAGS="
|
||||||
$debug
|
$debug
|
||||||
-L .
|
-L .
|
||||||
"
|
"
|
||||||
if test $mes_libc = mes; then
|
if test $mes_libc = mes; then
|
||||||
LDFLAGS="$LDFLAGS
|
AM_LDFLAGS="$AM_LDFLAGS
|
||||||
-nostdlib
|
-nostdlib
|
||||||
"
|
"
|
||||||
fi
|
fi
|
||||||
LIBS=-lc
|
LIBS=-lc
|
||||||
|
|
||||||
export CFLAGS
|
export AM_CFLAGS CFLAGS
|
||||||
export CPPFLAGS
|
export AM_CPPFLAGS CPPFLAGS
|
||||||
export LDFLAGS
|
export AM_LDFLAGS LDFLAGS
|
||||||
export LIBS
|
export LIBS
|
||||||
|
|
||||||
(
|
(
|
||||||
|
@ -96,7 +96,7 @@ export LIBS
|
||||||
srcdir=../
|
srcdir=../
|
||||||
fi
|
fi
|
||||||
if test $compiler = gcc; then
|
if test $compiler = gcc; then
|
||||||
CPPFLAGS="
|
AM_CPPFLAGS="
|
||||||
-D HAVE_CONFIG_H=1
|
-D HAVE_CONFIG_H=1
|
||||||
-I include
|
-I include
|
||||||
-I ${srcdest}include
|
-I ${srcdest}include
|
||||||
|
@ -110,12 +110,12 @@ export LIBS
|
||||||
|
|
||||||
(
|
(
|
||||||
if test $compiler = gcc; then
|
if test $compiler = gcc; then
|
||||||
LDFLAGS="$LDFLAGS
|
AM_LDFLAGS="$AM_LDFLAGS
|
||||||
-L gcc-lib
|
-L gcc-lib
|
||||||
"
|
"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
CPPFLAGS="
|
AM_CPPFLAGS="
|
||||||
-D HAVE_CONFIG_H=1
|
-D HAVE_CONFIG_H=1
|
||||||
-I include
|
-I include
|
||||||
-I ${srcdest}include
|
-I ${srcdest}include
|
||||||
|
@ -136,7 +136,7 @@ export LIBS
|
||||||
srcdest=../
|
srcdest=../
|
||||||
srcdir=../
|
srcdir=../
|
||||||
fi
|
fi
|
||||||
CPPFLAGS="
|
AM_CPPFLAGS="
|
||||||
-D HAVE_CONFIG_H=1
|
-D HAVE_CONFIG_H=1
|
||||||
-I include
|
-I include
|
||||||
-I ${srcdest}include
|
-I ${srcdest}include
|
||||||
|
@ -145,6 +145,10 @@ export LIBS
|
||||||
compiler=mescc
|
compiler=mescc
|
||||||
AR="${srcdest}pre-inst-env mesar"
|
AR="${srcdest}pre-inst-env mesar"
|
||||||
CC="${srcdest}pre-inst-env mescc -m $mes_bits"
|
CC="${srcdest}pre-inst-env mescc -m $mes_bits"
|
||||||
|
# No user overrides for MesCC, they are probably intended for GCC
|
||||||
|
CFLAGS=
|
||||||
|
CPPFLAGS=
|
||||||
|
LDFLAGS=
|
||||||
${SHELL} ${srcdest}build-aux/build-lib.sh
|
${SHELL} ${srcdest}build-aux/build-lib.sh
|
||||||
${SHELL} ${srcdest}build-aux/build-source-lib.sh
|
${SHELL} ${srcdest}build-aux/build-source-lib.sh
|
||||||
)
|
)
|
||||||
|
|
|
@ -23,8 +23,8 @@ compile () {
|
||||||
o=$b.o
|
o=$b.o
|
||||||
objects="$objects $o"
|
objects="$objects $o"
|
||||||
if test $c -nt $o; then
|
if test $c -nt $o; then
|
||||||
trace "CC $c" $CC -c $CPPFLAGS $CFLAGS -o $o $c
|
trace "CC $c" $CC -c $AM_CPPFLAGS $CPPFLAGS $AM_CFLAGS $CFLAGS -o $o $c
|
||||||
$CC -c $CPPFLAGS $CFLAGS -o $o $c
|
$CC -c $AM_CPPFLAGS $CPPFLAGS $AM_CFLAGS $CFLAGS -o $o $c
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -51,6 +51,6 @@ link () {
|
||||||
else
|
else
|
||||||
crt1=crt1.o
|
crt1=crt1.o
|
||||||
fi
|
fi
|
||||||
trace "CCLD $out" $CC $CFLAGS $LDFLAGS -o $out $crt1 $objects $LIBS
|
trace "CCLD $out" $CC $AM_CFLAGS $CFLAGS $AM_LDFLAGS $LDFLAGS -o $out $crt1 $objects $LIBS
|
||||||
objects=
|
objects=
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,6 +20,8 @@ AR:=@AR@
|
||||||
BASH:=@BASH@
|
BASH:=@BASH@
|
||||||
BLOOD_ELF:=@BLOOD_ELF@
|
BLOOD_ELF:=@BLOOD_ELF@
|
||||||
CC:=@CC@
|
CC:=@CC@
|
||||||
|
CFLAGS:=@CFLAGS@
|
||||||
|
CPPFLAGS:=@CPPFLAGS@
|
||||||
DIFF:=@DIFF@
|
DIFF:=@DIFF@
|
||||||
DOT:=@DOT@
|
DOT:=@DOT@
|
||||||
GIT:=@GIT@
|
GIT:=@GIT@
|
||||||
|
@ -29,6 +31,7 @@ GUILE_EFFECTIVE_VERSION:=@GUILE_EFFECTIVE_VERSION@
|
||||||
GUIX:=@GUIX@
|
GUIX:=@GUIX@
|
||||||
HELP2MAN:=@HELP2MAN@
|
HELP2MAN:=@HELP2MAN@
|
||||||
HEX2:=@HEX2@
|
HEX2:=@HEX2@
|
||||||
|
LDFLAGS:=@LDFLAGS@
|
||||||
MAKEINFO:=@MAKEINFO@
|
MAKEINFO:=@MAKEINFO@
|
||||||
M1:=@M1@
|
M1:=@M1@
|
||||||
MES_FOR_BUILD:=@MES_FOR_BUILD@
|
MES_FOR_BUILD:=@MES_FOR_BUILD@
|
||||||
|
|
|
@ -21,6 +21,8 @@ AR=${AR-"@AR@"}
|
||||||
BASH="@BASH@"
|
BASH="@BASH@"
|
||||||
BLOOD_ELF="@BLOOD_ELF@"
|
BLOOD_ELF="@BLOOD_ELF@"
|
||||||
CC=${CC-"@CC@"}
|
CC=${CC-"@CC@"}
|
||||||
|
CFLAGS=${CFLAGS-"@CFLAGS@"}
|
||||||
|
CPPFLAGS=${CPPFLAGS-"@CPPFLAGS@"}
|
||||||
DIFF=${DIFF-@DIFF@}
|
DIFF=${DIFF-@DIFF@}
|
||||||
DOT="@DOT@"
|
DOT="@DOT@"
|
||||||
GIT="@GIT@"
|
GIT="@GIT@"
|
||||||
|
@ -30,6 +32,7 @@ GUILE_EFFECTIVE_VERSION="@GUILE_EFFECTIVE_VERSION@"
|
||||||
GUIX="@GUIX@"
|
GUIX="@GUIX@"
|
||||||
HELP2MAN="@HELP2MAN@"
|
HELP2MAN="@HELP2MAN@"
|
||||||
HEX2="@HEX2@"
|
HEX2="@HEX2@"
|
||||||
|
LDFLAGS=${LDFLAGS-"@LDFLAGS@"}
|
||||||
MAKEINFO="@MAKEINFO@"
|
MAKEINFO="@MAKEINFO@"
|
||||||
M1="@M1@"
|
M1="@M1@"
|
||||||
MES_FOR_BUILD="@MES_FOR_BUILD@"
|
MES_FOR_BUILD="@MES_FOR_BUILD@"
|
||||||
|
|
|
@ -131,6 +131,18 @@ ifdef GUILE_LOAD_COMPILED_PATH
|
||||||
export GUILE_LOAD_COMPILED_PATH
|
export GUILE_LOAD_COMPILED_PATH
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
ifdef AM_CFLAGS
|
||||||
|
export AM_CFLAGS
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifdef AM_CPPFLAGS
|
||||||
|
export AM_CPPFLAGS
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifdef AM_LDFLAGS
|
||||||
|
export AM_LDFLAGS
|
||||||
|
endif
|
||||||
|
|
||||||
ifdef CFLAGS
|
ifdef CFLAGS
|
||||||
export CFLAGS
|
export CFLAGS
|
||||||
endif
|
endif
|
||||||
|
@ -139,6 +151,10 @@ ifdef CPPFLAGS
|
||||||
export CPPFLAGS
|
export CPPFLAGS
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
ifdef LDFLAGS
|
||||||
|
export LDFLAGS
|
||||||
|
endif
|
||||||
|
|
||||||
ifdef HEX2FLAGS
|
ifdef HEX2FLAGS
|
||||||
export HEX2FLAGS
|
export HEX2FLAGS
|
||||||
endif
|
endif
|
||||||
|
|
|
@ -59,8 +59,8 @@ else
|
||||||
crt1=crt1.o
|
crt1=crt1.o
|
||||||
fi
|
fi
|
||||||
|
|
||||||
$CC -c $CPPFLAGS $CFLAGS -o "$o".o "$t"
|
$CC -g -c $AM_CPPFLAGS $CPPFLAGS $AM_CFLAGS $CFLAGS -o "$o".o "$t"
|
||||||
$CC $CFLAGS $LDFLAGS -L . -o "$o" $crt1 "$o".o $LIBS
|
$CC -g $AM_CFLAGS $CFLAGS $AM_LDFLAGS $LDFLAGS -L . -o "$o" $crt1 "$o".o $LIBS
|
||||||
|
|
||||||
set +e
|
set +e
|
||||||
timeout 10 "$o" -s --long file0 file1 > "$o".1 2> "$o".2
|
timeout 10 "$o" -s --long file0 file1 > "$o".1 2> "$o".2
|
||||||
|
|
2
configure
vendored
2
configure
vendored
|
@ -612,6 +612,8 @@ See \"Porting GNU Mes\" in the manual, or try --with-courage\n" mes-system)
|
||||||
("@SHELL@" . ,shell)
|
("@SHELL@" . ,shell)
|
||||||
|
|
||||||
("@CFLAGS@" . ,(or (getenv "CFLAGS") ""))
|
("@CFLAGS@" . ,(or (getenv "CFLAGS") ""))
|
||||||
|
("@CPPFLAGS@" . ,(or (getenv "CPPFLAGS") ""))
|
||||||
|
("@LDFLAGS@" . ,(or (getenv "LDFLAGS") ""))
|
||||||
("@HEX2FLAGS@" . ,(or (getenv "HEX2FLAGS") ""))
|
("@HEX2FLAGS@" . ,(or (getenv "HEX2FLAGS") ""))
|
||||||
("@M1FLAGS@" . ,(or (getenv "M1FLAGS") ""))
|
("@M1FLAGS@" . ,(or (getenv "M1FLAGS") ""))
|
||||||
|
|
||||||
|
|
|
@ -58,6 +58,8 @@ AR=${AR-$(command -v ar)} || true
|
||||||
BASH=${BASH-$(command -v bash)}
|
BASH=${BASH-$(command -v bash)}
|
||||||
BLOOD_ELF=${BLOOD_ELF-$(command -v blood-elf)}
|
BLOOD_ELF=${BLOOD_ELF-$(command -v blood-elf)}
|
||||||
CC=${CC-$(command -v gcc)} || true
|
CC=${CC-$(command -v gcc)} || true
|
||||||
|
CFLAGS=${CFLAGS-}
|
||||||
|
CPPFLAGS=${CPPFLAGS-}
|
||||||
DIFF=${DIFF-$(command -v diff || echo $PWD/pre-inst-env diff.scm)}
|
DIFF=${DIFF-$(command -v diff || echo $PWD/pre-inst-env diff.scm)}
|
||||||
GUILD=${GUILD-$(command -v guild)} || true
|
GUILD=${GUILD-$(command -v guild)} || true
|
||||||
GUILE_TOOLS=${GUILE_TOOLS-$(command -v guile-tools)} || true
|
GUILE_TOOLS=${GUILE_TOOLS-$(command -v guile-tools)} || true
|
||||||
|
@ -70,6 +72,7 @@ if test ! "$GUILD"; then
|
||||||
fi
|
fi
|
||||||
GUILE=${GUILE-$(command -v guile)} || true
|
GUILE=${GUILE-$(command -v guile)} || true
|
||||||
HEX2=${HEX2-$(command -v hex2)}
|
HEX2=${HEX2-$(command -v hex2)}
|
||||||
|
LDPFLAGS=${LDFLAGS-}
|
||||||
M1=${M1-$(command -v M1)}
|
M1=${M1-$(command -v M1)}
|
||||||
MES_FOR_BUILD=${MES_FOR_BUILD-$(command -v mes || command -v guile || echo mes)}
|
MES_FOR_BUILD=${MES_FOR_BUILD-$(command -v mes || command -v guile || echo mes)}
|
||||||
GIT=${GIT-$(command -v git)} || true
|
GIT=${GIT-$(command -v git)} || true
|
||||||
|
|
Loading…
Reference in a new issue