:- module(make,[make/0]). % http://stackoverflow.com/q/34558948/772868 make :- % reload legal modules \+ ( current_module(_, F), ( F \== user -> \+ use_module(F, []) ; throw(error( permission_error(reload,source_sink,F), permission_error(0,reload,source_sink,F,0))) ) ), % reload files that are implicitly modules, but that are still simple to reload \+ ( source_file(F), F \== user, \+ current_module(_, F), % not officially declared as a module setof(M, P^ExF^ExM^( source_file(M:P,F), \+ current_module(M,ExF), % not part of an official module \+ predicate_property(M:P,multifile), \+ predicate_property(M:P,imported_from(ExM)) ),[M]), % only one module per file, others are too complex \+ ensure_loaded(M:F) ).