#!/bin/sh

source ../Config.sh

# This is a debug tool: Do not build it for a final firmware
[ "$PP_BUILD_TYPE" = "final" ] && exit 0

pp_clean_local () {
    pp_clean_default
    # force autoreconf
    rm -f configure
}

pp_build_local () {
    # force configure
    if [ ! -f configure -o "$PP_FORCE_FULL_BUILD" = "1" ]; then
	echo "Running autoreconf ..."
	autoreconf -f -i
	rm -f Makefile
    fi

    # configure
    if [ ! -f Makefile ]; then
	echo "Running configure ..."
	./configure \
		--host=${HOST_SYSTEM} \
		--prefix=/ \
		--bindir=/bin.debug
    fi

    # make / install
    echo "Running make ..."
    make all install
}

pp_do "$@"
