The file common/Make.global_options
exports several
make variables to other Makefiles which
include it. You will want to include this file into the Makefiles of
your project to use the same compiler flags and to access the paths
to libraries. This page documents available
flags, documents the values which are used
in your local installation, and shows
generic Makefiles which you may want to use
in your own projects.
Following is a list of all available flags which are exported to other Makefiles, sorted into different categories:
D
Path to the deal.II library
CXX
Executable name of the C++ compiler
CC
Executable name of the C compiler, which is used to generate shared libraries
GXX-VERSION
Name and version of the C++ compiler. Possible
names presently include egcs1.1
,
gcc2.95
, gcc2.96
,
gcc2.97
, gcc3.0
,
gcc3.1
, gcc3.2
,
gcc3.3
, gcc3.4
,
gcc4.0
,
ibm_xlc
, MIPSpro
,
sun_workshop
, sun_forte
,
intel_icc5
, intel_icc6
,
intel_icc7
, compaq_cxx
, and
probably a few more as well. Not all of
these compilers are actually supported (see the
ReadMe file for a
list of supported compilers and platforms), it is only a list of
recognized compilers.
Note that the naming of this variable is historical (it
should read CXX-VERSION
), since
it is also used even if the compiler is not the GNU C++
compiler.
GXX-VERSION-DETAILED
Like GXX-VERSION, just that it may also contain the dot version number, for example gcc3.3.3.
CC-VERSION
Name and version of the CC compiler. Possible names are similar to the ones listed above.
F77
Executable name of the F77 compiler; often, no Fortran compiler is needed, in which case the variable may be empty if none was found
F77-VERSION
Name and version of the Fortran 77 compiler. Possible
names presently include egcs1.1
,
gcc2.95
, gcc2.96
,
gcc2.97
, gcc3.0
, SunF77
,
AIXF77
, MIPSproF77
;
there may be others in the future, if we have access to
other systems
SHLIBLD
Executable name of compiler that is used to link object files to shared libraries. This will usually be the C++ compiler, but as this does not work for gcc 2.95, it is the C compiler in that case.
OBJEXT
Extension of object files. On unix, this is usually simply
o
, on Windows systems it is obj
.
EXEEXT
Extension of executables. On unix, this is usually the
empty strign, on Windows systems it is .exe
.
enable-shared
Determines whether shared or static libraries are used.
Set to yes
if you want to use shared
libraries.
PERL
Executable name of the `perl' program
DEAL_II_MAJOR
Major version number of the deal.II library, i.e. the number before the first dot. Note that this version number is also available in programs through a preprocessor variable
DEAL_II_MINOR
Minor version number of the deal.II library, i.e. the number after the first dot; if there are further numbers, like in version 3.0.1, then they are discarded as these versions only fix bugs but do not change features. Note that this version number is also available in programs through a preprocessor variable
TARGET
The target triplet as returned by config.guess. For example, on the system where I write this, it is i686-pc-linux-gnu, but it may also be sparc-sun-solaris2.7, or whatever config.guess determines for your system.
USE_CONTRIB_HSL
yes
indicates whether some subroutines from
the HSL have been explicitely installed and shall be used
by the library. no
otherwise.
(See the
ReadMe
file for more information on installation of HSL subroutines.)
USE_CONTRIB_PETSC
yes
indicates whether the interfaces to the PETSc
library shall be compiled. no
otherwise.
(See the
ReadMe
file for more information on installation of PETSc.)
DEAL_II_PETSC_DIR
If USE_CONTRIB_PETSC
is yes
, then this
variable has the path to the PETSc library, as either given by the
PETSC_DIR
environment variable, or the
--with-petsc
switch on the command line upon
configuration of the deal.II library.
DEAL_II_PETSC_ARCH
If USE_CONTRIB_PETSC
is yes
, then this
variable stores the architecture for which PETSc was compiled, as
either given by the PETSC_ARCH
environment variable,
or the --with-petsc-arch
switch on the command line
upon configuration of the deal.II library.
USE_CONTRIB_METIS
yes
indicates whether the METIS library has been
detected upon configuration, and whether we shall interface with
it. no
otherwise. (See the
ReadMe
file for more information on installation of METIS.)
DEAL_II_METIS_DIR
If USE_CONTRIB_METIS
is yes
, then this
variable has the path to the METIS library, as either given by the
METIS_DIR
environment variable, or the
--with-metis
switch on the command line upon
configuration of the deal.II library.
lib-path-base
Path to the library files of the /base library
lib-path-lac
Same for the /lac library
lib-path-deal2
Same for the /deal.II library
LIBPATH
All the library pathes prefixed by -L, i.e. the flags needed by the compiler to find the libraries when they are linked in using -lbase -llac -ldeal_II_2d (for example). These -L paths are appended to what was in $(LIBPATH) before.
LIBS
Additional libraries to be linked in, such as Fortran support, or Tecplot libraries when binary output is available.
F77LIBS
Libraries to be linked in when we link with Fortran
files. These libraries are checked at configuration time,
and are included into $(LIBS)
when they are
actually needed
static-lib-suffix
File extension of static libraries. Usually set to .a
shared-lib-suffix
File extension of shared libraries. If shared libraries
are supported, this suffix is usually .so, if shared
libraries are not supported, it is set to the same value
as static-lib-suffix
.
lib-suffix
File extension of libraries. Depending on the value of
enable-shared
, it is either set to
static-lib-suffix
or to
shared-lib-suffix
.
lib-base.o
Path and filename of the base library in optimized mode. depending on whether shared libraries were or were not enabled, the suffix of the value of this variable is either .so or .a
lib-base.g
Same, for the library in debug mode
lib-lac.o lib-lac.g
Same for the lac libraries
lib-deal2-1d.o lib-deal2-1d.g
lib-deal2-2d.o lib-deal2-2d.g
lib-deal2-3d.o lib-deal2-3d.g
Same for the deal.II libraries in the various dimensions
lib-contrib-hsl
Path and name of the library that contains the HSL subroutines explicitely installed. (See the ReadMe file for more information on installation of HSL subroutines.)
lib-contrib-petsc.g lib-contrib-petsc.o
Paths and names of the component libraries of the PETSc package, if found and used at configuration time. (See the ReadMe file for more information on installation of PETSc.)
lib-contrib-metis
Path and name of the METIS libraries, if found and used at configuration time. (See the ReadMe file for more information on installation of METIS.)
INCLUDE
All include paths figured out by the configure
script are now included into the variable
$(INCLUDE)
(which include the compiler option
-I in front of each directory). They are also
automatically included in your compiler calls as soon as you use
$(CXXFLAGS.g)
or $(CXXFLAGS.o)
.
An exception to this rule are paths listed below. These are
added to the variable $(INCLUDE)
only during make.
include-path-contrib-petsc
include-path-contrib-petsc-bmake
If PETSc is used, then these variables have the paths to the usual PETSc include files and the PETSc architecture dependent include files. (See the ReadMe file for more information on installation of PETSC.)
include-path-contrib-metis
If METIS is used, then this variable has the path to the METIS include files. (See the ReadMe file for more information on installation of METIS.)
INCLUDE
All the include pathes prefixed by -I
CXXFLAGS.g
C++ compiler flags for debug mode
CXXFLAGS.o
C++ compiler flags for optimized mode
CCFLAGS
C compiler flags. Since we only compiler C code for third-party libraries for which we assume that they and our interfaces to them are bug free, these flags are always for optimized mode.
F77FLAGS.g
Fortran 77 compiler flags for debug mode
F77FLAGS.o
Fortran 77 compiler flags for optimized mode
LDFLAGS
General linker flags
enable-threads
This symbol is 'no' if the flag was not given to ./configure and 'posix' otherwise
Note that in multithread mode, the compiler flags are augmented by
the definition of the preprocessor variable
DEAL_II_USE_MT
, which you can use to find out whether
your program shall use multithreading or not.
If ./configure, detects a valid Tecplot API installation $(INCLUDE) and $(LIBS) are augmented by the Tecplot API include and library paths, and the following symbols are meaningful:
TECIO_INCLUDE
Path to the Tecplot API header files as found by ./configure
TECIO_LIBRARY
Path to the Tecplot API library
D=/build/buildd/deal.ii-6.3.1
CXX=mpicxx
CC=mpicc
F77=/usr/bin/gfortran
GXX-VERSION=gcc4.6
GXX-VERSION-DETAILED=gcc4.6.1
CC-VERSION=gcc4.6
F77-VERSION=gcc4.6
SHLIBLD=/usr/bin/mpicxx
OBJEXT=o
EXEEXT=
enable-shared=yes
PERL=/usr/bin/perl
DEAL_II_MAJOR=6
DEAL_II_MINOR=3
TARGET=i686-pc-linux-gnu
USE_CONTRIB_HSL=
USE_CONTRIB_PETSC=yes
DEAL_II_PETSC_DIR=/usr/lib/petsc
DEAL_II_PETSC_ARCH=linux-gnu-c-opt
USE_CONTRIB_METIS=yes
DEAL_II_METIS_DIR=
lib-path-base=
lib-path-lac=
lib-path-deal2=
LIBPATH=-L/build/buildd/deal.ii-6.3.1/lib
LIBS=-llapack -lnetcdf_c++ -lnetcdf -lz -lblas -lgfortran -lamd -lumfpack
static-lib-suffix=.a
shared-lib-suffix=.so
lib-suffix=.so
lib-base.o=-L/build/buildd/deal.ii-6.3.1/lib -lbase /usr/lib/libtrilinos_stratimikosamesos.so /usr/lib/libtrilinos_stratimikosaztecoo.so /usr/lib/libtrilinos_stratimikosifpack.so /usr/lib/libtrilinos_stratimikosml.so /usr/lib/libtrilinos_stratimikos.so /usr/lib/libtrilinos_ml.so /usr/lib/libtrilinos_amesos.so /usr/lib/libtrilinos_belos.so /usr/lib/libtrilinos_ifpack.so /usr/lib/libtrilinos_aztecoo.so /usr/lib/libtrilinos_rtop.so /usr/lib/libtrilinos_sacado.so /usr/lib/libtrilinos_thyra.so /usr/lib/libtrilinos_thyraepetra.so /usr/lib/libtrilinos_thyraepetraext.so /usr/lib/libtrilinos_epetraext.so /usr/lib/libtrilinos_epetra.so /usr/lib/libtrilinos_teuchos.so /usr/lib/libtrilinos_triutils.so -ltbb
lib-base.g=-L/build/buildd/deal.ii-6.3.1/lib -lbase.g /usr/lib/libtrilinos_stratimikosamesos.so /usr/lib/libtrilinos_stratimikosaztecoo.so /usr/lib/libtrilinos_stratimikosifpack.so /usr/lib/libtrilinos_stratimikosml.so /usr/lib/libtrilinos_stratimikos.so /usr/lib/libtrilinos_ml.so /usr/lib/libtrilinos_amesos.so /usr/lib/libtrilinos_belos.so /usr/lib/libtrilinos_ifpack.so /usr/lib/libtrilinos_aztecoo.so /usr/lib/libtrilinos_rtop.so /usr/lib/libtrilinos_sacado.so /usr/lib/libtrilinos_thyra.so /usr/lib/libtrilinos_thyraepetra.so /usr/lib/libtrilinos_thyraepetraext.so /usr/lib/libtrilinos_epetraext.so /usr/lib/libtrilinos_epetra.so /usr/lib/libtrilinos_teuchos.so /usr/lib/libtrilinos_triutils.so -ltbb
lib-lac.o=-L/build/buildd/deal.ii-6.3.1/lib -llac -L/build/buildd/deal.ii-6.3.1/lib -lpetscall /usr/lib/slepc/linux-gnu-c-opt/lib/libslepc.so /usr/lib/libmetis.so
lib-lac.g=-L/build/buildd/deal.ii-6.3.1/lib -llac.g -L/build/buildd/deal.ii-6.3.1/lib -lpetscall.g /usr/lib/slepc/linux-gnu-c-opt/lib/libslepc.so /usr/lib/libmetis.so
lib-deal2-1d.o=-L/build/buildd/deal.ii-6.3.1/lib -ldeal_II_1d
lib-deal2-1d.g=-L/build/buildd/deal.ii-6.3.1/lib -ldeal_II_1d.g
lib-deal2-2d.o=-L/build/buildd/deal.ii-6.3.1/lib -ldeal_II_2d
lib-deal2-2d.g=-L/build/buildd/deal.ii-6.3.1/lib -ldeal_II_2d.g
lib-deal2-3d.o=-L/build/buildd/deal.ii-6.3.1/lib -ldeal_II_3d
lib-deal2-3d.g=-L/build/buildd/deal.ii-6.3.1/lib -ldeal_II_3d.g
lib-contrib-hsl=
lib-contrib-petsc.g=-L/build/buildd/deal.ii-6.3.1/lib -lpetscall.g
lib-contrib-petsc.o=-L/build/buildd/deal.ii-6.3.1/lib -lpetscall
lib-contrib-metis=/usr/lib/libmetis.so
include-path-base=
include-path-lac=
include-path-deal2=
include-path-contrib-hsl=
include-path-contrib-petsc=
include-path-contrib-petsc-bmake=
include-path-contrib-metis=
INCLUDE=-I/build/buildd/deal.ii-6.3.1/base/include -I/build/buildd/deal.ii-6.3.1/lac/include -I/build/buildd/deal.ii-6.3.1/deal.II/include -I/usr/include/suitesparse -I/usr/include -I/build/buildd/deal.ii-6.3.1/contrib/boost/include -I/usr/include/suitesparse -I/build/buildd/deal.ii-6.3.1/contrib -I/usr/lib/petsc/include -I/usr/lib/petsc/linux-gnu-c-opt/include -I/usr/lib/openmpi/include -I/usr/lib/openmpi/lib -I/usr/lib/slepc/include -I/usr/lib/slepc/linux-gnu-c-opt/conf -I/usr/include/trilinos -I/usr/include/tbb
CXXFLAGS.g=-DHAVE_CONFIG_H -DHAVE_ISNAN -ggdb -g -O2 -DBOOST_NO_HASH -DBOOST_NO_SLIST -DDEBUG -pedantic -Wall -W -Wpointer-arith -Wwrite-strings -Woverloaded-virtual -Wsynth -Wsign-compare -Wswitch -ftemplate-depth-128 -Wno-long-long -std=c++0x -pthread -D_REENTRANT -fPIC -Wno-unused -Wno-overloaded-virtual -Wno-extra -I/build/buildd/deal.ii-6.3.1/base/include -I/build/buildd/deal.ii-6.3.1/lac/include -I/build/buildd/deal.ii-6.3.1/deal.II/include -I/usr/include/suitesparse -I/usr/include -I/build/buildd/deal.ii-6.3.1/contrib/boost/include -I/usr/include/suitesparse -I/build/buildd/deal.ii-6.3.1/contrib -I/usr/lib/petsc/include -I/usr/lib/petsc/linux-gnu-c-opt/include -I/usr/lib/openmpi/include -I/usr/lib/openmpi/lib -I/usr/lib/slepc/include -I/usr/lib/slepc/linux-gnu-c-opt/conf -I/usr/include/trilinos -I/usr/include/tbb -DTBB_DO_ASSERT=1
CXXFLAGS.o=-DHAVE_CONFIG_H -DHAVE_ISNAN -g -O2 -DBOOST_NO_HASH -DBOOST_NO_SLIST -O2 -funroll-loops -funroll-all-loops -fstrict-aliasing -Wuninitialized -felide-constructors -ftemplate-depth-128 -std=c++0x -pthread -D_REENTRANT -fPIC -I/build/buildd/deal.ii-6.3.1/base/include -I/build/buildd/deal.ii-6.3.1/lac/include -I/build/buildd/deal.ii-6.3.1/deal.II/include -I/usr/include/suitesparse -I/usr/include -I/build/buildd/deal.ii-6.3.1/contrib/boost/include -I/usr/include/suitesparse -I/build/buildd/deal.ii-6.3.1/contrib -I/usr/lib/petsc/include -I/usr/lib/petsc/linux-gnu-c-opt/include -I/usr/lib/openmpi/include -I/usr/lib/openmpi/lib -I/usr/lib/slepc/include -I/usr/lib/slepc/linux-gnu-c-opt/conf -I/usr/include/trilinos -I/usr/include/tbb
CFLAGS=-g -O2 -O3 -funroll-loops -funroll-all-loops -fstrict-aliasing -fPIC
F77FLAGS.g=-DHAVE_CONFIG_H -g -O2 -ggdb -DDEBUG -pedantic -W -Wall -fPIC -I/build/buildd/deal.ii-6.3.1/base/include -I/build/buildd/deal.ii-6.3.1/lac/include -I/build/buildd/deal.ii-6.3.1/deal.II/include -I/usr/include/suitesparse -I/usr/include -I/build/buildd/deal.ii-6.3.1/contrib/boost/include -I/usr/include/suitesparse -I/build/buildd/deal.ii-6.3.1/contrib -I/usr/lib/petsc/include -I/usr/lib/petsc/linux-gnu-c-opt/include -I/usr/lib/openmpi/include -I/usr/lib/openmpi/lib -I/usr/lib/slepc/include -I/usr/lib/slepc/linux-gnu-c-opt/conf -I/usr/include/trilinos -I/usr/include/tbb
F77FLAGS.o=-DHAVE_CONFIG_H -g -O2 -O2 -funroll-loops -funroll-all-loops -fstrict-aliasing -fPIC -I/build/buildd/deal.ii-6.3.1/base/include -I/build/buildd/deal.ii-6.3.1/lac/include -I/build/buildd/deal.ii-6.3.1/deal.II/include -I/usr/include/suitesparse -I/usr/include -I/build/buildd/deal.ii-6.3.1/contrib/boost/include -I/usr/include/suitesparse -I/build/buildd/deal.ii-6.3.1/contrib -I/usr/lib/petsc/include -I/usr/lib/petsc/linux-gnu-c-opt/include -I/usr/lib/openmpi/include -I/usr/lib/openmpi/lib -I/usr/lib/slepc/include -I/usr/lib/slepc/linux-gnu-c-opt/conf -I/usr/include/trilinos -I/usr/include/tbb
LDFLAGS=-L/build/buildd/deal.ii-6.3.1/lib -Wl,-Bsymbolic-functions -pthread -ldl -rdynamic -L/usr/lib -L/usr/lib -L/usr/lib -lmetis
F77LIBS=-lgfortran
ACE_ROOT=
lib-ACE=
enable-threads=yes
TECIO_INCLUDE=
TECIO_LIBRARY=
In this section, we provide templates for Makefiles for applications based on the deal.II libraries. They show how to use the information provided by the variables explained above.
At present, we have three Makefiles, one for small projects consisting of only one C++ file, and one for large projects. Furthermore, there is a Makefile in a different style. Have a look at them and see what seem convenient to you. All Makefiles need slight modifications before they will work in your project. The places for modifications are marked.
Small projects: This Makefile is targeted at applications which are written to simply try something, or prove an assumption. Such applications are the step-by-step examples. These small problems are probably not the usual case in real life, but you may want to take a look at this file in order to get an idea on how it works, or you go directly to the large projects file.
You can find this Makefile here.
Large
projects: This file is targeted at larger projects, and
for this file to work, we already assume a certain
subdirectory structure of your project. In particular, it
assumes that in your project directory the following
subdirectories exist (where project
is the
directory in which the whole project is located):
project/source
project/include
project/lib
project/lib/1d
project/lib/2d
project/lib/3d
Include files need to be placed into
project/include
, while implementation files
are to be in project/source
. The executable
will be in project/lib
and the compiled object
files will be in project/lib/?d
, depending on
the dimension for which the project is compiled. Using this
directory structure, it is possible to quickly switch
between dimensions in which a program shall run in,
enabling us to develop applications which run in 1d, 2d, or
3d without long compilation times. Furthermore, placing
object files in different directories prevents cluttering
directories with unnecessarily many files.
The dimension for which the project shall be compiled is not stated in the source code, as in the small projects Makefile, but is determined by a flag which is given in the Makefile. To determine the dimension for which a project is compiled in your source file, use the preprocessor constant `deal_II_dimension' which is set by the Makefile and passed through the compiler.
You can find this Makefile here.
The third
Makefile is common/Makefile.template
in
the deal.II directory tree.
It was designed for several targets in one directory and
makes use of the compilation rules in
common/Make.rules
. All object files and
executables will be in the same directory.