|
![]() ![]() |
![]() |
|
![]() ![]() ![]() ![]() ![]() ![]() ![]() |
![]() |
![]() |
![]() |
Tech Jobs | Linux FAQs | Forum | Articles |
![]() |
O'Reilly's Emerging Technology Conference: May 13-16, 2002 | ![]() |
![]() |
![]() ![]()
|
![]() |
![]()
Introduction to Makeby Jennifer Vesperman01/31/2002 Make originated as a system for building compiled code. It is now used as a system for making changes across many files and directories. It is useful whenever a change in one file requires changes or actions elsewhere.
Running MakeMake requires a configuration file. Once this file is constructed for your project, you usually type The usual name for this file is When run with no arguments, GNU Make looks for the configuration files named The makefile in this example displays
Simple MakefilesThe examples in this article are written for C, and produce the Experienced users of Make will see redundant lines in the example makefile. Make already knows how to compile some types of files, and the rules for those files can be left out. (These are called
A Make rule is composed of:
A target is considered "up to date" if it exists and is newer than its prerequisites. Make works backwards, starting with the target of the first rule in the file. In our example, that's Make walks down the recursion chain until it finds a target that has no prerequisites, or whose prerequisites have no rules. Once it hits one of those, it walks back up its recursion chain and runs commands as necessary. It creates a recursion chain for every prerequisite it encounters that has a rule. Once all of the prerequisite rules have been run, it eventually returns to In the example makefile, Make:
Make can run the prerequisites in any order. The important part of this sequence is that it runs recursively backwards from the first target (or the target named in the command parameters), and tests only the rules that it encounters in the prerequisites chain. Make aborts compilation if it receives an error. This is usually useful behavior -- it lets you correct compiler-detected problems during a compile-and-test cycle. The option
![]() ![]() |
![]() |
Sponsored by:
![]() |
![]() |
|
![]() ![]() ![]() ![]() ![]() |
|
![]() |
|
![]() |
|
Copyright © 2000-2002 O'Reilly & Associates, Inc. All Rights Reserved. All trademarks and registered trademarks appearing on the O'Reilly Network are the property of their respective owners. For problems or assistance with this site, email help@oreillynet.com |
![]() |
|