Compiling Fortran Programs the linux development platform 2003
15. Bob Nevlen, Linux Assembly Language Programming ISBN 0-13-0877940-1, Prentice
Hall PTR 2000.16. Oberon Home page at http:www.oberon.ethz.ch 17. Ruby Home Page at http:www.ruby-lang.orgen
101 C H A P T E R 4 Using GNU make ll serious software projects are built in pieces by many developers. These pieces consist of source code and header files, libraries and different tools. To combine these pieces into a product is a process com- monly known as a build. The GNU make utility is one of the many avail- able utilities used to build these software projects. Large software projects often have hundreds and even thousands of files. Compiling these files and linking them into final executable product files is done by a careful and well-defined automated process. This automated process, also known as the software build process, is controlled by the make utility through makefiles. The make utility reads one or more of these makefiles contain- ing information about how to build a project. Makefiles contain different types of information, including variables, control structures and rules to compile and link source files, build libraries and so on. In the most com- mon makefiles, rules are present to remove object and executable files from the source code directory to clean it up, if required. These rules are enforced based upon time stamps on different files. For example, if an existing object file is newer than the corresponding source code file, it is not recompiled. However if the object file is older than the source file, it shows that someone modified the source file after the object file was last built. In such a case, make detects it and rebuilds the object file. Depend- ing upon the requirements of a project, someone can create different types of rules and commands to build software projects. A 102 Chapter 4 • Using GNU make This chapter contains information on how to write makefiles for software projects and provides sufficient information for a reader to write make- files for fairly complex projects. You can also refer to the reference at the end of this chapter for more comprehensive information about the make utility. To demonstrate the use of make , several examples are presented in this chapter. These examples demonstrate how make can be used for different objectives. These examples are simple and easy to understand and are explained in the text. However you may write makefiles in many different ways for the same object. Features of make that are discussed in this chapter are those most commonly used. Make has many additional, less commonly used, features that are not covered here and you may want to use these as well while designing your makefiles.4.1 Introduction to GNU make
The make utility has been used for a very long time in all types of software development projects. There are open-source as well as commercial variants available from many vendors. The most common and popular distribution of make is the GNU make, which is open source and is available for almost all UNIX and Microsoft Windows platforms. All of the Linux distri- butions have the GNU make as a standard package with the development system. If you have installed development software from a distribution, you don’t need to install any additional soft- ware for make to work. The version of make currently installed can be displayed using the fol- lowing command. [rootconformix make] make -v GNU Make version 3.79.1, by Richard Stallman and Roland McGrath. Built for i386-redhat-linux-gnu Copyright C 1988, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 2000 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. Report bugs to bug-makegnu.org. [rootconformix make]Parts
» the linux development platform 2003
» Requirement Gathering Life Cycle of a Software Development Project
» Writing Functional Specifications Life Cycle of a Software Development Project
» Creating Architecture and Design Documents
» Implementation and Coding Life Cycle of a Software Development Project
» Testing Life Cycle of a Software Development Project
» Technical documentation developed during the development process. This includes
» Technical documentation prepared for technical support staff. This includes technical
» End-user manuals and guides. This is the documentation for the end user to assist the
» Software Releases Support and New Features
» Hardware Platform Components of a Development System
» Operating System Components of a Development System
» Editors Components of a Development System
» Compilers and Assemblers Components of a Development System
» Debuggers Components of a Development System
» Version Control Systems Components of a Development System
» Selection Criteria for Hardware Platform Selection Criteria for Software Development Tools
» Creating Deadlines Managing Development Process
» Managing the Development Team
» Resolving Dependencies Managing Development Process
» Libraries Linux Development Platform Specifications LDPS and Linux
» Open Source Developers Network at http:www.osdn.org
» Extensibility What to Look for in an Editor
» References and Resources the linux development platform 2003
» Target machine. This is the machine for which the newly built compiler will generate
» Post-Installation Tasks Installing GNU Compiler
» Compiling to Intermediate Levels
» Compilation with Debug Support
» Compilation with Optimization Compiling a Program
» Compiling Source Code for Other Languages
» Linking a program Assembling a Program
» Creating Libraries the linux development platform 2003
» Standard Libraries the linux development platform 2003
» Compiling Fortran Programs the linux development platform 2003
» Smalltalk Oberon Other Compilers
» The target 2. Dependencies Basic Terminology
» The explicit rules 2. The implicit rules
» Input Files Introduction to GNU make
» Typical Contents of a Makefile
» Running make Introduction to GNU make
» Shell to Execute Commands Include Files
» The ftp server The The dnsresolver
» FTPOBJS OBJS Another Example of Makefile
» Explicit Rules The make Rules
» Implicit Rules The make Rules
» Defining Variables Types of Variables
» Pre-Defined Variables Automatic Variables
» Makefile in The Top Directory
» Makefile in common-dir Directory
» Makefile in the ftp-dir Directory
» Makefile in the tftp-dir Directory Makefile in the dns-dir Directory
» Building Everything Working with Multiple Makefiles and Directories
» The ifdef Directive Control Structures and Directives
» The ifndef Directive Control Structures and Directives
» Compilation Getting the Latest Version and Installation
» Most Commonly Used gdb Commands
» Passing Command Line Arguments to the Program Being Debugged
» The step and finish Commands
» Introduction to GDB Working with the Stack
» Displaying Program Variables Displaying Variables
» Automatic Displaying Variables with Each Command
» Displaying Environment Variables Displaying Variables
» Modifying Variables Displaying Variables
» Disabling Break Points Enabling Break Points
» Debugging Optimized Code the linux development platform 2003
» Debugging Running Processes the linux development platform 2003
» The kdbg Debugger Other Open Source Debuggers
» The ddd Debugger Other Open Source Debuggers
» The xxgdb Debugger Other Open Source Debuggers
» CVS Policies the linux development platform 2003
» Project Management and Communication
» Remote Repositories Checking out a Project
» Finding the Status of a Project
» Finding Differences Using the CVS Client
» Resolving Conflicts Using the CVS Client
» Checking the Project Back In Adding Files to a Project
» Removing Files from a Project
» Tags and Releases Using the CVS Client
» System Requirements Introduction to jCVS
» Installation Instructions Introduction to jCVS
» Using jCVS Introduction to jCVS
» Installing pcl-cvs Using Emacs with CVS
» Using pcl-cvs Using Emacs with CVS
» Have a shell account on the CVS server. 2. Create a publicprivate key pair on the client.
» Selecting Coding Styles Using indent Utility
» Formatting Braces Using indent Utility
» Formatting Declarations Using indent Utility
» Breaking Long Lines Using indent Utility
» Summary of Options Using indent Utility
» Using sed Utility Using cscope and cbrowser
» Generating C Function Prototypes from C Source Code Using cproto
» Using ltrace and strace Utilities
» Value 2. Type Name Using the nm Utility
» Using the ranlib Utility Using the strip Utility
» Using the strings Utility Using the addr2line Utility
» Host Machine Introduction to the Cross-Platform Development Process
» Target Machine Introduction to the Cross-Platform Development Process
» Cross Platform Development Cycle
» Embedded Systems and Moving Parts
» Embedded Systems and Power Consumption
» Embedded Operating Systems What are Embedded Systems?
» Knowledge of Target System Hardware
» Software Emulators Cross Compilations
» Using gdbserver with GNU Debugger
» Attaching to a Running Process Using gdbserver
» Arcom SBC-GX1 Board Hardware Used for Cross-Platform and Embedded Systems
» Artesyn PMPPC Mezzanine Card
» References the linux development platform 2003
» Java Compiler Java Virtual Machine
» Kaffe the linux development platform 2003
» The Jboss Java Development System
» Getting and Installing Java SDK from Sun Creating jar Files
» Creating Source Code File Compiling Java Code
» Running Java Applications Building Java Applications
» Using gcj to Build Java Applications
» Building Applets the linux development platform 2003
» Testing Applets with Netscape
» Jikes for Java the linux development platform 2003
Show more