Author(s): Manuel Hermenegildo, clip@dia.fi.upm.es
, http://www.clip.dia.fi.upm.es/
, The CLIP Group, Facultad de Informática, Universidad Politécnica de Madrid.
Note:
lpmake
and the
make
library are still under active development, and they may change substantially in future releases.
lpmake
is a Ciao application which uses the Ciao
make
library to implement a dependency-driven scripts in a similar way to the Un*x
make
facility.
The original purpose of the Un*x
make
utility is to determine automatically which pieces of a large program needed to be recompiled, and issue the commands to recompile them. In practice,
make
is often used for many other purposes: it can be used to describe any task where some files must be updated automatically from others whenever the others change.
lpmake
can be used for the same types of applications as
make
, and also for some new ones, and offers a number of advantages over
make
. The first one is portability. When compiled to a bytecode executable
lpmake
runs on any platform where a Ciao engine is available. Also, the fact that typically many of the operations are programmed in Prolog within the makefile, not needing external applications, improves portability further. The second advantage of
lpmake
is improved programming capabilities. While
lpmake
is simpler than
make
,
lpmake
allows using the Ciao Prolog language within the scripts. This allows establising more complex dependencies and programming powerful operations within the make file, and without resorting to external packages (e.g., operating system commands), which also helps portability. A final advantage of
lpmake
is that it supports a form of autodocumentation:
comments associated to targets can be included in the configuration files. Calling
lpmake
in a directory which has such a configuration file explains what commands the configuration file support and what these commands will do.
To prepare to use
lpmake
, and in a similar way to
make
, you must write a file (typically called
Makefile.pl
) that describes the relationships among files in your program or application, and states the commands for updating each file. In a program, typically the executable file is updated from object files, which are in turn made by compiling source files. Another example is running
latex
and
dvips
on a set of source .tex
files to generate a document in dvi
and postscript
formats. Once a suitable makefile exists, each time you change some source files, simply typing lpmake
suffices to perform all necessary operations (recompilations, processing text files, etc.). The
lpmake
program uses the dependency rules in the makefile and the last modification times of the files to decide which of the files need to be updated. For each of those files, it issues the commands recorded in the makefile. For example, in the
latex
/
dvips
case one rule states that the .dvi
file whould be updated from the .tex
files whenever one of them changes and another rule states that the .ps
file needs to be updated from a .dvi
file every time it changes. The rule also describe the commands to be issued to update the files.
So, the general process is as follows:
lpmake
executes commands in the
Makefile.pl
to update one or more target names, where name is often a program, but can also be a file to be generated or even a "virtual" target. If no -l
or -m
options are present,
lpmake
will look for the makefile
Makefile.pl
.
lpmake
updates a target if it depends on prerequisite files that have been modified since the target was last modified, or if the target does not exist. You can provide command line arguments to
lpmake
to control which files should be regenerated, or how.
Supported command line options: [-v] [-u <.../Configfile.pl>] <command1> ... <commandn> Process commands <command1> ... <commandn>, using user file <.../Configfile.pl> as configuration file. If no configuration file is specified a file 'Makefile.pl' in the current directory will be used. [-v] [-m <.../Configfile.pl>] <command1> ... <commandn> Same as above, but the configuration file is a module. Making this file a module is useful to implement inherintance across diferent configuration files, i.e., the values declared in a configuration file can be easily made to override those defined in another. Optional argument '-v' produces verbose output, reporting on the processing of the dependency rules. Very useful for debugging Makefiles. -h [ -u <.../Configfile.pl> ] -h [ -m <.../Configfile.pl> ] -help [ -u <.../Configfile.pl> ] -help [ -m <.../Configfile.pl> ] Print this help message. If a configuration file is given, and the commands in it are commented, then information on these commands is also printed.
lpmake
)
Some parts of the documentation are taken from the documentation of GNU's
gmake
.
Go to the first, previous, next, last section, table of contents.