40. Compiling and Linking

Portable TAO makefiles follow the rules and definitions of PETSc makefiles. In Figures we present a sample makefile.


       CFLAGS    =  
       FFLAGS    =  
       CPPFLAGS  = 
       FPPFLAGS  = 
        
       include ${TAO_DIR}/bmake/tao_common 
    
       minsurf1: minsurf1.o tao_chkopts 
            -${CLINKER} -o minsurf1 minsurf1.o ${TAO_LIB} ${PETSC_SNES_LIB} 
            ${RM} minsurf1.o 

Figure 7: Sample TAO makefile for a single C program

This small makefile is suitable for maintaining a single program that uses the TAO library. The most important line in this makefile is the line starting with include:


   include ${TAO_DIR}/bmake/tao_common 
This line includes other makefiles that provide the needed definitions and rules for the particular base software installations (specified by ${}TAO_DIR and ${}PETSC_DIR) and architecture (specified by ${}PETSC_ARCH), which are typically set as environmental variables prior to compiling TAO source or programs. As listed in the sample makefile, the appropriate include file is automatically completely specified; the user should not alter this statement within the makefile.

TAO applications using PETSc should be linked with the to the PETSC_SNES_LIB library as well as the TAO_LIB library. This version uses PETSc 3.1, and the PETSC_DIR variable should be set accordingly. Many examples of makefiles can be found in the examples directories.