As far as I know, there's no r-mode in Emacs. Instead, you're probably using ESS's support for R, whose major mode is called ess-r-mode IIRC, so you'd want to use ess-r-mode-hook. But as @phils said: check the value of major-mode to be sure.
Your command cd /ssh:desktop:/home/user/project/Release && make will be given to a shell on the remote machine. This doesn't know any Tramp syntax, and it runs already on the proper host. So you shall use the command cd /home/user/project/Release && make instead.
Try customizing (or binding) compilation-ask-about-save to nil. C-h v tells you:
compilation-ask-about-save is a variable defined in compile.el.
Its value is t
Non-nil means M-x compile asks which buffers to save before compiling.
Otherwise, it saves all modified buffers without asking.
You can customize this variable.
If you want to just ...
Emacs' configure uses pkg-config to search for HarfBuzz, so you need to ensure that your PKG_CONFIG_PATH points at the pkconfig directory for your new installation of HarfBuzz (this is true for a lot of other packages that Emacs tries to use)
(set (make-local-variable 'compile-command)
The latter compile-command is evaluated after (make-local-variable 'compile-command) so this should be a no-op -- you're making the variable buffer-local, and then setting the buffer-local value to whatever the buffer-local value already was.
I'm unsure what you are wanting to happen here, ...
The problem arises because the M-x compile command uses the dumb terminal type and invokes .cshrc before running the command make -k. My .cshrc loads modules with the module command. The module command uses a pager which does not work properly with the dumb terminal type. The solution is to include the following in the .cshrc before the module command. The ...
This is a solution which searches up the parent directories for common build system filenames, and runs the appropriate build-command.
Posting here since it works, although better methods may exist.
(defun my-compile-context-sensitive--locate-dominating-file-multi (dir compilation-filenames)
"Search for the compilation file traversing up the directory ...
You could use projectile-test-project (bound to C-p p P) as your debug command and projectile-compile-project (bound to C-p p c) as your release command.
projectile-toggle-between-implementation-and-test (bound to C-p p t) also seems promising but I haven't used this yet, so I can't help you set this up.