#!/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_build_local () {
    # force configure
    if [ "$PP_FORCE_FULL_BUILD" = "1" ]; then
	rm -f Makefile
    fi

    # some variables for configure/make
    export CFLAGS="$FW_CFLAGS_3RDPARTY -D_BSD_SOURCE"

    # configure
    if [ ! -f Makefile ]; then
	echo "Running configure ..."
	./configure \
		--host="$HOST_SYSTEM" \
		--prefix=/ \
		--enable-static \
		--disable-shared \
		--enable-ipv6 \
		--with-pcap=linux
     fi

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

pp_do "$@"
