171 lines
4.7 KiB
Bash
Executable File
171 lines
4.7 KiB
Bash
Executable File
#!/bin/sh
|
|
# $NetBSD: mknative-gcc,v 1.11 2004/01/02 11:58:32 skrll Exp $
|
|
#
|
|
# Shell script for generating all the constants needed for a native
|
|
# platform build of src/gnu/dist/gcc.
|
|
#
|
|
|
|
# initialise
|
|
|
|
_TMPDIR=$2
|
|
_TOP=$3
|
|
_PLATFORM=$4
|
|
_VPATH=`grep VPATH ${_TMPDIR}/Makefile | sed 's,^.*= ,,'`
|
|
_GNU_DIST=`cd ${_VPATH}; pwd`
|
|
|
|
. $_TOP/tools/gcc/mknative.common
|
|
|
|
##### 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 () {
|
|
mkdir -p $_TOP/gnu/lib/libgcc3/arch
|
|
|
|
# DPBIT, FPBIT only used on mn10[23]00, we don't need them.
|
|
# XXX we should probably grab everything Just In Case for
|
|
# the future.
|
|
getvars gcc/Makefile \
|
|
CXX_EXTRA_HEADERS CXX_LIB2FUNCS CXX_LIB2SRCS \
|
|
INCLUDES LIB2ADD LIB2ADDEH LIB2FUNCS_1 LIB2FUNCS_2 \
|
|
LIB2FUNCS_EXTRA \
|
|
LIB2_DIVMOD_FUNCS LIB2FUNCS_ST \
|
|
LIBGCC2_CFLAGS MAYBE_USE_COLLECT2 \
|
|
tm_defines xm_file xm_defines \
|
|
| write_mk gnu/lib/libgcc3/arch/$MACHINE_ARCH.mk
|
|
}
|
|
|
|
##### gnu/usr.bin/gcc3/libiberty #####
|
|
|
|
get_gcc3_libiberty () {
|
|
mkdir -p $_TOP/gnu/usr.bin/gcc3/libiberty/arch/$MACHINE_ARCH
|
|
|
|
getvars libiberty/Makefile \
|
|
ALLOCA EXTRA_OFILES LIBOBJS REQUIRED_OFILES \
|
|
| write_mk gnu/usr.bin/gcc3/libiberty/defs.mk
|
|
|
|
write_c gnu/usr.bin/gcc3/libiberty/arch/$MACHINE_ARCH/config.h \
|
|
<$_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 \
|
|
| sed "s,$_GNU_DIST,\${GNUHOSTDIST},g" \
|
|
| 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
|
|
|
|
write_c gnu/lib/libstdc++-v3/arch/$MACHINE_ARCH/config.h \
|
|
<$_TMPDIR/$_PLATFORM/libstdc++-v3/config.h
|
|
|
|
{
|
|
# 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'
|
|
} | write_mk gnu/usr.bin/gcc3/arch/$MACHINE_ARCH/defs.mk
|
|
|
|
for f in auto-host configargs cs-hconfig gencheck hconfig gthr-default; do
|
|
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
|