[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

What is a makefile?

Posted on 1998-10-06
4
Medium Priority
?
271 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 400 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

When writing generic code, using template meta-programming techniques, it is sometimes useful to know if a type is convertible to another type. A good example of when this might be is if you are writing diagnostic instrumentation for code to generat…
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 …
The viewer will learn how to use the return statement in functions in C++. The video will also teach the user how to pass data to a function and have the function return data back for further processing.
The viewer will be introduced to the member functions push_back and pop_back of the vector class. The video will teach the difference between the two as well as how to use each one along with its functionality.
Suggested Courses

834 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