#!/bin/bash
# Copyright (c) 2000-2015 Synology Inc. All rights reserved.

case ${MakeClean} in
	[Yy][Ee][Ss])
		make distclean
		;;
esac

case ${CleanOnly} in
	[Yy][Ee][Ss])
		return
		;;
esac

SYNO_DEFINE="-DSYNO_QUITE_SYNC"

NTP_CONFIGURE="
	--prefix=/usr \
	--libdir=/usr/local/etc \
	--with-logfilebase=/var/log \
	--with-lockdir=/var/run \
	--with-piddir=/var/run \
	--with-yielding-select=yes \
	--enable-linuxcaps \
	--enable-ntp-signd \
	--without-net-snmp-config \
	--without-ntpsnmpd \
	--without-sntp \
	"
if checkPlatformFunction SYNO_FEA_NON_SUPPORT_NTPD_CLIENT; then
	NTP_CONFIGURE+=" ntp_cv_var_kernel_pll=no"
fi

ln -s /usr/bin/true makeinfo
export PATH=${PWD}:${PATH}

export PKG_CONFIG_PATH="${SysRootLib}/openssl-3/pkgconfig:${PKG_CONFIG_PATH}"

env CC="${CC}" LD="${LD}" AR=${AR} STRIP=${STRIP} RANLIB=${RANLIB} NM=${NM} \
	CFLAGS="${CFLAGS} $SYNO_XTRACFLAGS ${SYNO_DEFINE} -fPIC -DPIC" \
	LDFLAGS="${LDFLAGS} $SYNO_XTRALDFLAGS -lattr" \
	LIBS="${LDFLAGS} $SYNO_XTRALDFLAGS" \
	./configure ${ConfigOpt} ${NTP_CONFIGURE}

make ${MAKE_FLAGS}

