2003-07-25 20:26:51 +04:00
|
|
|
#!/bin/sh
|
2008-10-11 09:03:43 +04:00
|
|
|
# $NetBSD: mknative-gcc,v 1.25 2008/10/11 05:03:44 mrg 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
|
2004-12-10 16:58:11 +03:00
|
|
|
_VPATH=`grep VPATH ${_TMPDIR}/Makefile | sed 's,^.*=[ ]*,,'`
|
2003-11-27 04:05:45 +03:00
|
|
|
_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
|
|
|
|
2004-08-25 00:24:43 +04:00
|
|
|
##### gnu/lib/crtstuff #####
|
|
|
|
|
|
|
|
get_crtstuff () {
|
2006-05-12 06:12:37 +04:00
|
|
|
_subdir="$1"
|
|
|
|
mkdir -p $_TOP/gnu/lib/$_subdir/arch
|
2004-08-25 00:24:43 +04:00
|
|
|
|
|
|
|
getvars gcc/Makefile \
|
|
|
|
INCLUDES CRTSTUFF_CFLAGS CRTSTUFF_T_CFLAGS \
|
|
|
|
tm_defines xm_file xm_defines \
|
2006-05-12 06:12:37 +04:00
|
|
|
| write_mk gnu/lib/$_subdir/arch/$MACHINE_ARCH.mk
|
2004-08-25 00:24:43 +04:00
|
|
|
}
|
|
|
|
|
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 () {
|
2006-05-12 06:12:37 +04:00
|
|
|
_subdir="$1"
|
|
|
|
mkdir -p $_TOP/gnu/lib/lib$_subdir/arch
|
|
|
|
|
|
|
|
case "$_subdir" in
|
|
|
|
gcc3)
|
|
|
|
_extravars="USE_COLLECT2 LIB2FUNCS_1 LIB2FUNCS_2 xm_file"
|
|
|
|
_archsubdir=""
|
|
|
|
;;
|
|
|
|
gcc4)
|
|
|
|
_extravars="COLLECT2 UNWIND_H xm_include_list"
|
|
|
|
_archsubdir=""
|
|
|
|
;;
|
|
|
|
esac
|
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.
|
2006-05-12 06:12:37 +04:00
|
|
|
{
|
|
|
|
getvars gcc/Makefile \
|
|
|
|
INCLUDES LIB2ADD LIB2ADDEH \
|
|
|
|
LIB1ASMFUNCS LIB1ASMSRC \
|
|
|
|
LIB2_DIVMOD_FUNCS LIB2FUNCS_ST \
|
|
|
|
LIBGCC2_CFLAGS \
|
|
|
|
SHLIB_MKMAP SHLIB_MKMAP_OPTS \
|
|
|
|
SHLIB_MAPFILES SHLIB_NM_FLAGS \
|
|
|
|
EXTRA_HEADERS xm_defines \
|
|
|
|
tm_defines ${_extravars}
|
|
|
|
} | write_mk gnu/lib/lib$_subdir/arch${_archsubdir}/$MACHINE_ARCH.mk
|
2003-07-25 20:26:51 +04:00
|
|
|
}
|
|
|
|
|
2008-09-19 17:18:28 +04:00
|
|
|
##### gnu/lib/libgcov #####
|
|
|
|
|
|
|
|
get_libgcov () {
|
|
|
|
_subdir="$1"
|
|
|
|
|
|
|
|
mkdir -p $_TOP/gnu/lib/lib$_subdir/libgcov/arch/$MACHINE_ARCH
|
|
|
|
|
|
|
|
{
|
|
|
|
getvars gcc/Makefile \
|
|
|
|
LIBGCOV
|
|
|
|
} | write_mk gnu/lib/lib$_subdir/libgcov/arch/$MACHINE_ARCH/defs.mk
|
|
|
|
|
|
|
|
write_c gnu/lib/lib$_subdir/libgcov/arch/$MACHINE_ARCH/gcov-iov.h \
|
|
|
|
<$_TMPDIR/gcc/gcov-iov.h
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2006-05-12 06:12:37 +04:00
|
|
|
##### gnu/usr.bin/gcc[34]/libiberty #####
|
2003-07-25 20:26:51 +04:00
|
|
|
|
2006-05-12 06:12:37 +04:00
|
|
|
get_gcc_libiberty () {
|
|
|
|
_subdir="$1"
|
|
|
|
mkdir -p $_TOP/gnu/usr.bin/$_subdir/libiberty/arch/$MACHINE_ARCH
|
2003-07-25 20:26:51 +04:00
|
|
|
|
|
|
|
getvars libiberty/Makefile \
|
|
|
|
ALLOCA EXTRA_OFILES LIBOBJS REQUIRED_OFILES \
|
2006-05-12 06:12:37 +04:00
|
|
|
| write_mk gnu/usr.bin/$_subdir/libiberty/defs.mk
|
2003-07-25 20:26:51 +04:00
|
|
|
|
2006-05-12 06:12:37 +04:00
|
|
|
write_c gnu/usr.bin/$_subdir/libiberty/arch/$MACHINE_ARCH/config.h \
|
2003-07-25 20:26:51 +04:00
|
|
|
<$_TMPDIR/libiberty/config.h
|
|
|
|
}
|
|
|
|
|
|
|
|
##### gnu/lib/libobjc #####
|
|
|
|
|
|
|
|
get_libobjc () {
|
2006-05-23 14:55:55 +04:00
|
|
|
case "$1" in
|
|
|
|
*4)
|
|
|
|
_subdir="$1/arch/$MACHINE_ARCH"
|
|
|
|
_options="ALL_OPT_FILES"
|
2006-06-09 19:30:52 +04:00
|
|
|
_unwind="UNWIND_H"
|
2006-05-23 14:55:55 +04:00
|
|
|
;;
|
|
|
|
*)
|
|
|
|
_subdir="$1"
|
|
|
|
_options=""
|
2006-06-09 19:30:52 +04:00
|
|
|
_unwind=""
|
2006-05-23 14:55:55 +04:00
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
2006-05-12 06:12:37 +04:00
|
|
|
mkdir -p $_TOP/gnu/lib/$_subdir
|
2003-07-25 20:26:51 +04:00
|
|
|
|
2006-05-12 06:12:37 +04:00
|
|
|
{
|
2006-05-23 14:55:55 +04:00
|
|
|
if [ -n "$_options" ]; then
|
|
|
|
getvars gcc/Makefile $_options
|
|
|
|
fi
|
2006-05-12 06:12:37 +04:00
|
|
|
getvars $_PLATFORM/libobjc/Makefile \
|
|
|
|
ALL_CFLAGS INCLUDES OBJS OBJC_H \
|
|
|
|
| sed "s,$_GNU_DIST,\${GNUHOSTDIST},g"
|
2006-06-09 19:30:52 +04:00
|
|
|
if [ -n "$_unwind" ]; then
|
|
|
|
getvars gcc/Makefile $_unwind
|
|
|
|
fi
|
2006-05-12 06:12:37 +04:00
|
|
|
} | write_mk gnu/lib/$_subdir/defs.mk
|
2008-02-08 21:06:48 +03:00
|
|
|
|
|
|
|
write_c gnu/lib/$_subdir/config.h \
|
|
|
|
<$_TMPDIR/$_PLATFORM/libobjc/config.h
|
2003-07-25 20:26:51 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
##### gnu/lib/libstdc++-v3 #####
|
|
|
|
|
|
|
|
get_libstdcxx_v3 () {
|
2006-05-12 06:12:37 +04:00
|
|
|
_subdir="$1"
|
|
|
|
mkdir -p $_TOP/gnu/lib/$_subdir/arch/$MACHINE_ARCH
|
2003-07-25 20:26:51 +04:00
|
|
|
|
2006-05-12 06:12:37 +04:00
|
|
|
case ${_subdir} in
|
|
|
|
*4)
|
|
|
|
_src_CC_files="atomicity_file CCODECVT_CC CCOLLATE_CC CCTYPE_CC CMESSAGES_CC CMONEY_CC CNUMERIC_CC CTIME_CC CLOCALE_CC BASIC_FILE_CC"
|
|
|
|
_headers1="host_headers debug_headers tr1_headers c_compatibility_headers_extra"
|
|
|
|
_headers2="thread_host_headers host_headers_extra"
|
2006-06-02 23:44:20 +04:00
|
|
|
_build_headers="c++allocator.h c++config.h cxxabi_tweaks.h gthr-default.h gthr-posix.h gthr-single.h gthr-tpf.h gthr.h"
|
2006-06-09 19:30:52 +04:00
|
|
|
_unwind="UNWIND_H"
|
2006-05-12 06:12:37 +04:00
|
|
|
;;
|
|
|
|
*)
|
|
|
|
_src_CC_files=""
|
|
|
|
_headers1="target_headers"
|
|
|
|
_headers2="thread_target_headers target_headers_extra"
|
2006-06-02 23:44:20 +04:00
|
|
|
_build_headers="c++config.h gthr-default.h gthr-posix.h gthr-single.h gthr.h"
|
2006-06-09 19:30:52 +04:00
|
|
|
_unwind=""
|
2006-05-12 06:12:37 +04:00
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
2006-06-02 23:44:20 +04:00
|
|
|
# build files
|
|
|
|
for h in $_build_headers; do
|
|
|
|
write_c gnu/lib/$_subdir/arch/$MACHINE_ARCH/$h \
|
|
|
|
<$_TMPDIR/$_PLATFORM/libstdc++-v3/include/$_PLATFORM/bits/$h
|
|
|
|
done
|
|
|
|
|
2006-05-12 06:12:37 +04:00
|
|
|
write_c gnu/lib/$_subdir/arch/$MACHINE_ARCH/config.h \
|
2003-08-01 06:44:55 +04:00
|
|
|
<$_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 \
|
2006-05-12 06:12:37 +04:00
|
|
|
sources $_src_CC_files SECTION_FLAGS | sed 's/^G_sources=/G_SRC_SOURCES=/'
|
2003-07-25 20:26:51 +04:00
|
|
|
|
|
|
|
# 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 \
|
2006-05-16 02:03:03 +04:00
|
|
|
$_headers1 | sed -e 's#/[^ ][^ ]*/##g' -e 's/\${GNUHOSTDIST}//g'
|
2003-07-25 20:26:51 +04:00
|
|
|
getvars $_PLATFORM/libstdc++-v3/include/Makefile \
|
2006-05-16 02:03:03 +04:00
|
|
|
$_headers2 | sed -e 's#\./[^ ][^ ]*/##g' -e 's/\${GNUHOSTDIST}//g'
|
2006-05-12 06:12:37 +04:00
|
|
|
|
2006-06-09 19:30:52 +04:00
|
|
|
if [ -n "$_unwind" ]; then
|
|
|
|
getvars gcc/Makefile $_unwind
|
|
|
|
fi
|
2006-05-12 06:12:37 +04:00
|
|
|
} | write_mk gnu/lib/$_subdir/arch/$MACHINE_ARCH/defs.mk
|
2003-07-25 20:26:51 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
##### gnu/usr.bin/gcc3 #####
|
|
|
|
|
|
|
|
get_gcc () {
|
2006-05-12 06:12:37 +04:00
|
|
|
_subdir="$1"
|
|
|
|
mkdir -p $_TOP/gnu/usr.bin/$_subdir/arch/$MACHINE_ARCH
|
2006-06-02 23:44:20 +04:00
|
|
|
case ${_subdir} in
|
|
|
|
gcc4)
|
|
|
|
mkdir -p $_TOP/gnu/usr.bin/$_subdir/libcpp/arch/$MACHINE_ARCH
|
|
|
|
_buildname="BUILD_"
|
|
|
|
_libcppsubdir=""
|
2006-06-09 19:30:52 +04:00
|
|
|
_extravars="TM_H ALL_OPT_FILES"
|
|
|
|
_hconfig_h=""
|
|
|
|
_extravars2="tm_file_list build_xm_include_list"
|
|
|
|
_extravars3="tm_p_include_list"
|
|
|
|
|
2006-06-02 23:44:20 +04:00
|
|
|
;;
|
|
|
|
*)
|
|
|
|
_buildname="HOST_"
|
|
|
|
_libcppsubdir="gcc/"
|
2006-06-09 19:30:52 +04:00
|
|
|
_extravars=""
|
|
|
|
_hconfig_h="HCONFIG_H"
|
|
|
|
_extravars2=""
|
|
|
|
_extravars3=""
|
2006-06-02 23:44:20 +04:00
|
|
|
;;
|
|
|
|
esac
|
2003-07-25 20:26:51 +04:00
|
|
|
|
|
|
|
{
|
2006-05-12 06:12:37 +04:00
|
|
|
getvars gcc/Makefile \
|
2006-06-02 23:44:20 +04:00
|
|
|
${_buildname}EARLY_SUPPORT ${_buildname}ERRORS ${_buildname}PRINT \
|
|
|
|
${_buildname}RTL ${_buildname}SUPPORT ${_buildname}VARRAY | \
|
2006-05-12 06:12:37 +04:00
|
|
|
sed -e 's#build/errors.o#build-errors.o#g' \
|
|
|
|
-e 's#build/print-rtl.o#build-print-rtl.o#g' \
|
|
|
|
-e 's#build/rtl.o#build-rtl.o#g' \
|
|
|
|
-e 's#build/varray.o#build-varray.o#g' \
|
2006-06-25 07:06:15 +04:00
|
|
|
-e 's#build/ggc-none.o#build-ggc-none.o#g' \
|
2006-05-12 06:12:37 +04:00
|
|
|
-e 's#build/##g'
|
2003-07-25 20:26:51 +04:00
|
|
|
getvars gcc/Makefile \
|
|
|
|
ALL_CFLAGS ALL_CPPFLAGS C_AND_OBJC_OBJS C_OBJS CCCP_OBJS \
|
2006-06-09 19:30:52 +04:00
|
|
|
GCOV_OBJS PROTO_OBJS ${_extravars1} \
|
2003-07-25 20:26:51 +04:00
|
|
|
INCLUDES md_file OBJC_OBJS OBJS out_file version \
|
2006-06-09 19:30:52 +04:00
|
|
|
BUILD_PREFIX RTL_H TREE_H ${_hconfig_h} BASIC_BLOCK_H GCC_H \
|
2003-07-25 20:26:51 +04:00
|
|
|
GTFILES_SRCDIR GTFILES_FILES_FILES GTFILES_FILES_LANGS \
|
|
|
|
GTFILES GTFILES_LANG_DIR_NAMES \
|
|
|
|
tm_defines host_xm_file host_xm_defines tm_p_file \
|
2006-06-24 09:26:50 +04:00
|
|
|
target_cpu_default ${_extravars} ${_extravars2} \
|
2006-06-09 19:30:52 +04:00
|
|
|
lang_specs_files ${_extravars3}
|
2003-07-25 20:26:51 +04:00
|
|
|
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'
|
2006-06-02 23:44:20 +04:00
|
|
|
case ${_subdir} in
|
|
|
|
gcc4)
|
|
|
|
getvars libcpp/Makefile \
|
|
|
|
libcpp_a_OBJS
|
|
|
|
;;
|
|
|
|
gcc3)
|
|
|
|
getvars gcc/Makefile \
|
|
|
|
LIBCPP_OBJS LIBCPP_H
|
|
|
|
;;
|
|
|
|
esac
|
2004-02-10 12:37:58 +03:00
|
|
|
getvars gcc/Makefile \
|
2006-05-12 06:12:37 +04:00
|
|
|
ENABLE_SHARED
|
2006-06-09 19:30:52 +04:00
|
|
|
case ${_subdir} in
|
|
|
|
gcc4)
|
|
|
|
echo G_SHLIB_LINK="$CC -shared"
|
|
|
|
echo G_SHLIB_MULTILIB=.
|
|
|
|
;;
|
|
|
|
gcc3)
|
|
|
|
getvars gcc/Makefile \
|
|
|
|
SHLIB_LINK SHLIB_MULTILIB
|
|
|
|
;;
|
|
|
|
esac
|
2006-05-12 06:12:37 +04:00
|
|
|
} | write_mk gnu/usr.bin/$_subdir/arch/$MACHINE_ARCH/defs.mk
|
|
|
|
|
|
|
|
case "$_subdir" in
|
|
|
|
gcc3)
|
|
|
|
hfiles='auto-host configargs cs-hconfig gencheck hconfig gthr-default'
|
|
|
|
;;
|
|
|
|
gcc4)
|
|
|
|
write_c gnu/usr.bin/$_subdir/libcpp/arch/$MACHINE_ARCH/config.h <$_TMPDIR/libcpp/config.h
|
2008-10-11 09:03:43 +04:00
|
|
|
hfiles='auto-host configargs gencheck gthr-default tm bconfig config multilib'
|
2006-05-12 06:12:37 +04:00
|
|
|
;;
|
|
|
|
esac
|
|
|
|
for f in $hfiles; do
|
|
|
|
write_c gnu/usr.bin/$_subdir/arch/$MACHINE_ARCH/$f.h <$_TMPDIR/gcc/$f.h
|
2003-07-25 20:26:51 +04:00
|
|
|
done
|
|
|
|
}
|
|
|
|
|
|
|
|
##### main #####
|
|
|
|
|
2006-05-12 06:12:37 +04:00
|
|
|
case "$1" in
|
|
|
|
# .mk and .h files for libgcc bootstrap (from host build)
|
|
|
|
libgcc)
|
|
|
|
get_libgcc gcc3
|
|
|
|
get_crtstuff crtstuff3
|
|
|
|
exit 0
|
|
|
|
;;
|
|
|
|
|
|
|
|
libgcc4)
|
|
|
|
get_libgcc gcc4
|
|
|
|
get_crtstuff crtstuff4
|
|
|
|
exit 0
|
|
|
|
;;
|
|
|
|
|
|
|
|
# gcc files
|
|
|
|
gcc4)
|
|
|
|
get_gcc gcc4
|
|
|
|
get_libgcc gcc4
|
2008-09-19 17:18:28 +04:00
|
|
|
get_libgcov gcc4
|
2006-05-12 06:12:37 +04:00
|
|
|
get_crtstuff crtstuff4
|
|
|
|
get_gcc_libiberty gcc4
|
|
|
|
get_libobjc libobjc4
|
|
|
|
get_libstdcxx_v3 libstdc++-v3_4
|
2003-07-25 20:26:51 +04:00
|
|
|
exit 0
|
|
|
|
;;
|
|
|
|
|
|
|
|
gcc3)
|
2006-05-12 06:12:37 +04:00
|
|
|
get_gcc gcc3
|
2003-07-25 20:26:51 +04:00
|
|
|
get_libg2c
|
2006-06-09 19:30:52 +04:00
|
|
|
get_libgcc gcc3
|
2006-05-12 06:12:37 +04:00
|
|
|
get_crtstuff crtstuff3
|
2006-06-09 19:30:52 +04:00
|
|
|
get_gcc_libiberty gcc3
|
2006-05-12 06:12:37 +04:00
|
|
|
get_libobjc libobjc3
|
|
|
|
get_libstdcxx_v3 libstdc++-v3
|
2003-07-25 20:26:51 +04:00
|
|
|
exit 0
|
|
|
|
;;
|
|
|
|
|
|
|
|
*) echo invalid arguments; exit 1;;
|
|
|
|
esac
|