2003-07-25 20:26:51 +04:00
|
|
|
#!/bin/sh
|
2004-02-10 12:37:58 +03:00
|
|
|
# $NetBSD: mknative-gcc,v 1.12 2004/02/10 09:37:58 skrll Exp $
|
2003-07-25 20:26:51 +04:00
|
|
|
#
|
|
|
|
# Shell script for generating all the constants needed for a native
|
2003-11-27 13:21:24 +03:00
|
|
|
# platform build of src/gnu/dist/gcc.
|
2003-07-25 20:26:51 +04:00
|
|
|
#
|
|
|
|
|
2003-11-27 04:05:45 +03:00
|
|
|
# initialise
|
2003-07-25 20:26:51 +04:00
|
|
|
|
2003-11-27 04:05:45 +03:00
|
|
|
_TMPDIR=$2
|
|
|
|
_TOP=$3
|
|
|
|
_PLATFORM=$4
|
|
|
|
_VPATH=`grep VPATH ${_TMPDIR}/Makefile | sed 's,^.*= ,,'`
|
|
|
|
_GNU_DIST=`cd ${_VPATH}; pwd`
|
2003-07-25 20:26:51 +04:00
|
|
|
|
2003-11-27 04:05:45 +03:00
|
|
|
. $_TOP/tools/gcc/mknative.common
|
2003-07-25 20:26:51 +04:00
|
|
|
|
|
|
|
##### gnu/lib/libg2c #####
|
|
|
|
|
|
|
|
get_libg2c () {
|
|
|
|
mkdir -p $_TOP/gnu/lib/libg2c3/arch/$MACHINE_ARCH
|
|
|
|
|
|
|
|
write_c gnu/lib/libg2c3/arch/$MACHINE_ARCH/config.h <$_TMPDIR/$_PLATFORM/libf2c/libU77/config.h
|
|
|
|
write_c gnu/lib/libg2c3/arch/$MACHINE_ARCH/g2c.h <$_TMPDIR/$_PLATFORM/libf2c/g2c.h
|
|
|
|
|
|
|
|
{
|
|
|
|
getvars $_PLATFORM/libf2c/Makefile \
|
|
|
|
F2CEXT
|
|
|
|
getvars $_PLATFORM/libf2c/libF77/Makefile \
|
|
|
|
ALL_CFLAGS OBJS
|
|
|
|
getvars $_PLATFORM/libf2c/libI77/Makefile \
|
|
|
|
ALL_CFLAGS OBJS | sed 's,=,+=,'
|
|
|
|
getvars $_PLATFORM/libf2c/libU77/Makefile \
|
|
|
|
ALL_CFLAGS OBJS | sed 's,=,+=,'
|
|
|
|
} | write_mk gnu/lib/libg2c3/arch/$MACHINE_ARCH/defs.mk
|
|
|
|
}
|
|
|
|
|
|
|
|
##### gnu/lib/libgcc #####
|
|
|
|
|
|
|
|
get_libgcc () {
|
2004-01-02 14:58:32 +03:00
|
|
|
mkdir -p $_TOP/gnu/lib/libgcc3/arch
|
2003-07-25 20:26:51 +04:00
|
|
|
|
|
|
|
# DPBIT, FPBIT only used on mn10[23]00, we don't need them.
|
2003-07-30 09:06:28 +04:00
|
|
|
# XXX we should probably grab everything Just In Case for
|
|
|
|
# the future.
|
2003-07-25 20:26:51 +04:00
|
|
|
getvars gcc/Makefile \
|
|
|
|
INCLUDES LIB2ADD LIB2ADDEH LIB2FUNCS_1 LIB2FUNCS_2 \
|
2004-02-10 12:37:58 +03:00
|
|
|
LIB1ASMFUNCS LIB1ASMSRC \
|
2003-07-25 20:26:51 +04:00
|
|
|
LIB2_DIVMOD_FUNCS LIB2FUNCS_ST \
|
2004-02-10 12:37:58 +03:00
|
|
|
LIBGCC2_CFLAGS USE_COLLECT2 \
|
|
|
|
EXTRA_HEADERS \
|
2003-07-25 20:26:51 +04:00
|
|
|
tm_defines xm_file xm_defines \
|
2004-01-02 14:58:32 +03:00
|
|
|
| write_mk gnu/lib/libgcc3/arch/$MACHINE_ARCH.mk
|
2003-07-25 20:26:51 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
##### gnu/usr.bin/gcc3/libiberty #####
|
|
|
|
|
|
|
|
get_gcc3_libiberty () {
|
2003-07-30 09:06:28 +04:00
|
|
|
mkdir -p $_TOP/gnu/usr.bin/gcc3/libiberty/arch/$MACHINE_ARCH
|
2003-07-25 20:26:51 +04:00
|
|
|
|
|
|
|
getvars libiberty/Makefile \
|
|
|
|
ALLOCA EXTRA_OFILES LIBOBJS REQUIRED_OFILES \
|
|
|
|
| write_mk gnu/usr.bin/gcc3/libiberty/defs.mk
|
|
|
|
|
2003-07-30 09:10:06 +04:00
|
|
|
write_c gnu/usr.bin/gcc3/libiberty/arch/$MACHINE_ARCH/config.h \
|
2003-07-25 20:26:51 +04:00
|
|
|
<$_TMPDIR/libiberty/config.h
|
|
|
|
}
|
|
|
|
|
|
|
|
##### gnu/lib/libobjc #####
|
|
|
|
|
|
|
|
get_libobjc () {
|
|
|
|
mkdir -p $_TOP/gnu/lib/libobjc3
|
|
|
|
|
|
|
|
getvars $_PLATFORM/libobjc/Makefile \
|
|
|
|
ALL_CFLAGS INCLUDES OBJS OBJC_H \
|
2003-07-28 06:35:43 +04:00
|
|
|
| sed "s,$_GNU_DIST,\${GNUHOSTDIST},g" \
|
2003-07-25 20:26:51 +04:00
|
|
|
| write_mk gnu/lib/libobjc3/defs.mk
|
|
|
|
}
|
|
|
|
|
|
|
|
##### gnu/lib/libstdc++-v3 #####
|
|
|
|
|
|
|
|
get_libstdcxx_v3 () {
|
|
|
|
mkdir -p $_TOP/gnu/lib/libstdc++-v3/arch/$MACHINE_ARCH
|
|
|
|
|
|
|
|
# build files
|
|
|
|
for h in gthr.h gthr-single.h gthr-posix.h gthr-default.h c++config.h; do
|
|
|
|
write_c gnu/lib/libstdc++-v3/arch/$MACHINE_ARCH/$h \
|
|
|
|
<$_TMPDIR/$_PLATFORM/libstdc++-v3/include/$_PLATFORM/bits/$h
|
|
|
|
done
|
|
|
|
|
2003-08-01 06:44:55 +04:00
|
|
|
write_c gnu/lib/libstdc++-v3/arch/$MACHINE_ARCH/config.h \
|
|
|
|
<$_TMPDIR/$_PLATFORM/libstdc++-v3/config.h
|
|
|
|
|
2003-07-25 20:26:51 +04:00
|
|
|
{
|
|
|
|
# libmath
|
|
|
|
getvars $_PLATFORM/libstdc++-v3/libmath/Makefile \
|
|
|
|
libmath_la_SOURCES libmath_la_LIBADD
|
|
|
|
|
|
|
|
# libsupc++
|
|
|
|
getvars $_PLATFORM/libstdc++-v3/libsupc++/Makefile \
|
|
|
|
sources | sed 's/^G_sources=/G_LIBSUPCXX_SOURCES=/'
|
|
|
|
getvars $_PLATFORM/libstdc++-v3/libsupc++/Makefile \
|
|
|
|
c_sources | sed 's/^G_c_sources=/G_LIBSUPCXX_C_SOURCES=/'
|
|
|
|
|
|
|
|
# src
|
|
|
|
getvars $_PLATFORM/libstdc++-v3/src/Makefile \
|
|
|
|
sources SECTION_FLAGS | sed 's/^G_sources=/G_SRC_SOURCES=/'
|
|
|
|
|
|
|
|
# include
|
|
|
|
getvars $_PLATFORM/libstdc++-v3/include/Makefile \
|
|
|
|
c_base_headers_rename std_headers_rename
|
|
|
|
getvars $_PLATFORM/libstdc++-v3/include/Makefile \
|
|
|
|
bits_headers backward_headers ext_headers c_base_headers_extra \
|
|
|
|
target_headers | sed 's#/[^ ][^ ]*/##g'
|
|
|
|
getvars $_PLATFORM/libstdc++-v3/include/Makefile \
|
|
|
|
thread_target_headers target_headers_extra | sed 's#\./[^ ][^ ]*/##g'
|
|
|
|
} | write_mk gnu/lib/libstdc++-v3/arch/$MACHINE_ARCH/defs.mk
|
|
|
|
}
|
|
|
|
|
|
|
|
##### gnu/usr.bin/gcc3 #####
|
|
|
|
|
|
|
|
get_gcc () {
|
|
|
|
mkdir -p $_TOP/gnu/usr.bin/gcc3/arch/$MACHINE_ARCH
|
|
|
|
|
|
|
|
{
|
|
|
|
getvars gcc/Makefile \
|
|
|
|
ALL_CFLAGS ALL_CPPFLAGS C_AND_OBJC_OBJS C_OBJS CCCP_OBJS \
|
|
|
|
GCOV_OBJS PROTO_OBJS HOST_PRINT HOST_RTL HOST_RTLANAL \
|
|
|
|
HOST_SUPPORT HOST_EARLY_SUPPORT HOST_ERRORS HOST_VARRAY \
|
|
|
|
INCLUDES md_file OBJC_OBJS OBJS out_file version \
|
|
|
|
BUILD_PREFIX RTL_H TREE_H HCONFIG_H BASIC_BLOCK_H GCC_H \
|
|
|
|
GTFILES_SRCDIR GTFILES_FILES_FILES GTFILES_FILES_LANGS \
|
|
|
|
GTFILES GTFILES_LANG_DIR_NAMES \
|
|
|
|
tm_defines host_xm_file host_xm_defines tm_p_file \
|
|
|
|
target_cpu_default \
|
|
|
|
LIBCPP_OBJS LIBCPP_H \
|
|
|
|
lang_specs_files
|
|
|
|
getvars gcc/Makefile \
|
|
|
|
LIB2ADDEHDEP | sed 's/unwind.inc//'
|
|
|
|
getvars gcc/Makefile \
|
|
|
|
CXX_OBJS CXX_C_OBJS | sed 's/cp\///g'
|
|
|
|
getvars gcc/Makefile \
|
|
|
|
F77_OBJS | sed 's/f\///g'
|
2004-02-10 12:37:58 +03:00
|
|
|
getvars gcc/Makefile \
|
|
|
|
ENABLE_SHARED SHLIB_LINK SHLIB_MULTILIB
|
2003-07-25 20:26:51 +04:00
|
|
|
} | write_mk gnu/usr.bin/gcc3/arch/$MACHINE_ARCH/defs.mk
|
|
|
|
|
2003-08-22 04:24:46 +04:00
|
|
|
for f in auto-host configargs cs-hconfig gencheck hconfig gthr-default; do
|
2003-07-25 20:26:51 +04:00
|
|
|
write_c gnu/usr.bin/gcc3/arch/$MACHINE_ARCH/$f.h <$_TMPDIR/gcc/$f.h
|
|
|
|
done
|
|
|
|
}
|
|
|
|
|
|
|
|
##### main #####
|
|
|
|
|
|
|
|
case $1 in
|
|
|
|
libgcc) # .mk and .h files for libgcc bootstrap (from host build)
|
|
|
|
get_libgcc
|
|
|
|
exit 0
|
|
|
|
;;
|
|
|
|
|
|
|
|
gcc3)
|
|
|
|
get_gcc
|
|
|
|
get_libg2c
|
|
|
|
get_libgcc
|
|
|
|
get_gcc3_libiberty
|
|
|
|
get_libobjc
|
|
|
|
get_libstdcxx_v3
|
|
|
|
exit 0
|
|
|
|
;;
|
|
|
|
|
|
|
|
*) echo invalid arguments; exit 1;;
|
|
|
|
esac
|