What is a makefile and how do I use it?
-
12Did you think to look on e.g. Wikipedia? – Oliver Charlesworth Feb 13 '11 at 18:16
-
1Shameless selfplug and kinda-sorta possible duplicate: http://stackoverflow.com/questions/2481269/how-to-make-simple-c-makefile/2481326#2481326 . – dmckee --- ex-moderator kitten Feb 13 '11 at 18:29
2 Answers
A make file describes the compilation process. It describes which flags, compiler tools, linkers, etc. to use with which source code files and objects
More info http://www.sis.pitt.edu/~mbsclass/tutorial/advanced/makefile/

- 3,096
- 3
- 20
- 25
-
2It's used mostly for that, but is not necessary should be the compilation process - many tasks may be automated using `make` – asciz Feb 13 '11 at 18:18
The main purpose of a Makefile is to store every you need to build your project in one place. It contains the instructions for compiling your code, linking your compiled code, packaging the executables, extracting third party tools, and many other useful things. Pretty much any command you entire at the command line can be used in a makefile.
The advantage to using a makefile, when done correctly at least, is that anyone can easily build your entire project. It's as easy as typing make
An example of a Makefile for a windows project http://www.opussoftware.com/tutorial/TutMakefile.htm

- 573
- 2
- 8