Solved

What is a makefile?

Posted on 1998-10-06
4
267 Views
Last Modified: 2010-05-18
What is a "makefile?"  For 100 points, I'd like a fairly comprehensive and complete answer.
0
Comment
Question by:Raydot
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 3

Author Comment

by:Raydot
ID: 1174533
Edited text of question
0
 
LVL 8

Accepted Solution

by:
Answers2000 earned 100 total points
ID: 1174534
A make file is a set of instructions (usually ASCII Text) to build a program

Typically a program is made of many different source code modules, each stored in a separate source code file (e.g. with extension .cpp or .h)

You can compile each intermediate file into an "object" which is machine code plus X

X is the information needed to join all the objects together into one program (information for the linker)

The linker then takes all the objects, add's any runtime code, and joins them up into the output file (typically .EXE extension in DOS/Windows)

Each stage (compiling _each_ object & linking all objects) can be invoked from the command line.

Figuring out how to do each stage, and when to recompile each object is a hard task for humans in a large project which may contain many modules.

A make file automates this process.

Basically you list which objects are built from which source file (dependencies) and how to build each object.  You do the same for the link stage (which objects are linked into which program).


The make utility reads the dependencies, figures out which items need to be rebuilt (for example you changed the source code of a module after the last time it was built) and automates the process by executing the appropriate set of commands.

Additionally make files can automate the process of building many output files (large projects often consist of suites of EXEs) and other similar tasks.

Make files are normally used in program development, but can also be used in other tasks where output files need to be generated (e.g. system admin).

Finally most modern Windows compilers come with automated make/build tools, so in many cases manual creation of a make file is not necessary.
0
 
LVL 22

Expert Comment

by:nietod
ID: 1174535
Answers beat me to it but here is what i had.


A make file is a text file that contains the commands and settings that are used to create a project (program, dll, library etc.)
It contains commands used to run the  compiler and linker and possibly other utilities and all sorts of options to be passed to them.  It often contains dependancy information.  This is stuff that says that fileX depends on fileY, thus if fileY is changed, then fileX must be rebuilt etc.

This is not a standard/universal C++ topic.  Some c++ development systesm support makefiles, others do not.  In addditon, the syntax of the files is not standardized, thus you cannot ussually copy them from one system to another.
0
 
LVL 3

Author Comment

by:Raydot
ID: 1174536
That was pretty darn thorough...

Thanks,

Raydot.
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In days of old, returning something by value from a function in C++ was necessarily avoided because it would, invariably, involve one or even two copies of the object being created and potentially costly calls to a copy-constructor and destructor. A…
Introduction This article is the first in a series of articles about the C/C++ Visual Studio Express debugger.  It provides a quick start guide in using the debugger. Part 2 focuses on additional topics in breakpoints.  Lastly, Part 3 focuses on th…
The viewer will learn how to user default arguments when defining functions. This method of defining functions will be contrasted with the non-default-argument of defining functions.
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.

688 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question