aboutsummaryrefslogtreecommitdiffstats
path: root/lib/tools/doc/src/make.xml
blob: 1c8df67abff06cb541d787329d7db46c6e3babb7 (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
<?xml version="1.0" encoding="latin1" ?>
<!DOCTYPE erlref SYSTEM "erlref.dtd">

<erlref>
  <header>
    <copyright>
      <year>1996</year>
      <year>2011</year>
      <holder>Ericsson AB, All Rights Reserved</holder>
    </copyright>
    <legalnotice>
  The contents of this file are subject to the Erlang Public License,
  Version 1.1, (the "License"); you may not use this file except in
  compliance with the License. You should have received a copy of the
  Erlang Public License along with this software. If not, it can be
  retrieved online at http://www.erlang.org/.

  Software distributed under the License is distributed on an "AS IS"
  basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
  the License for the specific language governing rights 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 | &lt;compiler option&gt;</v>
      </type>
      <desc>
        <p>This function first looks in the current working directory
          for a file named <c>Emakefile</c> (see below) specifying the
          set of modules to compile and the compile options to use. 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 an all known nodes.</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> looks in the
      current working directory for a file named <c>Emakefile</c>. If
      it exists, <c>Emakefile</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>