Question

I'm having difficulties understanding the structure of a Makefile. Can you point me to a good resource to look at?

Was it helpful?

Solution

The best tutorial that I have found for makefiles so far has been this one. One of your other options is to learn autotools and let them produce your makefiles for you, though a little outdated this is the tutorial that I found best to learn from.

OTHER TIPS

You could also use this tutorial by example. It provides very easy examples that will work for simple projects.

This is all you need: make

While it is well and good that you learn how to read and write a Makefile, I strongly recommend that you use CMake for your C/C++ builds instead of writing your own Makefile. It is very difficult to craft a portable Makefile, which is why the C++ community shifted from hand-crafted makefiles to using the GNU Autotools (Automake, Autoconf, Autoheader, Autoreconf, Libtool, etc.).However, the extreme complexity of the GNU Autotools left much to be desired, resulting in the creation of CMake, which is quickly becoming the build tool of choice for the C/C++ community. It has already been adopted by a growing list of projects, including KDE.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top