#!/bin/sh

source ../Config.sh

[ "$PP_BUILD_TYPE" != "dmalloc" ] && exit 0

PP_PUBLIC_INCLUDES="dmalloc.h"

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

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

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

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

pp_do "$@"
