One solution is to use
sudo instead of
su to change to root to run the install.
sudo takes the user's password instead of the root password. It can also be configured to allow specific users. It also has command line options to read the password from stdin and display no prompt.
echo $password | sudo -S -p '' "make install"
The password can be stored in the script. Or entered once in the top of script.