fpm_backend Module

Build backend

Uses a list of build_target_ptr and a valid fpm_model instance to schedule and execute the compilation and linking of package targets.

The package build process (build_package) comprises three steps:

  1. Target sorting: topological sort of the target dependency graph (sort_target)
  2. Target scheduling: group targets into schedule regions based on the sorting (schedule_targets)
  3. Target building: generate targets by compilation or linking

Incremental compilation

The backend process supports incremental compilation whereby targets are not re-compiled if their corresponding dependencies have not been modified.

  • Source-based targets (i.e. objects) are not re-compiled if the corresponding source file is unmodified AND all of the target dependencies are not marked for re-compilation

  • Link targets (i.e. executables and libraries) are not re-compiled if the target output file already exists AND all of the target dependencies are not marked for re-compilation

Source file modification is determined by a file digest (hash) which is calculated during the source parsing phase (fpm_source_parsing) and cached to disk after a target is successfully generated.



Contents


Subroutines

public subroutine build_package(targets, model)

Top-level routine to build package described by model

Arguments

Type IntentOptional AttributesName
type(build_target_ptr), intent(inout) :: targets(:)
type(fpm_model_t), intent(in) :: model

public subroutine schedule_targets(queue, schedule_ptr, targets)

Construct a build schedule from the sorted targets.

Read more…

Arguments

Type IntentOptional AttributesName
type(build_target_ptr), intent(out), allocatable:: queue(:)
integer, allocatable:: schedule_ptr(:)
type(build_target_ptr), intent(in) :: targets(:)

public recursive subroutine sort_target(target)

Topologically sort a target for scheduling by recursing over its dependencies.

Read more…

Arguments

Type IntentOptional AttributesName
type(build_target_t), intent(inout), target:: target