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


case "${MakeClean}" in
	[Yy][Ee][Ss])
		[ -f "Makefile" ] && make distclean
		;;
esac

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


ConfigOpt="$ConfigOpt --prefix=/usr --sysconfdir=/usr/syno/etc"
env CC="${CC}" LD="${LD}" AR="${AR}" STRIP="${STRIP}" RANLIB="${RANLIB}" NM="${NM}" CXX="${CXX}" \
	CFLAGS="-DSYNO -I./ -I../ -I./include -I../include -I../../include -I../../../include ${CFLAGS}" \
	LDFLAGS="${LDFLAGS}" \
	LIBS="-lsasl2 -lcrypto -lssl -ldl -lsynocore -lsynosdk -lsynotls" \
	CPPFLAGS="-DURANDOM_DEVICE=\\\"/dev/urandom\\\" -I./ -I../ -I./include -I../include -I../../include -P" \
	./configure ${ConfigOpt} \
		--with-threads \
		--enable-debug \
		--enable-syslog \
		--with-cyrus-sasl \
		--with-tls \
		--enable-crypt \
		--enable-lmpasswd \
		--enable-spasswd \
		--with-yielding-select=yes \
		--enable-overlays \
		--enable-ldap \
		--enable-modules \
		--enable-hdb=no \
		--enable-mdb=no \
		--enable-shell \
		--enable-synototp \
		--enable-sock=yes \
		--enable-static

echo "make depend"
make depend
echo "make"
make ${MAKE_FLAGS}

# make synoppolicychecker
make -C synoppolicychecker ${MAKE_FLAGS}


# vim:ft=sh
