Solved

What is a makefile?

Posted on 1998-10-06
4
266 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: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering 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

Suggested Solutions

This article shows you how to optimize memory allocations in C++ using placement new. Applicable especially to usecases dealing with creation of large number of objects. A brief on problem: Lets take example problem for simplicity: - I have a G…
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 goal of the video will be to teach the user the concept of local variables and scope. An example of a locally defined variable will be given as well as an explanation of what scope is in C++. The local variable and concept of scope will be relat…
The viewer will be introduced to the technique of using vectors in C++. The video will cover how to define a vector, store values in the vector and retrieve data from the values stored in the vector.

738 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