logo LMD

Page de Lionel GUEZ

Enseignement à l'école normale supérieure, en L3 de géosciences, 2014/2015

Travaux dirigés de compilation (mise à jour du 19 mai 2015).

Cours sur la compilation et l'utilitaire make (mise à jour du 28 mai 2015).

Cours : algorithmique et programmation (mise à jour du 2 février 2015).

Mots-clefs du langage Fortran 95 (mise à jour du 31 octobre 2014).

Premier semestre :

Second semestre :




Templates of makefiles for Fortran programs and libraries

From the simplest case to more complex cases, makefiles for a Fortran program made up with:

Makefiles for a Fortran library made up with:

The above makefiles contain the description of your program or library: the names of inputs files, the directories where they are, the dependencies between them. But, by design, the part of the makefile which depends on the compiler is well isolated. The part that depends on the compiler is the definition of variables FC, FFLAGS, CPPFLAGS, LDFLAGS and LDLIBS. If you are going to compile your program with a single compiler then you can just add the definition of those variables inside the makefile. But if you use several compilers then write the definition of FC, FFLAGS, CPPFLAGS, LDFLAGS and LDLIBS in a separate file, one file for each compiler.

If you just want the products of compilation (executable file, library, object files, compiled module interfaces) to be created in the directory containing the makefile, you just go to that directory and invoke make from there. However, often, one wants the products of the compilation to go somewhere else, in a directory not related to the source files (maybe another file system, or a directory the position of which relative to your source files will change when you port your code to another machine). In that case, instead of invoking make, use the script make.sh. Choose the value of MAKE and dest_dir in make.sh and just invoke make.sh instead of make. You can add any argument to make.sh that you would want to use with make. For example, you could type:

make.sh clean all
make.sh FC=pgf95

Fortran : insertion des procédures dans des modules

Autour de LMDZ


Climatologie de l'ozone (18 KiB), de Fortuin et Kelder (1998), convertie au format NetCDF. Cf. page correspondante du Tropospheric Emission Monitoring Internet Service.