# --- SDE-COPYRIGHT-NOTE-BEGIN ---
# This copyright note is auto-generated by ./scripts/Create-CopyPatch.
#
# Filename: package/.../uclibc++/uclibc++.conf
# Copyright (C) 2006 The T2 SDE Project
#
# More information can be found in the files COPYING and README.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; version 2 of the License. A copy of the
# GNU General Public License can be found in the file COPYING.
# --- SDE-COPYRIGHT-NOTE-END ---

runconf=0

. $base/package/*/uclibc/functions.in

hook_add premake 1 'auto_config 2'

var_append makeinstopt ' ' "PREFIX=$root"

var_append conffiles ' ' $confdir/clean_arch.config

var_append conffiles ' ' $builddir/.config
hook_add preconf 3 "default_config > $builddir/.config"

default_config()
{
	# TARGET_ARCH (a bit messy due to uclibc's sh5 / sh64 handling ...)
	cpu=`echo $arch | arch2uname`
	arch=`echo $cpu | sed -e s/sh64/sh/ -e s/ppc/powerpc/`
	echo "X TARGET_$arch"
	echo "X TARGET_ARCH \"$cpu\""

	if [ "$arch_bigendian" = "yes" ]; then
		echo "X ARCH_BIG_ENDIAN"
	else
		echo "X ARCH_LITTLE_ENDIAN"
	fi

	if [ "$SDECFG_STATIC" = 1 ]; then
		echo "X BUILD_STATIC_LIB"
		echo "X BUILD_ONLY_STATIC_LIB"
	fi

	echo "O UCLIBCXX_EXCEPTION_SUPPORT"
}


# save .config file for the future
hook_add postmake 9 'cp -v .config $root/$docdir'