---
name: "dh_fortran_mod"
section: "1"
platform: "linux"
package: "dh-fortran-mod"
version: "0.43"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/dh_fortran_mod"
---

# dh\_fortran\_mod(1)

Install Fortran 90 .mod files and add dependency information.

## NAME

dh\_fortran\_mod - Install Fortran 90 .mod files and add dependency information.

## SYNOPSIS

**dh\_fortran\_mod**   \[**--sourcedir=***dir*\] \[$\<*debhelper options*\>\]

## DESCRIPTION

**dh\_fortran\_mod** is a debhelper program that finds Fortran module and submodule files and adds dependencies to **gfortran-$version** as required to the package using via the variable **${fortran:Depends}**.

**dh\_fortran\_mod** is expected to be automatically added using the debhelper "addon" **fortran\_mod** ie. either automatically, by build-depending on 'dh-sequence-fortran-mod', or explicitly:

```
    dh $@ --with fortran_mod
```

**dh\_fortran\_mod**Searches the debian/ directory for files **debian/pkg.fortran-mod**$ which list module files to include, with the same syntax as debhelper install files.

## OPTIONS

- **--sourcedir=***dir*

  Look in the specified directory for files to be installed.

  Typically Fortran module files are included in library development packages.

## TODO

Add dh-fortran-mod support for generic fortran compilers (ifx, etc).

**dh\_fortran\_mod** will be expanded to find mod files automatically from the *debian/tmp* directory. It will enable the installation of mod files in parallel for multiple compilers. It will install .smod files for Fortran 2018.

The fortran-mod file syntax follows dh\_install: pairs of sources and optional target directories. The default directory will be `$fmoddir` ( /usr/lib/$multiarch/fortran/$compiler\_mod\_directory/) If the target directory is absolute (starts with a  '/'), this directory is used in the target package. If the target  does not absolute, it will be treated as a subdirectory of `$fmoddir`.

Currently four flavours of Fortran compiler are supported: gfortran-\*  ('gfortran'), flang-new-\* ('flang') , flang-to-external-fc-\* ('flangext') and lfortran ('lfortran').

`$compiler_mod_directory` is based on the compiler module version: currently gfortran-mod-15 for gfortran-14 (and older), flang-mod-15 for flang-new-15+ and lfortran-mod-0 for lfortran.

For flang-to-external-fc-\* the version is flangext-mod-15 (assuming gfortran-14 as the external compiler); in principle flang-to-external-fc ('flangext' flavour) and gfortran are intercompatible but  intermixing is avoided.

These will be updated for incompatible compiler versions.

Support for Makefiles and debian/rules is given in /usr/share/debhelper/dh-fortran/fortran-support.mk

This enables, for example:

```
        /usr/share/debhelper/dh-fortran/fortran-support.mk
        FMODDIR:= $(call get_fmoddir, gfortran)
        FC_EXE:= $(call get_fc_exe, $(FC_DEFAULT))
```

## SEE ALSO

[**debhelper**(7)](/debhelper/7.md)

## AUTHORS

Sébastien Villemot \<sebastien@debian.org\> Alastair McKinstry \<mckinstry@debian.org\>

Lots of code stolen shamelessly from dh\_install (Joey Hess \<joeyh@debian.org\>).
