
prolog_qlfmake.pl -- Compile the library to QLF format
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).
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:
- Prepare the compilation environment (expansion, optimization)
- Build the aggregate .QLF files specified in aggregate_qlf/1.
- Find all .pl files that need to a .QLF version.
- Find the subset that need rebuilding
- Compile these files
- Report on the sizes
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.
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.
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.
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_changed(+Source, +QlfTime) is semidet[private]- True when the file of Source differs from the copy that was compiled
into the .qlf file. This asks the content and not the modification
time, which cannot answer it: a tree that arrives by checkout, copy,
unpack or install carries times of its own, and a file edited in the
second its .qlf file was written has the same time as that file, at
the one second many file systems record. Hashing every source of
the system library takes about 100ms; recompiling one takes longer
than that.
Files whose hash was not recorded -- 0, from a .qlf file written by a version that did not record them -- are compared by time alone, with a second of slack, which is what this test was before there were hashes.
size_stats(+Files) is det[private]- Print (size) statistics on the created .QLF files.
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.
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.plandCLASSINDEX.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.cmakethat 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.
dir_files(+Dir, -Files) is det[private]- Get all files from Dir recursively. Skip directories that are excluded by exclude_dir/1.
qmake_aggregates is det[private]- QLF compile the aggregates. This also populates qlf_part_of/2 which is used to avoid compiling these parts.