Just a small tip. I have souced and makefile on remote machine and I’m trying to compile it on my local machine, but I don’t have the compiler and environment. So when I run “M-x compile“, I use a build_remote.sh script with following contents
#!/bin/bash ssh my_remote_machine "source my_environment_file; cd my_build_directory; make my_target"
ssh command are executed not in your common environment, so you have to import it before execution of main commands (I use source command with some script to configure environment)
*compilation* buffer would receive stdout from remote make and you even would be able to navigate through compiler errors in your local code (if you have correct paths)