next up previous contents
Next: 7. Conditional compilation Up: 6.2.7 Dir Previous: 6.2.7.1 Directory factoring:   Contents

6.2.7.2 Directory scanning:

Another use of the Dir tool, indicated by the absence of tool options, is to include all ML code in a given directory ``whole-sale style''. For example, a member of the form


  projects/ml/foo : dir

lets CM scan the contents of directory projects/ml/foo and proceed as if a list of all discovered ML files had been written in place of the dir member. For this, the usual classification mechanism is used to decide which directory entries are to be considered files containing ML code.

As before, the example could be further simplified by omitting the class name. Thus, a very quick way of putting together a small project is to use a generic description file of the form:


Group is $/basis.cm .

As usual, the dot denotes the current directory. Therefore, CM will scan the current directory and include any ML code it finds there. (Library $/basis.cm is necessary for most non-trivial programs, so we included it also.)

This is deceptively simple, but be warned: The technique of letting CM scan the physical directory is to be avoided for any serious project because it is very fragile. It does not mix well with the use of other tools, it will break when certain otherwise unrelated ML files are present, and so on, and so forth. In short, for serious programming the Dir tool should not be used without specifying options.


next up previous contents
Next: 7. Conditional compilation Up: 6.2.7 Dir Previous: 6.2.7.1 Directory factoring:   Contents
Matthias Blume
2001-07-19