Many users may prefer to install the ready-to-use MAME package. If you are interested how MAME works, if you want to contribute to its development, try to fix a bug, or suggest a useful extension, you should consider installing the MAME sources and building MAME.
If you are not so familiar with building, this may sound rather complicated, and you probably doubt that you can safely get to the desired end. Or you do have some experience in building software from sources, but all you remember was that at some time compilation stopped with a long error text that you could not make sense of from the second line.
However, MAME sources show a very high quality, that is, they actually compile to completion, and there are only very few compiler warnings (mostly from the imported 3rd-party libraries). With the following instructions, you should be able to successfully build MAME and to run it on your computer. Even if you do not plan to write own code, you will enjoy building MAME, because you always have access to the latest changes, so you do not have to wait for the next release.