bras
Rule Based Command Execution
|
|
| What is it? |
|
Bras helps to keep files, or targets,
up-to-date with respect to a set of dependencies. For
every target, a rule describes what it means for the
target to be out-of-date and what has to be done to refresh
it. |
|
Why not make? |
|
While make is probably the
application most often used in *nix software development, I
guess everyone who has written makefiles would
agree that make has a few very odd features. My
personal "favorite" misfeatures of make are:
- ugly mix of shell-syntax with
makes
own syntax,
- confusing way to expand macros and
- incomplete handling of dependence relations spanning
multiple directories (see Peter Miller's
Recursive Make Considered Harmful).
|
|
Features
- up-to-date'ness
- Conditions which test whether a target
is out-of-date with respect to its dependencies can be freely
defined; currently implemented tests include
older,
md5older, updated.
- multiple directories
Bras can follow
targets into other directories. It acts there according to the
local brasfile to update the target and then reports
the result back. Because no recursive execution of
bras is necessary, the result of the reasoning for
that other directory is not lost.
- non-file targets
- Targets need not be files. In fact a
target is just a name. It depends on the rules formulated for the
target of how that name is used.
- pattern rules
- Pattern rules automatically derive
dependencies and thereby patterns via freely definable
functions.
Make's suffix rules are implemented as a
trivial special case.
- consistent syntax
Bras is implemented in
Tcl. Rules can be mixed with procedural parts. In particular
control structures can be used to automatically collect lists of
targets, find out platform specifics or selectively activate
rules.
- module
- While
bras is normally started on
the command line, the whole rule evaluation functionality is
available as a Tcl module and can even be used in a GUI-based
application implemented in Tcl/Tk.
One very tiny example
The best way to get an idea of how bras works is to
download the distribution and look at some of the files in the
examples subdirectory. Nevertheless I'll give a three
liner here:
set SRC [glob *.c]
Make hello {[older hello $SRC]} {
cc -o hello $SRC
}
The first line collects all .c-files in the current
directory. The 2nd line says that to make target hello
bras must test if that file is older than any in list just
collected. If it is the case, the compiler is started to update
hello.
Please send comments and suggestions to Harald Kirsch.