1c8a0e2f4SThomas Veerman#!/bin/sh 2*0a6a1f1dSLionel Sambuc# $NetBSD: mknative-gcc,v 1.81 2015/01/31 08:50:01 mrg Exp $ 3c8a0e2f4SThomas Veerman# 4c8a0e2f4SThomas Veerman# Shell script for generating all the constants needed for a native 5d19d7d58SLionel Sambuc# platform build of gcc. 6c8a0e2f4SThomas Veerman# 7c8a0e2f4SThomas Veerman 8c8a0e2f4SThomas Veerman# initialise 9c8a0e2f4SThomas Veerman 10c8a0e2f4SThomas Veerman_TMPDIR=$2 11c8a0e2f4SThomas Veerman_TOP=$3 1284d9c625SLionel Sambuc_SRC=$4 1384d9c625SLionel Sambuc_PLATFORM=$5 1484d9c625SLionel Sambuc_DESTDIR=$6 15*0a6a1f1dSLionel Sambuc_TOOLDIR=$7 16c8a0e2f4SThomas Veerman_VPATH=`grep VPATH ${_TMPDIR}/Makefile | sed 's,^.*=[ ]*,,'` 17c8a0e2f4SThomas Veerman_GNU_DIST=`cd ${_VPATH}; pwd` 18c8a0e2f4SThomas Veerman 19c8a0e2f4SThomas Veermanif [ -z "$_DESTDIR" ]; then 20c8a0e2f4SThomas Veerman echo "\$_DESTDIR is empty" 2>&1 21c8a0e2f4SThomas Veerman exit 1 22c8a0e2f4SThomas Veermanfi 23c8a0e2f4SThomas Veerman 24c8a0e2f4SThomas Veerman. $_TOP/tools/gcc/mknative.common 25c8a0e2f4SThomas Veerman 26c8a0e2f4SThomas Veerman# default to GCC 4.1 for now 27c8a0e2f4SThomas Veerman_OUTDIR="$_TOP/gnu" 28c8a0e2f4SThomas Veerman_OUTDIRBASE="gnu" 29c8a0e2f4SThomas Veerman 3084d9c625SLionel Sambucsanitise_includes () { 3184d9c625SLionel Sambuc sed \ 3284d9c625SLionel Sambuc -e "s,-I$_DESTDIR/usr/include,,g" \ 33*0a6a1f1dSLionel Sambuc -e "s,-I$_SRC/external/lgpl3/mpfr/dist/src,,g" \ 3484d9c625SLionel Sambuc -e "s,-I$_SRC/external/lgpl3/mpc/dist/src,,g" \ 35*0a6a1f1dSLionel Sambuc -e "s,-I$_SRC/external/lgpl3/gmp/lib/libgmp/arch/[a-z_0-9-]*,,g" \ 36*0a6a1f1dSLionel Sambuc -e "s,-I$_TOOLDIR/include,,g" \ 3784d9c625SLionel Sambuc -e "s,-I/usr/include/[^ ]*,," 3884d9c625SLionel Sambuc} 3984d9c625SLionel Sambuc 40*0a6a1f1dSLionel Sambuc##### lib/crtstuff ##### 41c8a0e2f4SThomas Veerman 42c8a0e2f4SThomas Veermanget_crtstuff () { 43c8a0e2f4SThomas Veerman _subdir="$1" 44c8a0e2f4SThomas Veerman mkdir -p $_OUTDIR/lib/$_subdir/arch 45c8a0e2f4SThomas Veerman 46c8a0e2f4SThomas Veerman getvars gcc/Makefile \ 479152e1c5SLionel Sambuc INCLUDES CRTSTUFF_CFLAGS CRTSTUFF_T_CFLAGS CRTSTUFF_T_CFLAGS_S \ 48c8a0e2f4SThomas Veerman tm_defines xm_file xm_defines \ 4984d9c625SLionel Sambuc | sanitise_includes \ 50c8a0e2f4SThomas Veerman | write_mk $_OUTDIRBASE/lib/$_subdir/arch/$MACHINE_ARCH.mk 51c8a0e2f4SThomas Veerman} 52c8a0e2f4SThomas Veerman 53*0a6a1f1dSLionel Sambuc##### lib/libg2c ##### 54c8a0e2f4SThomas Veerman 55c8a0e2f4SThomas Veermanget_libg2c () { 56c8a0e2f4SThomas Veerman mkdir -p $_OUTDIR/lib/libg2c3/arch/$MACHINE_ARCH 57c8a0e2f4SThomas Veerman 58c8a0e2f4SThomas Veerman write_c $_OUTDIRBASE/lib/libg2c3/arch/$MACHINE_ARCH/config.h <$_TMPDIR/$_PLATFORM/libf2c/libU77/config.h 59c8a0e2f4SThomas Veerman write_c $_OUTDIRBASE/lib/libg2c3/arch/$MACHINE_ARCH/g2c.h <$_TMPDIR/$_PLATFORM/libf2c/g2c.h 60c8a0e2f4SThomas Veerman 61c8a0e2f4SThomas Veerman { 62c8a0e2f4SThomas Veerman getvars $_PLATFORM/libf2c/Makefile \ 63c8a0e2f4SThomas Veerman F2CEXT 64c8a0e2f4SThomas Veerman getvars $_PLATFORM/libf2c/libF77/Makefile \ 65c8a0e2f4SThomas Veerman ALL_CFLAGS OBJS 66c8a0e2f4SThomas Veerman getvars $_PLATFORM/libf2c/libI77/Makefile \ 67c8a0e2f4SThomas Veerman ALL_CFLAGS OBJS | sed 's,=,+=,' 68c8a0e2f4SThomas Veerman getvars $_PLATFORM/libf2c/libU77/Makefile \ 69c8a0e2f4SThomas Veerman ALL_CFLAGS OBJS | sed 's,=,+=,' 70c8a0e2f4SThomas Veerman } | write_mk $_OUTDIRBASE/lib/libg2c3/arch/$MACHINE_ARCH/defs.mk 71c8a0e2f4SThomas Veerman} 72c8a0e2f4SThomas Veerman 73*0a6a1f1dSLionel Sambuc##### lib/libgcc ##### 74c8a0e2f4SThomas Veerman 75c8a0e2f4SThomas Veermanget_libgcc () { 76c8a0e2f4SThomas Veerman _subdir="$1" 77c8a0e2f4SThomas Veerman mkdir -p $_OUTDIR/lib/lib$_subdir/arch 78c8a0e2f4SThomas Veerman 79c8a0e2f4SThomas Veerman # DPBIT, FPBIT only used on mn10[23]00, we don't need them. 80c8a0e2f4SThomas Veerman # XXX we should probably grab everything Just In Case for 81c8a0e2f4SThomas Veerman # the future. 82*0a6a1f1dSLionel Sambuc 83*0a6a1f1dSLionel Sambuc mkdir -p $_OUTDIR/lib/lib$_subdir/arch/$MACHINE_ARCH 84*0a6a1f1dSLionel Sambuc cd $_TMPDIR/$_PLATFORM/libgcc 85c8a0e2f4SThomas Veerman { 86*0a6a1f1dSLionel Sambuc getvars $_PLATFORM/libgcc/Makefile \ 87c8a0e2f4SThomas Veerman INCLUDES LIB2ADD LIB2ADDEH LIB2ADD_ST \ 88c8a0e2f4SThomas Veerman LIB1ASMFUNCS LIB1ASMSRC \ 89c8a0e2f4SThomas Veerman LIB2_DIVMOD_FUNCS LIB2FUNCS_ST \ 90c8a0e2f4SThomas Veerman LIB2FUNCS_EXTRA \ 91c8a0e2f4SThomas Veerman LIBGCC2_CFLAGS \ 92c8a0e2f4SThomas Veerman SHLIB_MKMAP SHLIB_MKMAP_OPTS \ 93*0a6a1f1dSLionel Sambuc SHLIB_MAPFILES SHLIB_NM_FLAGS 94*0a6a1f1dSLionel Sambuc getvars gcc/Makefile \ 95*0a6a1f1dSLionel Sambuc NOEXCEPTION_FLAGS EXTRA_HEADERS 96*0a6a1f1dSLionel Sambuc getlinks config.status libgcc 9784d9c625SLionel Sambuc } | sanitise_includes \ 98*0a6a1f1dSLionel Sambuc | write_mk $_OUTDIRBASE/lib/lib$_subdir/arch/$MACHINE_ARCH/defs.mk 99c8a0e2f4SThomas Veerman 100*0a6a1f1dSLionel Sambuc if [ "${MACHINE_ARCH}" = "m68000" ] 101*0a6a1f1dSLionel Sambuc then 102*0a6a1f1dSLionel Sambuc ex <<__EOF__ $_OUTDIR/lib/lib$_subdir/arch/$MACHINE_ARCH/defs.mk 103*0a6a1f1dSLionel Sambuc/G_LIBGCC2_CFLAGS/ s/-fPIC// 104*0a6a1f1dSLionel Sambucwq 105*0a6a1f1dSLionel Sambuc__EOF__ 106c8a0e2f4SThomas Veerman fi 107*0a6a1f1dSLionel Sambuc 108*0a6a1f1dSLionel Sambuc for f in auto-target.h; do 109*0a6a1f1dSLionel Sambuc write_c $_OUTDIRBASE/lib/lib$_subdir/arch/$MACHINE_ARCH/$f \ 110*0a6a1f1dSLionel Sambuc <$_TMPDIR/$_PLATFORM/libgcc/$f 111*0a6a1f1dSLionel Sambuc done 112c8a0e2f4SThomas Veerman} 113c8a0e2f4SThomas Veerman 114*0a6a1f1dSLionel Sambuc##### lib/libgcov ##### 115c8a0e2f4SThomas Veerman 116c8a0e2f4SThomas Veermanget_libgcov () { 117c8a0e2f4SThomas Veerman _subdir="$1" 118*0a6a1f1dSLionel Sambuc _mf="$2" 119c8a0e2f4SThomas Veerman 120c8a0e2f4SThomas Veerman mkdir -p $_OUTDIR/lib/lib$_subdir/libgcov/arch/$MACHINE_ARCH 121c8a0e2f4SThomas Veerman 122c8a0e2f4SThomas Veerman { 123*0a6a1f1dSLionel Sambuc getvars $_mf \ 124c8a0e2f4SThomas Veerman LIBGCOV 125c8a0e2f4SThomas Veerman } | write_mk $_OUTDIRBASE/lib/lib$_subdir/libgcov/arch/$MACHINE_ARCH/defs.mk 126c8a0e2f4SThomas Veerman 127c8a0e2f4SThomas Veerman write_c $_OUTDIRBASE/lib/lib$_subdir/libgcov/arch/$MACHINE_ARCH/gcov-iov.h \ 128c8a0e2f4SThomas Veerman <$_TMPDIR/gcc/gcov-iov.h 129c8a0e2f4SThomas Veerman 130c8a0e2f4SThomas Veerman} 131c8a0e2f4SThomas Veerman 132*0a6a1f1dSLionel Sambuc##### lib/libiberty ##### 133c8a0e2f4SThomas Veerman 134c8a0e2f4SThomas Veermanget_gcc_libiberty () { 135c8a0e2f4SThomas Veerman _subdir="$1" 136c8a0e2f4SThomas Veerman _libibertydir="lib/libiberty" 137c8a0e2f4SThomas Veerman mkdir -p $_OUTDIR/$_libibertydir/arch/$MACHINE_ARCH 138c8a0e2f4SThomas Veerman 139c8a0e2f4SThomas Veerman getvars libiberty/Makefile \ 140c8a0e2f4SThomas Veerman ALLOCA EXTRA_OFILES LIBOBJS REQUIRED_OFILES \ 141c8a0e2f4SThomas Veerman | write_mk $_OUTDIRBASE/$_libibertydir/defs.mk 142c8a0e2f4SThomas Veerman 143c8a0e2f4SThomas Veerman write_c $_OUTDIRBASE/$_libibertydir/arch/$MACHINE_ARCH/config.h \ 144c8a0e2f4SThomas Veerman <$_TMPDIR/libiberty/config.h 145c8a0e2f4SThomas Veerman} 146c8a0e2f4SThomas Veerman 147c8a0e2f4SThomas Veerman##### lib/libdecnumber ##### 148c8a0e2f4SThomas Veerman 149c8a0e2f4SThomas Veermanget_libdecnumber () { 150c8a0e2f4SThomas Veerman _subdir="$1" 151c8a0e2f4SThomas Veerman 152c8a0e2f4SThomas Veerman mkdir -p $_OUTDIR/usr.bin/$_subdir/arch/$MACHINE_ARCH 153c8a0e2f4SThomas Veerman write_c $_OUTDIRBASE/usr.bin/$_subdir/arch/$MACHINE_ARCH/config.h \ 154c8a0e2f4SThomas Veerman <$_TMPDIR/libdecnumber/config.h 155c8a0e2f4SThomas Veerman} 156c8a0e2f4SThomas Veerman 157c8a0e2f4SThomas Veerman##### lib/libgomp ##### 158c8a0e2f4SThomas Veerman 159c8a0e2f4SThomas Veermanget_libgomp () { 160c8a0e2f4SThomas Veerman _subdir="$1" 161c8a0e2f4SThomas Veerman 162c8a0e2f4SThomas Veerman mkdir -p $_OUTDIR/lib/$_subdir/arch/$MACHINE_ARCH 163c8a0e2f4SThomas Veerman write_c $_OUTDIRBASE/lib/$_subdir/arch/$MACHINE_ARCH/config.h \ 164c8a0e2f4SThomas Veerman <$_TMPDIR/$_PLATFORM/libgomp/config.h 165c8a0e2f4SThomas Veerman write_c $_OUTDIRBASE/lib/$_subdir/arch/$MACHINE_ARCH/libgomp_f.h \ 166c8a0e2f4SThomas Veerman <$_TMPDIR/$_PLATFORM/libgomp/libgomp_f.h 167c8a0e2f4SThomas Veerman write_mk $_OUTDIRBASE/lib/$_subdir/arch/$MACHINE_ARCH/libgomp.spec \ 168c8a0e2f4SThomas Veerman <$_TMPDIR/$_PLATFORM/libgomp/libgomp.spec 169c8a0e2f4SThomas Veerman write_c $_OUTDIRBASE/lib/$_subdir/arch/$MACHINE_ARCH/omp.h \ 170c8a0e2f4SThomas Veerman <$_TMPDIR/$_PLATFORM/libgomp/omp.h 171c8a0e2f4SThomas Veerman} 172c8a0e2f4SThomas Veerman 173*0a6a1f1dSLionel Sambuc##### lib/libbacktrace ##### 174*0a6a1f1dSLionel Sambuc 175*0a6a1f1dSLionel Sambucget_libbacktrace () { 176*0a6a1f1dSLionel Sambuc _subdir="$1" 177*0a6a1f1dSLionel Sambuc 178*0a6a1f1dSLionel Sambuc mkdir -p $_OUTDIR/lib/$_subdir/arch/$MACHINE_ARCH 179*0a6a1f1dSLionel Sambuc write_c $_OUTDIRBASE/lib/$_subdir/arch/$MACHINE_ARCH/config.h \ 180*0a6a1f1dSLionel Sambuc <$_TMPDIR/$_subdir/config.h 181*0a6a1f1dSLionel Sambuc write_c $_OUTDIRBASE/lib/$_subdir/arch/$MACHINE_ARCH/backtrace-supported.h \ 182*0a6a1f1dSLionel Sambuc <$_TMPDIR/$_subdir/backtrace-supported.h 183*0a6a1f1dSLionel Sambuc} 184*0a6a1f1dSLionel Sambuc 185*0a6a1f1dSLionel Sambuc##### lib/libobjc ##### 186c8a0e2f4SThomas Veerman 187c8a0e2f4SThomas Veermanget_libobjc () { 188c8a0e2f4SThomas Veerman _subdir="$1/arch/$MACHINE_ARCH" 189c8a0e2f4SThomas Veerman _options="ALL_OPT_FILES" 190c8a0e2f4SThomas Veerman 191c8a0e2f4SThomas Veerman mkdir -p $_OUTDIR/lib/$_subdir 192c8a0e2f4SThomas Veerman 193c8a0e2f4SThomas Veerman { 194c8a0e2f4SThomas Veerman if [ -n "$_options" ]; then 195c8a0e2f4SThomas Veerman getvars gcc/Makefile $_options 196c8a0e2f4SThomas Veerman fi 197c8a0e2f4SThomas Veerman getvars $_PLATFORM/libobjc/Makefile \ 198*0a6a1f1dSLionel Sambuc ALL_CFLAGS INCLUDES OBJC_SOURCE_FILES C_SOURCE_FILES OBJC_H \ 199c8a0e2f4SThomas Veerman | sed "s,$_GNU_DIST,\${GNUHOSTDIST},g" 200*0a6a1f1dSLionel Sambuc getlinks $_TMPDIR/$_PLATFORM/libgcc/config.status libgcc 201*0a6a1f1dSLionel Sambuc } | sanitise_includes \ 202*0a6a1f1dSLionel Sambuc | write_mk $_OUTDIRBASE/lib/$_subdir/defs.mk 203c8a0e2f4SThomas Veerman 204c8a0e2f4SThomas Veerman write_c $_OUTDIRBASE/lib/$_subdir/config.h \ 205c8a0e2f4SThomas Veerman <$_TMPDIR/$_PLATFORM/libobjc/config.h 206c8a0e2f4SThomas Veerman} 207c8a0e2f4SThomas Veerman 208*0a6a1f1dSLionel Sambuc##### lib/libstdc++-v3 ##### 209c8a0e2f4SThomas Veerman 210c8a0e2f4SThomas Veermanget_libstdcxx_v3 () { 211c8a0e2f4SThomas Veerman _subdir="$1" 212*0a6a1f1dSLionel Sambuc _ver="$2" 213*0a6a1f1dSLionel Sambuc 214c8a0e2f4SThomas Veerman mkdir -p $_OUTDIR/lib/$_subdir/arch/$MACHINE_ARCH 215c8a0e2f4SThomas Veerman 216*0a6a1f1dSLionel Sambuc _build_headers="c++config.h cxxabi_tweaks.h gthr-posix.h gthr-single.h gthr.h" 217*0a6a1f1dSLionel Sambuc _headers1="c_base_headers_extra_install" 218*0a6a1f1dSLionel Sambuc _headers1="$_headers1 tr1_headers tr2_headers decimal_headers c_compatibility_headers_install" 219*0a6a1f1dSLionel Sambuc _headers1="$_headers1 debug_headers parallel_headers" 220*0a6a1f1dSLionel Sambuc _headers2="host_headers thread_host_headers" 221*0a6a1f1dSLionel Sambuc _pf_headers="profile_headers profile_impl_headers" 222*0a6a1f1dSLionel Sambuc _pb_headers="pb_headers1 pb_headers2 pb_headers3 pb_headers4 pb_headers5 pb_headers6 pb_headers7" 223c8a0e2f4SThomas Veerman 224c8a0e2f4SThomas Veerman # build files 225c8a0e2f4SThomas Veerman for h in $_build_headers; do 226c8a0e2f4SThomas Veerman write_c $_OUTDIRBASE/lib/$_subdir/arch/$MACHINE_ARCH/$h \ 227c8a0e2f4SThomas Veerman <$_TMPDIR/$_PLATFORM/libstdc++-v3/include/$_PLATFORM/bits/$h 228c8a0e2f4SThomas Veerman done 229c8a0e2f4SThomas Veerman 230c8a0e2f4SThomas Veerman write_c $_OUTDIRBASE/lib/$_subdir/arch/$MACHINE_ARCH/gstdint.h \ 231c8a0e2f4SThomas Veerman <$_TMPDIR/$_PLATFORM/libstdc++-v3/include/gstdint.h 232c8a0e2f4SThomas Veerman 233c8a0e2f4SThomas Veerman { 234c8a0e2f4SThomas Veerman # libsupc++ 235c8a0e2f4SThomas Veerman getvars $_PLATFORM/libstdc++-v3/libsupc++/Makefile \ 236c8a0e2f4SThomas Veerman sources | sed 's/^G_sources=/G_LIBSUPCXX_SOURCES=/' 237c8a0e2f4SThomas Veerman getvars $_PLATFORM/libstdc++-v3/libsupc++/Makefile \ 238c8a0e2f4SThomas Veerman c_sources | sed 's/^G_c_sources=/G_LIBSUPCXX_C_SOURCES=/' 239c8a0e2f4SThomas Veerman 240*0a6a1f1dSLionel Sambuc # includes 241c8a0e2f4SThomas Veerman getvars $_PLATFORM/libstdc++-v3/include/Makefile \ 242c8a0e2f4SThomas Veerman c_base_headers std_headers | sed -e 's#/[^ ][^ ]*/##g' -e 's/\${GNUHOSTDIST}//g' 243c8a0e2f4SThomas Veerman 244*0a6a1f1dSLionel Sambuc # src 245*0a6a1f1dSLionel Sambuc getvars $_PLATFORM/libstdc++-v3/src/Makefile \ 246*0a6a1f1dSLionel Sambuc libstdc___la_SOURCES | sed 's/^G_libstdc___la_SOURCES=/G_SRC_SOURCES=/' 247*0a6a1f1dSLionel Sambuc getvars $_PLATFORM/libstdc++-v3/src/c++11/Makefile \ 248*0a6a1f1dSLionel Sambuc libc__11convenience_la_SOURCES | sed 's/^G_libc__11convenience_la_SOURCES=/G_CPP11_SOURCES=/' 249*0a6a1f1dSLionel Sambuc getvars $_PLATFORM/libstdc++-v3/src/c++98/Makefile \ 250*0a6a1f1dSLionel Sambuc libc__98convenience_la_SOURCES | sed 's/^G_libc__98convenience_la_SOURCES=/G_CPP98_SOURCES=/' 251*0a6a1f1dSLionel Sambuc getvars $_PLATFORM/libstdc++-v3/Makefile ATOMICITY_SRCDIR \ 252*0a6a1f1dSLionel Sambuc BASIC_FILE_CC CLOCALE_CC CCODECVT_CC CCOLLATE_CC \ 253*0a6a1f1dSLionel Sambuc CCTYPE_CC CMESSAGES_CC CMONEY_CC CNUMERIC_CC CTIME_CC \ 254*0a6a1f1dSLionel Sambuc CPU_OPT_BITS_RANDOM 255*0a6a1f1dSLionel Sambuc 256*0a6a1f1dSLionel Sambuc # includes 257*0a6a1f1dSLionel Sambuc getvars $_PLATFORM/libstdc++-v3/include/Makefile \ 258*0a6a1f1dSLionel Sambuc backward_headers c_base_headers_extra $_headers1 $_pb_headers | \ 259*0a6a1f1dSLionel Sambuc sed -e 's#\${GNUHOSTDIST}/libstdc++-v3/include/##g' 260*0a6a1f1dSLionel Sambuc getvars $_PLATFORM/libstdc++-v3/include/Makefile \ 261*0a6a1f1dSLionel Sambuc bits_headers ext_headers $_headers2 | \ 262*0a6a1f1dSLionel Sambuc sed -e 's#\${GNUHOSTDIST}/libstdc++-v3/include/##g' -e 's#\${GNUHOSTDIST}/libstdc++-v3/config/##g' 263*0a6a1f1dSLionel Sambuc getvars $_PLATFORM/libstdc++-v3/include/Makefile \ 264*0a6a1f1dSLionel Sambuc $_pf_headers | sed -e 's#\${GNUHOSTDIST}/libstdc++-v3/include/profile/##g' 265*0a6a1f1dSLionel Sambuc getvars $_PLATFORM/libstdc++-v3/include/Makefile \ 266*0a6a1f1dSLionel Sambuc BASIC_FILE_H ALLOCATOR_H CSTDIO_H CLOCALE_H CMESSAGES_H CTIME_H 267*0a6a1f1dSLionel Sambuc getlinks $_TMPDIR/$_PLATFORM/libgcc/config.status libgcc 268*0a6a1f1dSLionel Sambuc } | sanitise_includes \ 269*0a6a1f1dSLionel Sambuc | write_mk $_OUTDIRBASE/lib/$_subdir/arch/$MACHINE_ARCH/defs.mk 270c8a0e2f4SThomas Veerman} 271c8a0e2f4SThomas Veerman 272*0a6a1f1dSLionel Sambuc##### usr.bin/gcc* ##### 273c8a0e2f4SThomas Veerman 274d19d7d58SLionel Sambucget_gcc_bootstrap () { 275d19d7d58SLionel Sambuc _subdir="$1" 276d19d7d58SLionel Sambuc mkdir -p $_OUTDIR/usr.bin/$_subdir/arch/$MACHINE_ARCH 277*0a6a1f1dSLionel Sambuc for f in auto-host tm config; do 278d19d7d58SLionel Sambuc write_c $_OUTDIRBASE/usr.bin/$_subdir/arch/$MACHINE_ARCH/$f.h <$_TMPDIR/gcc/$f.h 279d19d7d58SLionel Sambuc done 280d19d7d58SLionel Sambuc} 281d19d7d58SLionel Sambuc 282c8a0e2f4SThomas Veermanget_gcc () { 283c8a0e2f4SThomas Veerman _subdir="$1" 284c8a0e2f4SThomas Veerman mkdir -p $_OUTDIR/usr.bin/$_subdir/arch/$MACHINE_ARCH 285c8a0e2f4SThomas Veerman mkdir -p $_OUTDIR/usr.bin/libcpp/arch/$MACHINE_ARCH 286*0a6a1f1dSLionel Sambuc mkdir -p $_OUTDIR/usr.bin/include/arch 287c8a0e2f4SThomas Veerman _buildname="BUILD_" 288c8a0e2f4SThomas Veerman _libcppsubdir="" 289c8a0e2f4SThomas Veerman _extravars="TM_H ALL_OPT_FILES" 290c8a0e2f4SThomas Veerman _hconfig_h="" 291c8a0e2f4SThomas Veerman _extravars2="tm_file_list build_xm_include_list" 292c8a0e2f4SThomas Veerman _extravars3="tm_p_include_list" 293c8a0e2f4SThomas Veerman 294c8a0e2f4SThomas Veerman { 295c8a0e2f4SThomas Veerman getvars gcc/Makefile \ 296c8a0e2f4SThomas Veerman ${_buildname}EARLY_SUPPORT ${_buildname}ERRORS ${_buildname}PRINT \ 297*0a6a1f1dSLionel Sambuc ${_buildname}RTL ${_buildname}SUPPORT ${_buildname}VARRAY \ 298*0a6a1f1dSLionel Sambuc ${_buildname}MD | \ 299c8a0e2f4SThomas Veerman sed -e 's#build/errors.o#build-errors.o#g' \ 300c8a0e2f4SThomas Veerman -e 's#build/print-rtl.o#build-print-rtl.o#g' \ 301c8a0e2f4SThomas Veerman -e 's#build/rtl.o#build-rtl.o#g' \ 302c8a0e2f4SThomas Veerman -e 's#build/varray.o#build-varray.o#g' \ 303c8a0e2f4SThomas Veerman -e 's#build/ggc-none.o#build-ggc-none.o#g' \ 304c8a0e2f4SThomas Veerman -e 's#build/##g' 305c8a0e2f4SThomas Veerman getvars gcc/Makefile \ 306c8a0e2f4SThomas Veerman ALL_CFLAGS ALL_CPPFLAGS C_AND_OBJC_OBJS C_OBJS CCCP_OBJS \ 307*0a6a1f1dSLionel Sambuc GCC_OBJS GCOV_OBJS GXX_OBJS GTM_H PROTO_OBJS ${_extravars1} \ 308c8a0e2f4SThomas Veerman INCLUDES md_file OBJC_OBJS OBJS out_file version \ 309*0a6a1f1dSLionel Sambuc BUILD_PREFIX RTL_H RTL_BASE_H TREE_H ${_hconfig_h} BASIC_BLOCK_H GCC_H \ 310c8a0e2f4SThomas Veerman GTFILES_SRCDIR GTFILES_FILES_FILES GTFILES_FILES_LANGS \ 311*0a6a1f1dSLionel Sambuc GTFILES GTFILES_LANG_DIR_NAMES NOEXCEPTION_FLAGS \ 312*0a6a1f1dSLionel Sambuc NATIVE_SYSTEM_HEADER_DIR \ 313c8a0e2f4SThomas Veerman tm_defines host_xm_file host_xm_defines tm_p_file \ 314c8a0e2f4SThomas Veerman target_cpu_default ${_extravars} ${_extravars2} \ 315c8a0e2f4SThomas Veerman lang_specs_files ${_extravars3} \ 316*0a6a1f1dSLionel Sambuc common_out_file \ 31784d9c625SLionel Sambuc | sanitise_includes 318c8a0e2f4SThomas Veerman getvars gcc/Makefile \ 319c8a0e2f4SThomas Veerman LIB2ADDEHDEP | sed 's/unwind.inc//' 320c8a0e2f4SThomas Veerman getvars gcc/Makefile \ 321c8a0e2f4SThomas Veerman CXX_OBJS CXX_C_OBJS | sed 's/cp\///g' 322c8a0e2f4SThomas Veerman getvars gcc/Makefile \ 323c8a0e2f4SThomas Veerman F77_OBJS | sed 's/f\///g' 324c8a0e2f4SThomas Veerman getvars libcpp/Makefile \ 325c8a0e2f4SThomas Veerman libcpp_a_OBJS 326c8a0e2f4SThomas Veerman getvars gcc/Makefile \ 327c8a0e2f4SThomas Veerman ENABLE_SHARED 328c8a0e2f4SThomas Veerman echo G_SHLIB_LINK="$CC -shared" 329c8a0e2f4SThomas Veerman echo G_SHLIB_MULTILIB=. 330c8a0e2f4SThomas Veerman } | write_mk $_OUTDIRBASE/usr.bin/$_subdir/arch/$MACHINE_ARCH/defs.mk 331c8a0e2f4SThomas Veerman 332*0a6a1f1dSLionel Sambuc getvars gcc/Makefile \ 333*0a6a1f1dSLionel Sambuc EXTRA_HEADERS \ 334*0a6a1f1dSLionel Sambuc | write_mk $_OUTDIRBASE/usr.bin/include/arch/$MACHINE_ARCH.mk 335*0a6a1f1dSLionel Sambuc 336c8a0e2f4SThomas Veerman write_c $_OUTDIRBASE/usr.bin/libcpp/arch/$MACHINE_ARCH/config.h <$_TMPDIR/libcpp/config.h 337*0a6a1f1dSLionel Sambuc hfiles='auto-host configargs config bconfig bversion plugin-version multilib tm' 338c8a0e2f4SThomas Veerman for f in $hfiles; do 339c8a0e2f4SThomas Veerman write_c $_OUTDIRBASE/usr.bin/$_subdir/arch/$MACHINE_ARCH/$f.h <$_TMPDIR/gcc/$f.h 340c8a0e2f4SThomas Veerman if [ "${MACHINE_ARCH}" = "powerpc" -a "${f}" = "configargs" ] 341c8a0e2f4SThomas Veerman then 342*0a6a1f1dSLionel Sambuc ex <<__EOF__ $_OUTDIR/usr.bin/$_subdir/arch/$MACHINE_ARCH/$f.h 343c8a0e2f4SThomas Veerman/configuration_arguments/ s/$// 344c8a0e2f4SThomas Veermanya 345c8a0e2f4SThomas Veermani 346c8a0e2f4SThomas Veerman#ifdef _SOFT_FLOAT 347c8a0e2f4SThomas Veerman. 348c8a0e2f4SThomas Veermanpu 349c8a0e2f4SThomas Veermans/";$/ -with-float=soft";/ 350c8a0e2f4SThomas Veermana 351c8a0e2f4SThomas Veerman#else 352c8a0e2f4SThomas Veerman#endif 353c8a0e2f4SThomas Veerman. 354c8a0e2f4SThomas Veerman. m +1 355c8a0e2f4SThomas Veerman/configure_default_options/ s/{ NULL.*$// 356c8a0e2f4SThomas Veermana 357c8a0e2f4SThomas Veerman#ifdef _SOFT_FLOAT 358c8a0e2f4SThomas Veerman { "float", "soft" }, 359c8a0e2f4SThomas Veerman#endif 360c8a0e2f4SThomas Veerman { NULL, NULL } 361c8a0e2f4SThomas Veerman}; 362c8a0e2f4SThomas Veerman. 363c8a0e2f4SThomas Veermanwq 364c8a0e2f4SThomas Veerman__EOF__ 365c8a0e2f4SThomas Veerman fi 366*0a6a1f1dSLionel Sambuc if [ "${f}" = "configargs" ] 367*0a6a1f1dSLionel Sambuc then 368*0a6a1f1dSLionel Sambuc _srcquoted=$(echo "$_SRC" | sed 's/\//\\\//g') 369*0a6a1f1dSLionel Sambuc ex <<__EOF__ $_OUTDIR/usr.bin/$_subdir/arch/$MACHINE_ARCH/$f.h 370*0a6a1f1dSLionel Sambuc/static const char configuration_arguments/ s/$_srcquoted/\/usr\/src/g 371*0a6a1f1dSLionel Sambucwq 372*0a6a1f1dSLionel Sambuc__EOF__ 373*0a6a1f1dSLionel Sambuc fi 374c8a0e2f4SThomas Veerman done 375c8a0e2f4SThomas Veerman 376c8a0e2f4SThomas Veerman # keep identical 377c8a0e2f4SThomas Veerman for f in all-tree.def; do 378c8a0e2f4SThomas Veerman cp $_TMPDIR/gcc/$f $_OUTDIR/usr.bin/$_subdir/arch/$MACHINE_ARCH/$f 379c8a0e2f4SThomas Veerman done 380c8a0e2f4SThomas Veerman 381c8a0e2f4SThomas Veerman # special transforms 382c8a0e2f4SThomas Veerman for f in gtyp-input.list; do 383c8a0e2f4SThomas Veerman sed -e 's/^.*external\/gpl3\/gcc\/dist/SRCDIR/' < $_TMPDIR/gcc/$f > $_OUTDIR/usr.bin/$_subdir/arch/$MACHINE_ARCH/$f 384c8a0e2f4SThomas Veerman done 385c8a0e2f4SThomas Veerman 386c8a0e2f4SThomas Veerman # special platforms 387c8a0e2f4SThomas Veerman if [ "${MACHINE_ARCH}" = "sh3el" -o "${MACHINE_ARCH}" = "sh3eb" ]; then 388c8a0e2f4SThomas Veerman write_c $_OUTDIRBASE/usr.bin/$_subdir/arch/$MACHINE_ARCH/sysroot-suffix.h <$_TMPDIR/gcc/sysroot-suffix.h 389c8a0e2f4SThomas Veerman fi 390c8a0e2f4SThomas Veerman} 391c8a0e2f4SThomas Veerman 392c8a0e2f4SThomas Veerman##### main ##### 393c8a0e2f4SThomas Veerman 394c8a0e2f4SThomas Veermancase "$1" in 395c8a0e2f4SThomas Veerman# .mk and .h files for libgcc bootstrap (from host build) 396c8a0e2f4SThomas Veerman 397*0a6a1f1dSLionel Sambuclibgcc*-bootstrap) 398c8a0e2f4SThomas Veerman _OUTDIR="$_TOP/external/gpl3/gcc" 399c8a0e2f4SThomas Veerman _OUTDIRBASE="external/gpl3/gcc" 400c8a0e2f4SThomas Veerman get_libgcc gcc 401*0a6a1f1dSLionel Sambuc get_libgcov gcc $_PLATFORM/libgcc/Makefile 402c8a0e2f4SThomas Veerman get_crtstuff crtstuff 403d19d7d58SLionel Sambuc get_gcc_bootstrap gcc 404c8a0e2f4SThomas Veerman exit 0 405c8a0e2f4SThomas Veerman ;; 406c8a0e2f4SThomas Veerman 407*0a6a1f1dSLionel Sambuclibstdc++-bootstrap) 408*0a6a1f1dSLionel Sambuc _OUTDIR="$_TOP/external/gpl3/gcc" 409*0a6a1f1dSLionel Sambuc _OUTDIRBASE="external/gpl3/gcc" 410*0a6a1f1dSLionel Sambuc get_libstdcxx_v3 libstdc++-v3 gcc 411c8a0e2f4SThomas Veerman exit 0 412c8a0e2f4SThomas Veerman ;; 413c8a0e2f4SThomas Veerman 414*0a6a1f1dSLionel Sambucgcc*) 415c8a0e2f4SThomas Veerman _OUTDIR="$_TOP/external/gpl3/gcc" 416c8a0e2f4SThomas Veerman _OUTDIRBASE="external/gpl3/gcc" 417c8a0e2f4SThomas Veerman get_gcc gcc 418c8a0e2f4SThomas Veerman get_libgcc gcc 419*0a6a1f1dSLionel Sambuc get_libgcov gcc $_PLATFORM/libgcc/Makefile 420c8a0e2f4SThomas Veerman get_crtstuff crtstuff 421c8a0e2f4SThomas Veerman get_gcc_libiberty gcc 422c8a0e2f4SThomas Veerman get_libobjc libobjc 423*0a6a1f1dSLionel Sambuc get_libstdcxx_v3 libstdc++-v3 gcc 424c8a0e2f4SThomas Veerman get_libdecnumber libdecnumber 425c8a0e2f4SThomas Veerman get_libgomp libgomp 426*0a6a1f1dSLionel Sambuc get_libbacktrace libbacktrace 427c8a0e2f4SThomas Veerman exit 0 428c8a0e2f4SThomas Veerman ;; 429c8a0e2f4SThomas Veerman 430c8a0e2f4SThomas Veerman 431*0a6a1f1dSLionel Sambuc*) 432*0a6a1f1dSLionel Sambuc echo invalid arguments; 433*0a6a1f1dSLionel Sambuc exit 1 434*0a6a1f1dSLionel Sambuc ;; 435c8a0e2f4SThomas Veermanesac 436