aboutsummaryrefslogtreecommitdiffstats
path: root/lib/tools/doc/src/make.xml
blob: 123fcd4afc334cc5ed79183e1f39f4b679bcb5f3 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
<?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE erlref SYSTEM "erlref.dtd">

<erlref>
  <header>
    <copyright>
      <year>1996</year>
      <year>2017</year>
      <holder>Ericsson AB, All Rights Reserved</holder>
    </copyright>
    <legalnotice>
  Licensed under the Apache License, Version 2.0 (the "License");
  you may not use this file except in compliance with the License.
  You may obtain a copy of the License at
 
      http://www.apache.org/licenses/LICENSE-2.0

  Unless required by applicable law or agreed to in writing, software
  distributed under the License is distributed on an "AS IS" BASIS,
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  See the License for the specific language governing permissions and
  limitations under the License.

  The Initial Developer of the Original Code is Ericsson AB.
    </legalnotice>

    <title>make</title>
    <prepared></prepared>
    <docno></docno>
    <date></date>
    <rev></rev>
  </header>
  <module>make</module>
  <modulesummary>A Make Utility for Erlang</modulesummary>
  <description>
    <p>The module <c>make</c> provides a set of functions similar to
      the UNIX type <c>Make</c> functions.</p>
  </description>
  <funcs>
    <func>
      <name>all() -> up_to_date | error</name>
      <name>all(Options) -> up_to_date | error</name>
      <fsummary>Compile a set of modules.</fsummary>
      <type>
        <v>Options = [Option]</v>
	<v>&nbsp;Option = noexec | load | netload | {emake, Emake} | &lt;compiler option&gt;</v>
      </type>
      <desc>
      <p>This function determines the set of modules to compile and the
          compile options to use, by first looking for the <c>emake</c> make
          option, if not present reads the configuration from a file named
          <c>Emakefile</c> (see below). If no such file is found, the
          set of modules to compile defaults to all modules in the
          current working directory.</p>
        <p>Traversing the set of modules, it then recompiles every module for
          which at least one of the following conditions apply:</p>
        <list type="bulleted">
          <item>there is no object file, or</item>
          <item>the source file has been modified since it was last compiled,
           or,</item>
          <item>an include file has been modified since the source file was
           last compiled.</item>
        </list>
        <p>As a side effect, the function prints the name of each module it
          tries to compile. If compilation fails for a module, the make
          procedure stops and <c>error</c> is returned.</p>
        <p><c>Options</c> is a list of make- and compiler options.
          The following make options exist:</p>
        <list type="bulleted">
          <item><c>noexec</c>          <br></br>

           No execution mode. Just prints the name of each module that needs
           to be compiled.</item>
          <item><c>load</c>          <br></br>

           Load mode. Loads all recompiled modules.</item>
          <item><c>netload</c>          <br></br>

           Net load mode. Loads all recompiled modules on all known nodes.</item>
          <item><c>{emake, Emake}</c>          <br></br>

           Rather than reading the <c>Emakefile</c> specify configuration explicitly.</item>
        </list>
        <p>All items in <c>Options</c> that are not make options are assumed
          to be compiler options and are passed as-is to
          <c>compile:file/2</c>. <c>Options</c> defaults to <c>[]</c>.</p>
      </desc>
    </func>
    <func>
      <name>files(ModFiles) -> up_to_date | error</name>
      <name>files(ModFiles, Options) -> up_to_date | error</name>
      <fsummary>Compile a set of modules.</fsummary>
      <type>
        <v>ModFiles = [Module | File]</v>
        <v>&nbsp;Module = atom()</v>
        <v>&nbsp;File = string()</v>
        <v>Options = [Option]</v>
        <v>&nbsp;Option = noexec | load | netload | &lt;compiler option&gt;</v>
      </type>
      <desc>
        <p><c>files/1,2</c> does exactly the same thing as <c>all/0,1</c> but
          for the specified <c>ModFiles</c>, which is a list of module or
          file names. The file extension <c>.erl</c> may be omitted.</p>
        <p>The <c>Emakefile</c> (if it exists) in the current
          directory is searched for compiler options for each module. If
          a given module does not exist in <c>Emakefile</c> or if
          <c>Emakefile</c> does not exist, the module is still compiled.</p>
      </desc>
    </func>
  </funcs>

  <section>
    <title>Emakefile</title>
    <p><c>make:all/0,1</c> and <c>make:files/1,2</c> first looks for
      <c>{emake, Emake}</c> in options, then in the current working directory
      for a file named <c>Emakefile</c>. If present <c>Emake</c> should
      contain elements like this:</p>
    <code type="none">
Modules.
{Modules,Options}.    </code>
    <p><c>Modules</c> is an atom or a list of atoms. It can be 
      </p>
    <list type="bulleted">
      <item>a module name, e.g. <c>file1</c></item>
      <item>a module name in another directory,
       e.g. <c>../foo/file3</c></item>
      <item>a set of modules specified with a wildcards,
       e.g. <c>'file*'</c></item>
      <item>a wildcard indicating all modules in current directory,
       i.e. <c>'*'</c></item>
      <item>a list of any of the above,
       e.g. <c>['file*','../foo/file3','File4']</c></item>
    </list>
    <p><c>Options</c> is a list of compiler options.
      </p>
    <p><c>Emakefile</c> is read from top to bottom. If a module
      matches more than one entry, the first match is valid. For
      example, the following <c>Emakefile</c> means that <c>file1</c>
      shall be compiled with the options
      <c>[debug_info,{i,"../foo"}]</c>, while all other files in the
      current directory shall be compiled with only the
      <c>debug_info</c> flag.</p>
    <code type="none">
{'file1',[debug_info,{i,"../foo"}]}.
{'*',[debug_info]}.    </code>
    <p></p>
  </section>
</erlref>