ocs
toolocs
, which is similar to the traditional Unix tool
make
.
For example, we compile the mandatory hello-world program
with ocs
as follows:
$ cd examples/HelloWorld examples/HelloWorld $ ocs -> Generating rules for hello'HelloWorld ... -> Checking Signature of HelloWorld ... -> Compiling Implementation of HelloWorld ... -> Generating object code for HelloWorld ... -> Generating startup code for hello ... -> Linking hello ... examples/HelloWorld $ ./hello -> Hello World!Like
make
, ocs
is ``lazy'' and
performs only the steps necessary to bring its target up to date. Thus,
calling ocs
again yields:
examples/HelloWorld $ ocs -> Nothing to be done for `all'.Only if sources change (reflected by their time stamps) will (partial) recompilation be carried out:
examples/HelloWorld $ touch HelloWorld.impl examples/HelloWorld $ ocs -> Generating rules for hello'HelloWorld ... -> Compiling Implementation of HelloWorld ... -> Generating object code for HelloWorld ... -> Generating startup code for hello ... -> Linking hello ...
ocs
places intermediate compilation results in a
subdirectory called OCS
. In order to enforce
recompilation, or to recover disk space, simply remove this directory:
examples/HelloWorld $ rm -rf OCS examples/HelloWorld $ ocs -> Generating rules for hello'HelloWorld ... ... -> Linking hello ...
Sometimesocs
gets confused by changes on theSysDefs
file - for example, if structures have been renamed. If the operation ofocs
fails for such reasons, removing./OCS
helps.
ocs
gets its information from a file called
SysDefs
(like make
from
Makefile
) in the current directory. For the
hello-world program, this file has the following contents:
examples/HelloWorld $ cat SysDefs -> TOPSTRUCT = HelloWorld -> TOPCOM = helloA
SysDefs
file contains a set of variable definitions in
a make
-like syntax. For hello-world, we only had to
define the following variables: TOPSTRUCT
, the name of
the structure which contains the top-level monadic command, and
TOPCOM
, the name of this command.
Remark: by runningA"ocs -top HelloWorld hello"
, a fileSysDefs.HelloWorld-hello
will be created which can be renamedSysDefs
.
SysDefs
file may contain further variable definitions,
and ocs
runs in a variety of modes supporting diverse
options. For further documentation, see the
ocs(1)
manual page.
The operation of ocs
may be further customized by a
OCSPROJECT
is defined, it must point to a file which
contains the project definitions. See examples/Customize
for examples of project definitions files.