View Full Version : a question about make files


Alt+Ctrl+Del
al salam 3alaykom

i have newly started c programming on linux /unix platforms and i have found alot of tutorials talking about make files as if it is something normally known !!!

can any body tell me what make files are

how to create/use them

and why arent they common in windows programming

thnx

alaa
Makefiles are used to automate the process of constructing files from information in other sources (like making executables by compiling source code or generating PDFs by compiling LaTeX files etc.)

basically a makefile defines some rules and make acts out these rules.
rules can have dependencies, dependencies are either other make rules or just files.

make checks to see if any dependency changed since the last time it was run, this way it only rebuilds the rules that realy need rebuilding, this is very useful for large software/documentation projects so if you change one part of the system you don't need to recompile everything else, just the parts that depend on that change.

for example if file foo.cc includes header foo.hh then we want to tell make to recompile foo.cc whenever foo.hh changes (this is a file dependency)
now lets say that you have a component fu that needs to link to foo, you want to tell make that the rule for fu only works if the rule for foo has been run and that if foo changes fu has to be recompiled (this is a rule dependency).

in short Makefiles do the job of project files used in most IDE's.

make is used in windows many windows compilers come with a version of make, I think even M$V$ (but I'm not sure how its syntax differs from GNU Make).

basic Makefiles are very easy to use, if you plan on working or larger systems you should learn GNU automake and GNU autoconf, these tools help you build sophisticated Makefiles that allows your software to build in many environments (helps you achieve portability), instruct the user on any missing dpendencies, and make software more manageable (they offer a standard way to install, uninstall, etc. software).

run
info make

and read the GNU Make manual

cheers,
Alaa

MaherG
http://users.actcom.co.il/~choo/lupg/tutorials/writing-makefiles/writing-makefiles.html

Maher

OneOfOne
if you want to save your self the time to learn how to deal with Makefiles and want a powerful all-in-one gui like vistualstudio get kdevelop (www.kdevelop.org).
ps: get the unstable version, it's stable enough.
peace