Variable: compile-command

Last shell command used to do a compilation; default for next compilation.

Sometimes it is useful for files to supply local values for this variable.
You might also use mode hooks to specify it in certain modes, like this:

(add-hook 'c-mode-hook
(lambda ()
(unless (or (file-exists-p "makefile")
(file-exists-p "Makefile"))
(set (make-local-variable 'compile-command)
(concat "make -k "
(file-name-sans-extension buffer-file-name))))))