Customize Emacs compile

At work, I use M-x compile to build the project I'm working on. Chances are that default compile-command is not what you want. You can customize it and bind it to hotkeys as follows, 
Now, you can use F8, F9 to build the optimized and debug version.