deal.II comes with sample Makefiles for applications that use this library. They show how to use the information provided by the variables explained above.
At present, there are two such Makefile templates. All Makefiles need slight modifications before they will work in your project; the places for modifications are marked and easy to find. The templates are:
Small
project Makefile: This Makefile is targeted at small
applications consisting of only a single .cc
file. Examples of this kind are the
step-by-step
tutorial programs.
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
: The location of all
your .h
files.
project/include
: The location of all
your .cc
files.
project/lib
: Where the Makefile will
put the final executable.
project/lib/1d
: Where the Makefile will
put your object files if you compile for 1d.
project/lib/2d
: Same for 2d.
project/lib/3d
: Same for 3d.
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 set in the
Makefile. The Makefile then makes sure that the preprocessor
constant deal_II_dimension
is set appropriately and
passed through to the compiler when creating object files.
You can find this Makefile here.