Reference Developer Tutorial 1 Introduction 2 Macros 3 Typesetting 4 Example 5 Hints 6 Examples 7 Webmaking SEARCH

5.10 FunnelWeb and Make

The Unix `Make` program allows a set of dependencies between a set of files to be described, and then uses these dependencies to control the way in which the files are created and updated. Typically, `Make` is used to control the process of transforming a collection of source code files to one or more executable files. As the use of FunnelWeb implies an extra stage to this process, it is natural to include the transformation of `.fw` files to source code files as part of the `Make` process. This is easy to do, but the user should be aware of one aspect of FunnelWeb which can cause problems.

It is often useful, when using FunnelWeb, to create a FunnelWeb `.fw` file that generates more than one product file. That is, a single `.fw` file may have many macro definitions connected to product files so that when the FunnelWeb `.fw` file is processed by FunnelWeb, several files are created. For example, this facility is convenient for placing a single package's `.h` and `.c` files within the same FunnelWeb `.fw` file.

The use of multiple product files, however, provokes a problem with dependencies. Suppose for example that a FunnelWeb `prog.fw` produces two product files `proc.spec` (a package specification) and `prog.body` (a package body). If the package is accessed in the way that packages normally are, it will be quite common for the programmer to want to modify the package body without modifying the program specification. So the programmer will edit the `prog.fw` file to change the package body. The result of running this through FunnelWeb will be the desired new package body file. However, FunnelWeb will also produce a new package specification product file even though it may be identical to the previous version! The result is that the newly created (with a recent file date) specification package file could provoke a huge remake of much of the program in which it resides.

To solve the problem, FunnelWeb includes a command line option (`D` for Delete), which when turned on (using "`+D`") causes FunnelWeb to suppress product and documentation files that are identical to the previously existing versions of the same files. For example, if, during a FunnelWeb run, a macro was connected to a product file called `x.dat`, and the macro expanded to exactly the same text as is contained in `x.dat` then FunnelWeb would simply never write the product file , the file `x.dat` would be untouched and, as a result, no further `Make` propagations would take place.

FunnelWeb implements this feature by writing each product file to a temporary file with a temporary file name. It then compares the temporary file with the target file. If the two are identical, it deletes the temporary file. If the two are different it deletes the target file and renames the temporary file to the target file.

Use of the `D` facility means that the programmer need not be punished (by extra `Make` propagations) for describing more than one product file in the same FunnelWeb file.

Webmaster Copyright © Ross N. Williams 1992,1999. All rights reserved.