File: make.3

package info (click to toggle)
erlang-manpages 1%3A12.b.3-1
  • links: PTS
  • area: main
  • in suites: lenny
  • size: 4,188 kB
  • ctags: 2
  • sloc: makefile: 68; perl: 30; sh: 15
file content (128 lines) | stat: -rw-r--r-- 3,738 bytes parent folder | download
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
.TH make 3 "tools  2.6.1" "Ericsson AB" "ERLANG MODULE DEFINITION"
.SH MODULE
make \- A Make Utility for Erlang
.SH DESCRIPTION
.LP
The module \fImake\fR provides a set of functions similar to the UNIX type \fIMake\fR functions\&.

.SH EXPORTS
.LP
.B
all() -> up_to_date | error
.br
.B
all(Options) -> up_to_date | error
.br
.RS
.TP
Types
Options = [Option]
.br
Option = noexec | load | netload | <compiler option>
.br
.RE
.RS
.LP
This function first looks in the current working directory for a file named \fIEmakefile\fR (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\&.
.LP
Traversing the set of modules, it then recompiles every module for which at least one of the following conditions apply:
.RS 2
.TP 2
*
there is no object file, or
.TP 2
*
the source file has been modified since it was last compiled, or,
.TP 2
*
an include file has been modified since the source file was last compiled\&.
.RE
.LP
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 \fIerror\fR is returned\&.
.LP
\fIOptions\fR is a list of make- and compiler options\&. The following make options exist:
.RS 2
.TP 2
*
\fInoexec\fR 
.br
 No execution mode\&. Just prints the name of each module that needs to be compiled\&.
.TP 2
*
\fIload\fR 
.br
 Load mode\&. Loads all recompiled modules\&.
.TP 2
*
\fInetload\fR 
.br
 Net load mode\&. Loads all recompiled modules an all known nodes\&.
.RE
.LP
All items in \fIOptions\fR that are not make options are assumed to be compiler options and are passed as-is to \fIcompile:file/2\fR\&. \fIOptions\fR defaults to \fI[]\fR\&.
.RE
.LP
.B
files(ModFiles) -> up_to_date | error
.br
.B
files(ModFiles, Options) -> up_to_date | error
.br
.RS
.TP
Types
ModFiles = [Module | File]
.br
Module = atom()
.br
File = string()
.br
Options = [Option]
.br
Option = noexec | load | netload | <compiler option>
.br
.RE
.RS
.LP
\fIfiles/1, 2\fR does exactly the same thing as \fIall/0, 1\fR but for the specified \fIModFiles\fR, which is a list of module or file names\&. The file extension \fI\&.erl\fR may be omitted\&.
.LP
The \fIEmakefile\fR (if it exists) in the current directory is searched for compiler options for each module\&. If a given module does not exist in \fIEmakefile\fR or if \fIEmakefile\fR does not exist, the module is still compiled\&.
.RE
.SH EMAKEFILE
.LP
\fImake:all/0, 1\fR and \fImake:files/1, 2\fR looks in the current working directory for a file named \fIEmakefile\fR\&. If it exists, \fIEmakefile\fR should contain elements like this:

.nf
Modules\&.
{Modules,Options}\&.    
.fi
.LP
\fIModules\fR is an atom or a list of atoms\&. It can be 
.RS 2
.TP 2
*
a module name, e\&.g\&. \fIfile1\fR
.TP 2
*
a module name in another directory, e\&.g\&. \fI\&.\&./foo/file3\fR
.TP 2
*
a set of modules specified with a wildcards, e\&.g\&. \fI\&'file*\&'\fR
.TP 2
*
a wildcard indicating all modules in current directory, i\&.e\&. \fI\&'*\&'\fR
.TP 2
*
a list of any of the above, e\&.g\&. \fI[\&'file*\&', \&'\&.\&./foo/file3\&', \&'File4\&']\fR
.RE
.LP
\fIOptions\fR is a list of compiler options\&. 
.LP
\fIEmakefile\fR is read from top to bottom\&. If a module matches more than one entry, the first match is valid\&. For example, the following \fIEmakefile\fR means that \fIfile1\fR shall be compiled with the options \fI[debug_info, {i, "\&.\&./foo"}]\fR, while all other files in the current directory shall be compiled with only the \fIdebug_info\fR flag\&.

.nf
{\&'file1\&',[debug_info,{i,"\&.\&./foo"}]}\&.
{\&'*\&',[debug_info]}\&.    
.fi
.LP