Did you know ... Search Documentation:
prolog_qlfmake.pl -- Compile the library to QLF format
PublicShow source

Compilation mode:

  • Handle debug/3
    • Optimise, forcing loading of .pl files in debug mode?
  • library(apply_macros)
    • Load in advance
  • Do not include compiled documentation
    • doc_collect(false).
Source qlf_make is det
Compile all files from the system libraries to .QLF format. This is normally called as part of building SWI-Prolog. The compilation consists of these phases:
  1. Prepare the compilation environment (expansion, optimization)
  2. Build the aggregate .QLF files specified in aggregate_qlf/1.
  3. Find all .pl files that need to a .QLF version.
  4. Find the subset that need rebuilding
  5. Compile these files
  6. Report on the sizes
Source qlf_make(+Spec) is det
Ensure a .QLF version of Spec. If the .QLF file for Spec does not exist, is incompatible or one of its source files has changed, run qcompile/1 to compile the file.
Source preload_pldoc is det[private]
Preload the documentation system and disable it. We need to do this to avoid embedding the system documentation into the .qlf files.
Source preload(+Spec, +Imports) is det[private]
Ensure the .QLF file for Spec, load the file and import predicates from Imports. This is used to preload files that affect the compilation such as library(apply_macros) and PlDoc.
Source qlf_needs_rebuild(+PlFile:atom) is semidet[private]
True when PlFile needs to be recompiled. This currently only considers the immediate source file, not included files or imported files that define operators, goal or term expansion rules.
Source size_stats(+Files) is det[private]
Print (size) statistics on the created .QLF files.
Source file_dependencies(+File, -Deps:ordset) is det[private]
True when Deps is a list of absolute file names that form the dependencies of File. These dependencies are used to determine the order in which we compile the units. This does not state that the compilation process depends on these dependencies. But, qlf compiling a module does load these dependencies, either from the source or created .qlf file. Only if the loaded dependency exports macros (term/goal expansion rules) or operators we actually need to have the depedencies compiled before us. Still, qlf compiling the dependencies before speeds up the compilation of this file.

This predicate examines the file loading directives. Note that Deps does not contain files loaded using include/1 as we do not create .qlf files for these.

Source system_lib_files(-LibFiles:list(atom)) is det[private]
True when LibFiles is a list of all files for which a .QLF file needs to be build. This means, all .pl files except:
  • INDEX.pl, MKINDEX.pl and CLASSINDEX.pl
  • Files that are part of an aggregate .QLF file
  • Files that are explicitly excluded as specified by exclude/1 or exclude_dir/1.

These rules must be kept in sync with cmake/InstallSource.cmake that creates CMake install targets for the .qlf files. We need a better solution for this using a common set of rules that can be interpreted by both Prolog and CMake.

Source dir_files(+Dir, -Files) is det[private]
Get all files from Dir recursively. Skip directories that are excluded by exclude_dir/1.
Source qmake_aggregates is det[private]
QLF compile the aggregates. This also populates qlf_part_of/2 which is used to avoid compiling these parts.