build: Cater for colliding basename in C sources.
This is a follow-up to commit
f785f8d560
build: Fix --with-bootstrap build.
* build-aux/cc.sh: Retain directory name in object file name.
* build-aux/bootstrap.sh.in: Likewise. Compile crt1.c from local
directory.
* build-aux/build-lib.sh: Likewise.
* build-aux/build.sh.in: Remove globals.o hack.
This commit is contained in:
parent
e428c17cc5
commit
29341f5783
|
@ -1,7 +1,7 @@
|
||||||
#! @SHELL@
|
#! @SHELL@
|
||||||
|
|
||||||
# GNU Mes --- Maxwell Equations of Software
|
# GNU Mes --- Maxwell Equations of Software
|
||||||
# Copyright © 2019,2020 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
|
# Copyright © 2019,2020,2022 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
|
||||||
#
|
#
|
||||||
# This file is part of GNU Mes.
|
# This file is part of GNU Mes.
|
||||||
#
|
#
|
||||||
|
@ -54,16 +54,18 @@ AM_CPPFLAGS="-D HAVE_CONFIG_H=1 -I ${srcdest}include -I ../include -I include"
|
||||||
AM_CFLAGS="-L ${srcdest}lib"
|
AM_CFLAGS="-L ${srcdest}lib"
|
||||||
|
|
||||||
mkdir -p $mes_cpu-mes
|
mkdir -p $mes_cpu-mes
|
||||||
$CC -c $AM_CPPFLAGS $CPPFLAGS $AM_CFLAGS $CFLAGS ${srcdest}lib/$mes_kernel/$mes_cpu-mes-$compiler/crt1.c
|
cp ${srcdest}lib/$mes_kernel/$mes_cpu-mes-$compiler/crt1.c .
|
||||||
|
$CC -c $AM_CPPFLAGS $CPPFLAGS $AM_CFLAGS $CFLAGS crt1.c
|
||||||
cp crt1.o $mes_cpu-mes
|
cp crt1.o $mes_cpu-mes
|
||||||
cp crt1.s $mes_cpu-mes
|
cp crt1.s $mes_cpu-mes
|
||||||
|
|
||||||
objects=
|
objects=
|
||||||
for c in $libc_mini_SOURCES; do
|
for c in $libc_mini_SOURCES; do
|
||||||
o=$(basename $c .c).o
|
b=$(echo $c | sed -re s,^[.]+/,, -e s,/,-,g -e s,[.]c$,,)
|
||||||
|
o=$b.o
|
||||||
if test ! -e $o -o ${srcdest}$c -nt $o; then
|
if test ! -e $o -o ${srcdest}$c -nt $o; then
|
||||||
echo " CC $c"
|
echo " CC $c"
|
||||||
$CC -c $AM_CPPFLAGS $CPPFLAGS $AM_CFLAGS $CFLAGS ${srcdest}$c
|
$CC -c $AM_CPPFLAGS $CPPFLAGS $AM_CFLAGS $CFLAGS -o $o ${srcdest}$c
|
||||||
fi
|
fi
|
||||||
objects="$objects $o"
|
objects="$objects $o"
|
||||||
done
|
done
|
||||||
|
@ -72,10 +74,11 @@ $AR crD $mes_cpu-mes/libc-mini.a $objects
|
||||||
|
|
||||||
objects=
|
objects=
|
||||||
for c in $libmescc_SOURCES; do
|
for c in $libmescc_SOURCES; do
|
||||||
o=$(basename $c .c).o
|
b=$(echo $c | sed -re s,^[.]+/,, -e s,/,-,g -e s,[.]c$,,)
|
||||||
|
o=$b.o
|
||||||
if test ! -e $o -o ${srcdest}$c -nt $o; then
|
if test ! -e $o -o ${srcdest}$c -nt $o; then
|
||||||
echo " CC $c"
|
echo " CC $c"
|
||||||
$CC -c $AM_CPPFLAGS $CPPFLAGS $AM_CFLAGS $CFLAGS ${srcdest}$c
|
$CC -c $AM_CPPFLAGS $CPPFLAGS $AM_CFLAGS $CFLAGS -o $o ${srcdest}$c
|
||||||
fi
|
fi
|
||||||
objects="$objects $o"
|
objects="$objects $o"
|
||||||
done
|
done
|
||||||
|
@ -84,10 +87,11 @@ $AR crD $mes_cpu-mes/libmescc.a $objects
|
||||||
|
|
||||||
objects=
|
objects=
|
||||||
for c in $libc_SOURCES; do
|
for c in $libc_SOURCES; do
|
||||||
o=$(basename $c .c).o
|
b=$(echo $c | sed -re s,^[.]+/,, -e s,/,-,g -e s,[.]c$,,)
|
||||||
|
o=$b.o
|
||||||
if test ! -e $o -o ${srcdest}$c -nt $o; then
|
if test ! -e $o -o ${srcdest}$c -nt $o; then
|
||||||
echo " CC $c"
|
echo " CC $c"
|
||||||
$CC -c $AM_CPPFLAGS $CPPFLAGS $AM_CFLAGS $CFLAGS ${srcdest}$c
|
$CC -c $AM_CPPFLAGS $CPPFLAGS $AM_CFLAGS $CFLAGS -o $o ${srcdest}$c
|
||||||
fi
|
fi
|
||||||
objects="$objects $o"
|
objects="$objects $o"
|
||||||
done
|
done
|
||||||
|
@ -96,10 +100,11 @@ $AR crD $mes_cpu-mes/libc.a $objects
|
||||||
|
|
||||||
objects=
|
objects=
|
||||||
for c in $libc_tcc_SOURCES; do
|
for c in $libc_tcc_SOURCES; do
|
||||||
o=$(basename $c .c).o
|
b=$(echo $c | sed -re s,^[.]+/,, -e s,/,-,g -e s,[.]c$,,)
|
||||||
|
o=$b.o
|
||||||
if test ! -e $o -o ${srcdest}$c -nt $o; then
|
if test ! -e $o -o ${srcdest}$c -nt $o; then
|
||||||
echo " CC $c"
|
echo " CC $c"
|
||||||
$CC -c $AM_CPPFLAGS $CPPFLAGS $AM_CFLAGS $CFLAGS ${srcdest}$c
|
$CC -c $AM_CPPFLAGS $CPPFLAGS $AM_CFLAGS $CFLAGS -o $o ${srcdest}$c
|
||||||
fi
|
fi
|
||||||
objects="$objects $o"
|
objects="$objects $o"
|
||||||
done
|
done
|
||||||
|
@ -113,10 +118,11 @@ AM_CFLAGS="-L ${srcdest}lib"
|
||||||
|
|
||||||
objects=
|
objects=
|
||||||
for c in $mes_SOURCES; do
|
for c in $mes_SOURCES; do
|
||||||
o=$(basename $c .c).o
|
b=$(echo $c | sed -re s,^[.]+/,, -e s,/,-,g -e s,[.]c$,,)
|
||||||
|
o=$b.o
|
||||||
if test ! -e $o -o ${srcdest}$c -nt $o; then
|
if test ! -e $o -o ${srcdest}$c -nt $o; then
|
||||||
echo " CC $c"
|
echo " CC $c"
|
||||||
$CC -c $AM_CPPFLAGS $CPPFLAGS $AM_CFLAGS $CFLAGS ${srcdest}$c
|
$CC -c $AM_CPPFLAGS $CPPFLAGS $AM_CFLAGS $CFLAGS -o $o ${srcdest}$c
|
||||||
fi
|
fi
|
||||||
objects="$objects $o"
|
objects="$objects $o"
|
||||||
done
|
done
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
#! /bin/sh
|
#! /bin/sh
|
||||||
|
|
||||||
# GNU Mes --- Maxwell Equations of Software
|
# GNU Mes --- Maxwell Equations of Software
|
||||||
# Copyright © 2019 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
|
# Copyright © 2019,2022 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
|
||||||
#
|
#
|
||||||
# This file is part of GNU Mes.
|
# This file is part of GNU Mes.
|
||||||
#
|
#
|
||||||
|
@ -26,7 +26,8 @@
|
||||||
trap 'test -f .log && cat .log' EXIT
|
trap 'test -f .log && cat .log' EXIT
|
||||||
|
|
||||||
mkdir -p $mes_cpu-mes
|
mkdir -p $mes_cpu-mes
|
||||||
compile lib/$mes_kernel/$mes_cpu-mes-$compiler/crt1.c
|
cp ${srcdest}lib/$mes_kernel/$mes_cpu-mes-$compiler/crt1.c .
|
||||||
|
compile crt1.c
|
||||||
cp crt1.o $mes_cpu-mes
|
cp crt1.o $mes_cpu-mes
|
||||||
if test -e crt1.s; then
|
if test -e crt1.s; then
|
||||||
cp crt1.s $mes_cpu-mes
|
cp crt1.s $mes_cpu-mes
|
||||||
|
|
|
@ -150,7 +150,6 @@ fi
|
||||||
${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
|
||||||
if $bootstrap; then
|
if $bootstrap; then
|
||||||
rm -f globals.* # FIXME: avoid name clash with globals from lib
|
|
||||||
${SHELL} ${srcdest}build-aux/build-mes.sh
|
${SHELL} ${srcdest}build-aux/build-mes.sh
|
||||||
cp -f bin/mes-mescc ../bin
|
cp -f bin/mes-mescc ../bin
|
||||||
cp -f bin/mes ../bin
|
cp -f bin/mes ../bin
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
# GNU Mes --- Maxwell Equations of Software
|
# GNU Mes --- Maxwell Equations of Software
|
||||||
# Copyright © 2018,2019 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
|
# Copyright © 2018,2019,2022 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
|
||||||
#
|
#
|
||||||
# This file is part of GNU Mes.
|
# This file is part of GNU Mes.
|
||||||
#
|
#
|
||||||
|
@ -18,8 +18,12 @@
|
||||||
|
|
||||||
objects=
|
objects=
|
||||||
compile () {
|
compile () {
|
||||||
|
if test $(dirname $1) = "."; then
|
||||||
|
c=$1
|
||||||
|
else
|
||||||
c=${srcdest}$1
|
c=${srcdest}$1
|
||||||
b=$(basename $c .c)
|
fi
|
||||||
|
b=$(echo $c | sed -re s,^[.]+/,, -e s,/,-,g -e s,[.]c$,,)
|
||||||
o=$b.o
|
o=$b.o
|
||||||
objects="$objects $o"
|
objects="$objects $o"
|
||||||
if test ! -e $o -o $c -nt $o; then
|
if test ! -e $o -o $c -nt $o; then
|
||||||
|
@ -34,7 +38,7 @@ archive () {
|
||||||
sources="$@"
|
sources="$@"
|
||||||
objects=
|
objects=
|
||||||
for c in $sources; do
|
for c in $sources; do
|
||||||
b=$(basename $c .c)
|
b=$(echo $c | sed -re s,^[.]+/,, -e s,/,-,g -e s,[.]c$,,)
|
||||||
o=$b.o
|
o=$b.o
|
||||||
compile $c
|
compile $c
|
||||||
done
|
done
|
||||||
|
|
Loading…
Reference in a new issue