Solved

What is a makefile?

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

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Focus not getting shifted out of  editbox 2 62
is twain_32.dll cmpatible with windows 10 ? 10 162
Unable to start eclipse ? 17 141
Copy output image from TWindowsMediaPlayer 6 41
  Included as part of the C++ Standard Template Library (STL) is a collection of generic containers. Each of these containers serves a different purpose and has different pros and cons. It is often difficult to decide which container to use and …
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 clear a vector as well as how to detect empty vectors in C++.

770 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