Solved

What is a makefile?

Posted on 1998-10-06
4
261 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
  • 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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Introduction This article is a continuation of the C/C++ Visual Studio Express debugger series. Part 1 provided a quick start guide in using the debugger. Part 2 focused on additional topics in breakpoints. As your assignments become a little more …
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
The viewer will learn how to pass data into a function in C++. This is one step further in using functions. Instead of only printing text onto the console, the function will be able to perform calculations with argumentents given by the user.
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.

743 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now