built-in predicate

logtalk_make/1

Description

logtalk_make(Target)

Runs a make target. Prints a warning message and fails when the target is not valid.

Allows reloading all Logtalk source files that have been modified since last loaded when called with the target all, deleting all intermediate files generated by the compilation of Logtalk source files when called with the target clean, checking for code issues when called with the target check, listing of circular dependencies between pairs or trios of objects when called with the target circular, generating documentation when called with the target documentation, and deleting the dynamic binding caches with the target caches.

There are also three variants of the all target: debug, normal, and optimal. These targets change the compilation mode (by changing the default value of the debug and optimize flags) and reload all affected files (i.e. all files loaded without an explicit debug/1 or optimize/1 compiler option).

When using the all target, only source files loaded using the logtalk_load/1 and logtalk_load/2 predicates are reloaded. Non-modified files will also be reloaded when there is a change to the compilation mode (i.e. when the files were loaded without explicit debug or optimize flags and the default values of these flags changed after loading; no check is made, however, for other implicit compiler flags that may have changed since loading). When an included file is modified, this target reloads its main file (i.e. the file that contains the include/1 directive).

When using the check or circular targets, be sure to compile your source files with the source_data flag turned on for complete and detailed reports.

The check target scans for missing entities (objects, protocols, categories, and modules), missing entity predicates, and duplicated library aliases. Predicates for messages sent to objects that implement the forwarding built-in protocol are not reported. While this usually avoids only false positives, it may also result in failure to report true missing predicates in some cases.

When using the circular target, be prepared for a lengthy computation time for applications with a large combined number of objects and message calls. Only mutual and triangular dependencies are checked due to the computational cost. Circular dependencies occur when an object sends a message to a second object that, in turn, sends a message to the first object. These circular dependencies are often a consequence of lack of separation of concerns. But, when they cannot be fixed, the only practical consequence is a small performance cost as some of the messages would be forced to use dynamic binding.

The documentation target requires the doclet tool and a single doclet object to be loaded. See the doclet tool documentation for more details.

Depending on the backend Prolog compiler, the following top-level shortcuts are usually defined:

  • {*} - logtalk_make(all)

  • {!} - logtalk_make(clean)

  • {?} - logtalk_make(check)

  • {@} - logtalk_make(circular)

  • {#} - logtalk_make(documentation)

  • {$} - logtalk_make(caches)

  • {+d} - logtalk_make(debug)

  • {+n} - logtalk_make(normal)

  • {+o} - logtalk_make(optimal)

Check the adapter files for the availability of these shortcuts as they are not part of the language.

Warning

Only use the shortcuts at the top-level interpreter and never in source files.

The target actions can be extended by defining clauses for the multifile and dynamic hook predicate logtalk_make_target_action(Target) where Target is one of the targets listed above. The additional user defined actions are run after the default ones.

Modes and number of proofs

logtalk_make(+atom) - zero_or_one

Errors

(none)

Examples

% reload loaded source files in debug mode:
| ?- logtalk_make(debug).

% check for code issues in the loaded source files:
| ?- logtalk_make(check).

% delete all intermediate files generated by
% the compilation of Logtalk source files:
| ?- logtalk_make(clean).