There is already an entry ("[Mm]akefile\\'" . makefile-gmake-mode)
in auto-mode-alist
.
(I figure that you actually wanted to delete the end \\'
of the regular expression.)
The entry for xinit
shows how to handle the beginning of a file name:
("\\(/\\|\\`\\)\\.\\([kz]shenv\\|xinitrc\\|startxrc\\|xsession\\)\\'" . sh-mode)
The main aspect here is that your regular expression must match the full absolute path of the file sans backup-suffixes and remote-file identifications.
So I propose you use something like
(add-to-list 'auto-mode-alist '("\\(/\\|\\`\\)[Mm]akefile" . makefile-gmake-mode))
You don't need to care about the existing entry for makefiles since the first matching entry is used.
If you really want to replace the existing entry even if this is not required you can also use the following statement:
(setcar (assoc-string "[Mm]akefile\\'" auto-mode-alist) "\\(/\\|\\`\\)[Mm]akefile")
Or if you are afraid that the default entry disappears some time in the future you can act in dependence of its existence in auto-mode-alist
:
(let ((existing-entry (assoc-string "[Mm]akefile\\'" auto-mode-alist)))
(if existing-entry (setcar existing-entry "\\(/\\|\\`\\)[Mm]akefile")
(add-to-list 'auto-mode-alist '("\\(/\\|\\`\\)[Mm]akefile" . makefile-gmake-mode))))