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

make install DESTDIR=$TmpInstDir

if [ "x$NOSTRIP" != "xNOSTRIP" ]; then
	allFiles=`find ${TmpInstDir}/usr/bin/ -type f | xargs echo`
	for files in $allFiles; do
		elfFile=`file $files | grep -i elf`;
		if [ -n "$elfFile" ]; then
			$STRIP $files
		fi
	done
fi

# remove .a files
find ${TmpInstDir}/usr/lib/ -type f -name "*.a" -exec rm {} \;
# remove .la files
find ${TmpInstDir}/usr/lib/ -type f -name "*.la" -exec rm {} \;

rmdir ${TmpInstDir}/usr/lib/

rm -rf $TmpInstDir/usr/share
