

So let’s assume that you have the directory structure as described above.

The makefile specifies rules that Make will follow when generating intermediate files. Make uses makefiles (a file at the root directory of your project called makefile) to build your project.

Src/: The subdirectory that will contain all you source files ( *.h, *.hpp, *.c, *.cpp, etc.)īin/: This is the subdirectory where the compiler will create the binary files and the final executable. Makefile: The makefile that will be described below project/home/dir/: This is the home directory of your project. This is usually also the way how IDEs like Eclipse organize the project files. I prefer separating source files and binary files into their own directories. On Windows, again, one can install it through Cygwin… Cygwin will also supply the GCC toolchain. All commands described below assume that you are using the bash shell, which is the default shell on Linux/OS X. For one thing, GNU Make is not installed by default, so you will have to install it yourself. On Windows things are a little bit more complicated. I am assuming that you are using Linux or Mac OS X. Jump directly to the makefile if you are not interested in the explanation. This is a short, quick introduction to using GNU Make to automatically build your C/C++ project’s executable. Quick introduction to GNU Make Quick introduction to GNU Make Norbert Pozar
