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

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

NFSDebIncludeDir=$DebDevDir/$SysRootInclude/nfs

mkdir -p $NFSDebIncludeDir

cp -rf support/include/* $NFSDebIncludeDir/
rm -f $NFSDebIncludeDir/mount.h
rm -f $NFSDebIncludeDir/sm_inter.h
rm -f $NFSDebIncludeDir/stamp-h1
find $NFSDebIncludeDir -name "*.in" | xargs rm -f
find $NFSDebIncludeDir -name "Makefile*" | xargs rm -f
cp -f support/export/mount.h $NFSDebIncludeDir/
cp -f support/nsm/sm_inter.h $NFSDebIncludeDir/

cd support/nfsidmap
make DESTDIR="$DebDevDir" install $InstallDevLayout
cd -

# Remove document file
rm -rf ${DebDevDir}${SynoDir}/share/

# Remove .la file
find ${DebDevDir}${SynoDir} -name "*.la" | xargs rm

cd synology
make INSTALLDIR="${DebDevDir}" install $InstallDevLayout
