Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/tools/toolchain First of two parts to replace toolchain2netb...
details: https://anonhg.NetBSD.org/src/rev/49364ef7b573
branches: trunk
changeset: 522159:49364ef7b573
user: tv <tv%NetBSD.org@localhost>
date: Mon Feb 11 21:24:09 2002 +0000
description:
First of two parts to replace toolchain2netbsd and make it more cross-happy:
Provide a target "bootstrap-libgcc", which will create the files
src/gnu/lib/libgcc/${MACHINE_ARCH}.mk
src/gnu/usr.bin/gcc/arch/${MACHINE_ARCH}/tconfig.h
src/gnu/usr.bin/gcc/arch/${MACHINE_ARCH}/tm.h
...enough to allow libgcc to build so that a bootstrap build to DESTDIR can
take place.
diffstat:
tools/toolchain/Makefile | 6 ++-
tools/toolchain/mknative | 99 ++++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 104 insertions(+), 1 deletions(-)
diffs (121 lines):
diff -r 65683b92cb8c -r 49364ef7b573 tools/toolchain/Makefile
--- a/tools/toolchain/Makefile Mon Feb 11 21:14:58 2002 +0000
+++ b/tools/toolchain/Makefile Mon Feb 11 21:24:09 2002 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.17 2002/01/31 15:25:08 tv Exp $
+# $NetBSD: Makefile,v 1.18 2002/02/11 21:24:09 tv Exp $
.include <bsd.own.mk>
@@ -21,4 +21,8 @@
INSTALL_TARGET+=install-gdb
.endif
+bootstrap-libgcc: .configure_done
+ @echo 'Creating files needed for libgcc by a native bootstrap build.'
+ @MAKE=${MAKE:Q} sh ${.CURDIR}/mknative libgcc ${.CURDIR}/../..
+
.include "${.CURDIR}/../Makefile.gnuhost"
diff -r 65683b92cb8c -r 49364ef7b573 tools/toolchain/mknative
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/tools/toolchain/mknative Mon Feb 11 21:24:09 2002 +0000
@@ -0,0 +1,99 @@
+#!/bin/sh
+# $NetBSD: mknative,v 1.1 2002/02/11 21:24:10 tv Exp $
+#
+# Shell script for generating all the constants needed for a native
+# platform build of src/gnu/dist/toolchain.
+#
+
+bomb () {
+ echo >&1 "ABORT: $*"
+ exit 1
+}
+
+# usage: getsysvar VARNAME
+getsysvar () {
+ $MAKE -f - _x_ <<EOF || bomb "getvars $1 failed"
+.include <bsd.hostprog.mk>
+_x_:
+ @echo \${$1}
+EOF
+}
+
+# usage: getvars MAKEFILE VARNAME [VARNAME...]
+getvars () {
+ _mf="$1"; shift
+ $MAKE -f - _x_ <<EOF || bomb "getvars $_mf $* failed"
+_x_:
+.for var in $*
+ @echo G_\${var}=\${\${var}:Q} | sed 's,$_VPATH,\$\${DIST},g'
+.endfor
+.include "$_TMPDIR/$_mf"
+EOF
+}
+
+# usage: write_c FILENAME
+write_c () {
+ echo '/* This file is automatically generated. DO NOT EDIT! */' >$_TOP/$1.tmp || \
+ bomb "cannot create $1"
+ grep '$''NetBSD' $0 | sed 's,[#$],,g;s,.*,/* Generated from: & */,' >>$_TOP/$1.tmp
+ echo '' >>$_TOP/$1.tmp
+ writefile $1
+}
+
+# usage: write_mk FILENAME
+write_mk () {
+ echo '# This file is automatically generated. DO NOT EDIT!' >$_TOP/$1.tmp || \
+ bomb "cannot create $1"
+ grep '$''NetBSD' $0 | sed 's,[#$],,g;s,.*,# Generated from: &,' >>$_TOP/$1.tmp
+ echo '#' >>$_TOP/$1.tmp
+ writefile $1
+}
+
+writefile () {
+ sed 's,netbsd\(elf\)*1[0-9\.]*\(_\)*[A-Z]*,netbsd\1,' >>$_TOP/$1.tmp
+
+ # Compare new file, sans "generated from" comments and RCS Id, to
+ # old file. If they match, don't change anything.
+ rm -f $_TMPDIR/.1 $_TMPDIR/.2
+ grep -v 'Generated from:' $_TOP/$1 >$_TMPDIR/.1
+ grep -v 'Generated from:' $_TOP/$1.tmp >$_TMPDIR/.2
+
+ # will not overwrite a file that has the same content
+ if cmp $_TMPDIR/.1 $_TMPDIR/.2 >/dev/null 2>&1; then
+ echo >&2 "$1 is unchanged"
+ rm -f $_TOP/$1.tmp
+ else
+ echo >&2 "$1 created"
+ mv -f $_TOP/$1.tmp $_TOP/$1
+ fi
+}
+
+##### gnu/lib/libgcc #####
+
+get_libgcc () {
+ # DPBIT, FPBIT only used on mn10[23]00, we don't need them.
+ getvars gcc/Makefile \
+ CXX_EXTRA_HEADERS CXX_LIB2FUNCS CXX_LIB2SRCS \
+ INCLUDES LIB2ADD LIB2FUNCS LIB2FUNCS_EH \
+ LIBGCC2_CFLAGS MAYBE_USE_COLLECT2 \
+ | write_mk gnu/lib/libgcc/$MACHINE_ARCH.mk
+
+ for f in tconfig tm; do
+ write_c gnu/usr.bin/gcc/arch/$MACHINE_ARCH/$f.h <$_TMPDIR/gcc/$f.h
+ done
+}
+
+##### main #####
+
+_TMPDIR=`pwd`/build
+_VPATH=`grep VPATH ${_TMPDIR}/Makefile | sed 's,^.*= ,,'`
+
+case $1 in
+libgcc) # .mk and .h files for libgcc bootstrap (from host build)
+ _TOP=$2
+ get_libgcc
+ exit 0
+ ;;
+
+*) echo invalid arguments; exit 1;;
+esac
Home |
Main Index |
Thread Index |
Old Index