#!/bin/sh -e

mkdir -p "$1/usr/bin/"

sed -i 's/.*strip.*//g' Makefile
sed -i 's/.*(tar cf -.*//g' Makefile

make all install DESTDIR="$1" PREFIX="$1/usr"

#Fix the location of the manual
mv "$1/usr/man" "$1/usr/share/man/"

# Install the online help files.
rm -rf "$1/usr/share/s9fes/help"
mv help "$1/usr/share/s9fes/"

printf "\nPlease remember to set your S9FES_LIBRARY_PATH and S9FES_IMAGE_DIR to /usr/share/s9fes!\n"
