Sunday, Nov 18th

Last update12:59:40 PM GMT

What are makefiles? Why are they used?

Write e-mail

Make is a Unix utility (a command) designed to start the execution of a makefile. A makefile is a special file, containing shell commands, that you create and name 'makefile' (or 'Makefile' depending upon the system and its case priorities). When you are in the directory containing this makefile, and you type make, the commands in the makefile will be executed. If you create more than one makefile, you should be sure to be in the correct directory before typing make.

argaiv1879

Make keeps track of the last time files (normally object files) which were updated and only updates those files which are required (the ones which have changed) to keep the sourcefile up-to-date. If you have a large program with many source and/or header files, when you change a file on which others depend, you must recompile all the dependent files. Without a makefile, this is an extremely time-consuming task.

As a makefile is a list of shell commands, it must be written for the shell which will process the makefile. A makefile that works well in one shell may not execute properly in another shell.

Share this post



Web Hosting