1<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
2<html>
3<head>
4<title>The Poly/ML Make System</title>
5<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
6<link href="docstyle.css" rel="stylesheet" type="text/css">
7</head>
8
9<body>
10<ul class="nav">
11	<li><a href="PolyMLException.html">Previous</a></li>
12	<li><a href="PolyMLStructure.html">Up</a></li>
13	<li><a href="PolyMLNameSpace.html">Next</a></li>
14</ul>
15
16<h1><font SIZE="6"><a name="MakeSystem7">The Poly/ML Make System</a></font></h1>
17
18<h2><b><font SIZE="4"><a name="Intro">Introduction</a></font></b></h2>
19
20<p><font FACE="Courier" SIZE="3">PolyML.make</font><font SIZE="3"> is a function to help
21maintain consistency of programs made up of several modules. </font><b><font FACE="Courier" SIZE="3">PolyML.make</font></b><font SIZE="3"> works on modules (files
22containing functors, structures and signatures) and tries to ensure that a module is
23consistent with respect to the modules it uses.</font></p>
24
25<p><font SIZE="3">The Poly/ML compiler has two modes of operation: normal mode 
26  and 'make' mode. When the compiler is operating in 'make' mode and it encounters 
27  the name of a functor, structure or signature, it determines whether it is necessary 
28  to remake that object from its source code.</font></p>
29
30<p><font SIZE="3">The make system assumes that source code for functors, structures and
31signatures is kept in files whose names resemble those of the objects. The variable </font><b><font FACE="Courier" SIZE="3">PolyML.suffixes</font></b><font SIZE="3"> contains the
32list of filename suffixes recognised by the make system, in the order that the system
33tries them. The default list is </font><font FACE="Courier" SIZE="3"><b>[&quot;&quot;,
34&quot;.ML&quot;, &quot;.sml&quot;]</b></font><font SIZE="3">.</font></p>
35
36<p><font SIZE="3">For example, if the object is called '<i>name</i>', the system 
37  first tries to find a file called <em>name</em>, then tries <i>name</i>.<b>ML, 
38  </b>and finally tries <i>name</i>.<b>sml </b>if neither of the other files exists. 
39  Alternatively, '<i>name</i>' may be a directory containing a file called '</font><font FACE="Courier" SIZE="3"><b>ml_bind.ML</b></font><font SIZE="3">'. 
40  If the make system fails to find any matching file then it assumes the object 
41  is pervasive and will use the existing version of it.</font></p>
42
43<h2><a name="Example7.4"><font SIZE="4"><b>Example</b></font></a></h2>
44
45<p><font SIZE="3">For example, suppose we have a system in which the structure </font><b><font FACE="Courier" SIZE="3">Sort</font></b><font SIZE="3"> is created by applying the functor </font><b><font FACE="Courier" SIZE="3">SORT</font></b><font SIZE="3"> to the structures </font><b><font FACE="Courier" SIZE="3">Combinator</font></b><font SIZE="3"> and </font><b><font FACE="Courier" SIZE="3">List</font></b><font SIZE="3"> and that </font><b><font FACE="Courier" SIZE="3">Combinator</font></b><font SIZE="3"> is itself created by applying
46the functor </font><b><font FACE="Courier" SIZE="3">COMBINATOR</font></b><font SIZE="3">
47to the structure </font><font FACE="Courier New" SIZE="3"><b>List</b></font><font SIZE="3">.</font></p>
48
49<p><font SIZE="3">To use the make system, we would create a directory </font><b><font FACE="Courier" SIZE="3">Sort</font></b><font SIZE="3"> with subdirectory </font><b><font FACE="Courier" SIZE="3">Sort/Combinator</font></b><font SIZE="3"> and the following files:</font></p>
50
51<table BORDER="1" CELLSPACING="1" CELLPADDING="7" WIDTH="572">
52  <tr>
53    <td WIDTH="303" VALIGN="top"><font SIZE="3"><b>File</b></font></td>
54    <td WIDTH="233" VALIGN="TOP"><font SIZE="3"><b>Contents</b></font></td>
55  </tr>
56  <tr>
57    <td WIDTH="303" VALIGN="TOP"><font FACE="Courier" SIZE="3"><b>Sort/List.ML</b></font></td>
58    <td WIDTH="233" VALIGN="TOP"><font SIZE="3">Code for structure </font><font FACE="Courier" SIZE="3"><b>List</b></font></td>
59  </tr>
60  <tr>
61    <td WIDTH="303" VALIGN="TOP"><font FACE="Courier" SIZE="3"><b>Sort/Combinator/COMBINATOR.ML</b></font></td>
62    <td WIDTH="233" VALIGN="TOP"><font SIZE="3">Code for functor </font><font FACE="Courier" SIZE="3"><b>COMBINATOR</b></font></td>
63  </tr>
64  <tr>
65    <td WIDTH="303" VALIGN="TOP"><font FACE="Courier" SIZE="3"><b>Sort/Combinator/ml_bind.ML</b></font></td>
66    <td WIDTH="233" VALIGN="TOP"><font SIZE="3">Code to create </font><font FACE="Courier" SIZE="3"><b>Combinator</b></font></td>
67  </tr>
68  <tr>
69    <td WIDTH="303" VALIGN="TOP"><font FACE="Courier" SIZE="3"><b>Sort/SORT.ML</b></font></td>
70    <td WIDTH="233" VALIGN="TOP"><font SIZE="3">Code for functor </font><font FACE="Courier" SIZE="3"><b>SORT</b></font></td>
71  </tr>
72  <tr>
73    <td WIDTH="303" VALIGN="TOP"><font FACE="Courier" SIZE="3"><b>Sort/ml_bind.ML</b></font></td>
74    <td WIDTH="233" VALIGN="TOP"><font SIZE="3">Code to create </font><font FACE="Courier" SIZE="3"><b>Sort</b></font></td>
75  </tr>
76</table>
77
78<p><font SIZE="3">These files should have the following format:</font></p>
79
80<p><font FACE="Courier" SIZE="3"><b>Sort/List.ML</b></font></p>
81
82<blockquote>
83  <blockquote>
84    <p><font FACE="Courier" SIZE="3"><b>structure List =<br>
85    struct (* body of List *) end;</b></font></p>
86  </blockquote>
87</blockquote>
88
89<p><font FACE="Courier" SIZE="3"><b>Sort/Combinator/COMBINATOR.ML</b></font></p>
90
91<blockquote>
92  <blockquote>
93    <p><font FACE="Courier" SIZE="3"><b>signature LSIG =<br>
94    sig (* body of LSIG, as used by COMBINATOR *) end;</b></font></p>
95    <p><font FACE="Courier" SIZE="3"><b>functor COMBINATOR(structure L : LSIG) =<br>
96    struct (* body of COMBINATOR *) end;</b></font></p>
97  </blockquote>
98</blockquote>
99
100<p><font FACE="Courier" SIZE="3"><b>Sort/Combinator/ml_bind.ML</b></font></p>
101
102<blockquote>
103  <blockquote>
104    <p><font FACE="Courier" SIZE="3"><b>structure Combinator =<br>
105    COMBINATOR(structure L = List);</b></font></p>
106  </blockquote>
107</blockquote>
108
109<p><font FACE="Courier" SIZE="3"><b>Sort/SORT.ML</b></font></p>
110
111<blockquote>
112  <blockquote>
113    <p><font FACE="Courier" SIZE="3"><b>signature CSIG =<br>
114    sig (* body of CSIG *) end;</b></font></p>
115    <p><font FACE="Courier" SIZE="3"><b>signature LSIG</b> <b>=<br>
116    sig (* body of LSIG, as used by SORT *) end;</b></font></p>
117    <p><font FACE="Courier" SIZE="3"><b>functor SORT (structure C : CSIG structure L : LSIG) =<br>
118    struct<br>
119    (* body of SORT *)<br>
120    end;</b></font></p>
121  </blockquote>
122</blockquote>
123
124<p><font FACE="Courier" SIZE="3"><b>Sort/ml_bind.ML</b></font></p>
125
126<ul class="nav">
127	<li><a href="PolyMLException.html">Previous</a></li>
128	<li><a href="PolyMLStructure.html">Up</a></li>
129	<li><a href="PolyMLNameSpace.html">Next</a></li>
130</ul>
131
132</body>
133</html>
134