summaryrefslogtreecommitdiffstats
path: root/docs/en/erlang.mk/1/guide/getting_started/index.html
blob: 4705b04bef7ddb9441d696c2392351d4e3446f67 (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
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta name="description" content="">
    <meta name="author" content="Loïc Hoguin based on a design from (Soft10) Pol Cámara">

    <title>Nine Nines: Getting started</title>

    <link href='https://fonts.googleapis.com/css?family=Open+Sans:400,700,400italic' rel='stylesheet' type='text/css'>
    <link href="/css/99s.css?r=4" rel="stylesheet">

    <link rel="shortcut icon" href="/img/ico/favicon.ico">
    <link rel="apple-touch-icon-precomposed" sizes="114x114" href="/img/ico/apple-touch-icon-114.png">
    <link rel="apple-touch-icon-precomposed" sizes="72x72" href="/img/ico/apple-touch-icon-72.png">
    <link rel="apple-touch-icon-precomposed" href="/img/ico/apple-touch-icon-57.png">

    
</head>


<body class="">
  <header id="page-head">
    <div id="topbar" class="container">
        <div class="row">
          <div class="span2">
            <h1 id="logo"><a href="/" title="99s">99s</a></h1>
          </div>
          <div class="span10">
            
            <div id="side-header">
              <nav>
                <ul>
                  <li><a title="Hear my thoughts" href="/articles">Articles</a></li>
  				  <li><a title="Watch my talks" href="/talks">Talks</a></li>
  				  <li class="active"><a title="Read the docs" href="/docs">Documentation</a></li>
  				  <li><a title="Request my services" href="/services">Consulting & Training</a></li>
                </ul>
              </nav> 
              <ul id="social">
                <li>
                  <a href="https://github.com/ninenines" title="Check my Github repositories"><img src="/img/ico_github.png" data-hover="/img/ico_github_alt.png" alt="Github"></a>
                </li>
                    <li>
						<a title="Contact me" href="mailto:[email protected]"><img src="/img/ico_mail.png" data-hover="/img/ico_mail_alt.png"></a>
					</li>
              </ul>
            </div>
          </div>
        </div>
    </div>


</header>

<div id="contents" class="two_col">
<div class="container">
<div class="row">
<div id="docs" class="span9 maincol">

<h1 class="lined-header"><span>Getting started</span></h1>

<p>This chapter explains how to get started using Erlang.mk.</p>
<h2 id="_creating_a_folder_for_your_project">Creating a folder for your project</h2>
<p>The first step is always to create a new folder that will contain your project.</p>
<div class="listingblock"><div class="content"><!-- Generator: GNU source-highlight 3.1.8
by Lorenzo Bettini
http://www.lorenzobettini.it
http://www.gnu.org/software/src-highlite -->
<pre><tt>$ mkdir hello_joe
$ cd hello_joe</tt></pre>
</div></div>
<p>Most people tend to put all their projects side by side in a common folder. We recommend keeping an organization similar to your remote repositories. For example, for GitHub users, put all your projects in a common folder with the same name as your username. For example <em>$HOME/ninenines/cowboy</em> for the Cowboy project.</p>
<h2 id="_downloading_erlang_mk">Downloading Erlang.mk</h2>
<p>At the time of writing, Erlang.mk is unlikely to be present in your Erlang distribution, or even in your OS packages.</p>
<p>The next step is therefore to download it:</p>
<div class="listingblock"><div class="content"><!-- Generator: GNU source-highlight 3.1.8
by Lorenzo Bettini
http://www.lorenzobettini.it
http://www.gnu.org/software/src-highlite -->
<pre><tt>$ wget https<font color="#990000">:</font>//erlang<font color="#990000">.</font>mk/erlang<font color="#990000">.</font>mk</tt></pre>
</div></div>
<p>Or:</p>
<div class="listingblock"><div class="content"><!-- Generator: GNU source-highlight 3.1.8
by Lorenzo Bettini
http://www.lorenzobettini.it
http://www.gnu.org/software/src-highlite -->
<pre><tt>$ curl -O https<font color="#990000">:</font>//erlang<font color="#990000">.</font>mk/erlang<font color="#990000">.</font>mk</tt></pre>
</div></div>
<p>Alternatively, just <a href="https://erlang.mk/erlang.mk">click on this link</a>.</p>
<p>Make sure you put the file inside the folder we created previously.</p>
<h2 id="_getting_started_with_otp_applications">Getting started with OTP applications</h2>
<p>An OTP application is an Erlang application that has a supervision tree. In other words, it will always have processes running.</p>
<p>This kind of project can be automatically generated by Erlang.mk. All you need to do is use the <code>bootstrap</code> target:</p>
<div class="listingblock"><div class="content"><!-- Generator: GNU source-highlight 3.1.8
by Lorenzo Bettini
http://www.lorenzobettini.it
http://www.gnu.org/software/src-highlite -->
<pre><tt>$ make -f erlang<font color="#990000">.</font>mk bootstrap</tt></pre>
</div></div>
<p>Something similar to the following snippet will then appear on your screen:</p>
<div class="listingblock"><div class="content"><!-- Generator: GNU source-highlight 3.1.8
by Lorenzo Bettini
http://www.lorenzobettini.it
http://www.gnu.org/software/src-highlite -->
<pre><tt>git clone https<font color="#990000">:</font>//github<font color="#990000">.</font>com/ninenines/erlang<font color="#990000">.</font>mk <font color="#990000">.</font>erlang<font color="#990000">.</font>mk<font color="#990000">.</font>build
Cloning into <font color="#FF0000">'.erlang.mk.build'</font><font color="#990000">...</font>
remote<font color="#990000">:</font> Counting objects<font color="#990000">:</font> <font color="#993399">4035</font><font color="#990000">,</font> <b><font color="#0000FF">done</font></b><font color="#990000">.</font>
remote<font color="#990000">:</font> Compressing objects<font color="#990000">:</font> <font color="#993399">100</font><font color="#990000">%</font> <font color="#990000">(</font><font color="#993399">12</font><font color="#990000">/</font><font color="#993399">12</font><font color="#990000">),</font> <b><font color="#0000FF">done</font></b><font color="#990000">.</font>
remote<font color="#990000">:</font> Total <font color="#993399">4035</font> <font color="#990000">(</font>delta <font color="#993399">8</font><font color="#990000">),</font> reused <font color="#993399">4</font> <font color="#990000">(</font>delta <font color="#993399">4</font><font color="#990000">),</font> pack-reused <font color="#993399">4019</font>
Receiving objects<font color="#990000">:</font> <font color="#993399">100</font><font color="#990000">%</font> <font color="#990000">(</font><font color="#993399">4035</font><font color="#990000">/</font><font color="#993399">4035</font><font color="#990000">),</font> <font color="#993399">1.10</font> MiB <font color="#990000">|</font> <font color="#993399">784.00</font> KiB/s<font color="#990000">,</font> <b><font color="#0000FF">done</font></b><font color="#990000">.</font>
Resolving deltas<font color="#990000">:</font> <font color="#993399">100</font><font color="#990000">%</font> <font color="#990000">(</font><font color="#993399">2442</font><font color="#990000">/</font><font color="#993399">2442</font><font color="#990000">),</font> <b><font color="#0000FF">done</font></b><font color="#990000">.</font>
Checking connectivity<font color="#990000">...</font> <b><font color="#0000FF">done</font></b><font color="#990000">.</font>
<b><font color="#0000FF">if</font></b> <font color="#990000">[</font> -f build<font color="#990000">.</font>config <font color="#990000">];</font> <b><font color="#0000FF">then</font></b> cp build<font color="#990000">.</font>config <font color="#990000">.</font>erlang<font color="#990000">.</font>mk<font color="#990000">.</font>build<font color="#990000">;</font> <b><font color="#0000FF">fi</font></b>
cd <font color="#990000">.</font>erlang<font color="#990000">.</font>mk<font color="#990000">.</font>build <font color="#990000">&amp;&amp;</font> make
make<font color="#990000">[</font><font color="#993399">1</font><font color="#990000">]:</font> Entering directory <font color="#FF0000">'/home/essen/tmp/hello_joe/.erlang.mk.build'</font>
awk <font color="#FF0000">'FNR==1 &amp;&amp; NR!=1{print ""}1'</font> core/core<font color="#990000">.</font>mk index<font color="#990000">/*.</font>mk core/index<font color="#990000">.</font>mk core/deps<font color="#990000">.</font>mk plugins/protobuffs<font color="#990000">.</font>mk core/erlc<font color="#990000">.</font>mk core/docs<font color="#990000">.</font>mk core/test<font color="#990000">.</font>mk plugins/asciidoc<font color="#990000">.</font>mk plugins/bootstrap<font color="#990000">.</font>mk plugins/c_src<font color="#990000">.</font>mk plugins/ci<font color="#990000">.</font>mk plugins/ct<font color="#990000">.</font>mk plugins/dialyzer<font color="#990000">.</font>mk plugins/edoc<font color="#990000">.</font>mk plugins/elvis<font color="#990000">.</font>mk plugins/erlydtl<font color="#990000">.</font>mk plugins/escript<font color="#990000">.</font>mk plugins/eunit<font color="#990000">.</font>mk plugins/relx<font color="#990000">.</font>mk plugins/shell<font color="#990000">.</font>mk plugins/triq<font color="#990000">.</font>mk plugins/xref<font color="#990000">.</font>mk plugins/cover<font color="#990000">.</font>mk <font color="#990000">\</font>
	<font color="#990000">|</font> sed <font color="#FF0000">'s/^ERLANG_MK_VERSION = .*/ERLANG_MK_VERSION = 1.2.0-642-gccd2b9f/'</font> <font color="#990000">&gt;</font> erlang<font color="#990000">.</font>mk
make<font color="#990000">[</font><font color="#993399">1</font><font color="#990000">]:</font> Leaving directory <font color="#FF0000">'/home/essen/tmp/hello_joe/.erlang.mk.build'</font>
cp <font color="#990000">.</font>erlang<font color="#990000">.</font>mk<font color="#990000">.</font>build/erlang<font color="#990000">.</font>mk <font color="#990000">.</font>/erlang<font color="#990000">.</font>mk
rm -rf <font color="#990000">.</font>erlang<font color="#990000">.</font>mk<font color="#990000">.</font>build</tt></pre>
</div></div>
<p>This is Erlang.mk bootstrapping itself. Indeed, the file you initially downloaded contains nothing more than the code needed to bootstrap. This operation is done only once. Consult the <a href="../updating">Updating Erlang.mk</a> chapter for more information.</p>
<p>Of course, the generated project can now be compiled:</p>
<div class="listingblock"><div class="content"><!-- Generator: GNU source-highlight 3.1.8
by Lorenzo Bettini
http://www.lorenzobettini.it
http://www.gnu.org/software/src-highlite -->
<pre><tt>$ make</tt></pre>
</div></div>
<p>Cheers!</p>
<h2 id="_getting_started_with_otp_libraries">Getting started with OTP libraries</h2>
<p>An OTP library is an Erlang application that has no supervision tree. In other words, it is nothing but modules.</p>
<p>This kind of project can also be generated by Erlang.mk, using the <code>bootstrap-lib</code> target:</p>
<div class="listingblock"><div class="content"><!-- Generator: GNU source-highlight 3.1.8
by Lorenzo Bettini
http://www.lorenzobettini.it
http://www.gnu.org/software/src-highlite -->
<pre><tt>$ make -f erlang<font color="#990000">.</font>mk bootstrap-lib</tt></pre>
</div></div>
<p>Erlang.mk will once again bootstrap itself and generate all the files for your project. You can now compile it:</p>
<div class="listingblock"><div class="content"><!-- Generator: GNU source-highlight 3.1.8
by Lorenzo Bettini
http://www.lorenzobettini.it
http://www.gnu.org/software/src-highlite -->
<pre><tt>$ make</tt></pre>
</div></div>
<p>Enjoy!</p>
<h2 id="_getting_started_with_otp_releases">Getting started with OTP releases</h2>
<p>An OTP release is the combination of the Erlang RunTime System (ERTS) along with all the libraries and files that your node will need to run. It is entirely self contained, and can often be sent as-is to your production system and run without any extra setup.</p>
<p>Erlang.mk can of course bootstrap your project to generate releases. You can use the <code>bootstrap-rel</code> target for this purpose:</p>
<div class="listingblock"><div class="content"><!-- Generator: GNU source-highlight 3.1.8
by Lorenzo Bettini
http://www.lorenzobettini.it
http://www.gnu.org/software/src-highlite -->
<pre><tt>$ make bootstrap-rel</tt></pre>
</div></div>
<p>This target can be combined with <code>bootstrap</code> or <code>bootstrap-lib</code> to create a project that will build a release:</p>
<div class="listingblock"><div class="content"><!-- Generator: GNU source-highlight 3.1.8
by Lorenzo Bettini
http://www.lorenzobettini.it
http://www.gnu.org/software/src-highlite -->
<pre><tt>$ make -f erlang<font color="#990000">.</font>mk bootstrap-lib bootstrap-rel</tt></pre>
</div></div>
<p>It is often very useful to keep the top-level project for commands useful during operations, and put the components of the system in separate applications that you will then depend on. Consult the <a href="../deps">Packages and dependencies</a> chapter for more information.</p>
<p>When you run <code>make</code> from now on, Erlang.mk will compile your project and build the release:</p>
<div class="listingblock"><div class="content"><!-- Generator: GNU source-highlight 3.1.8
by Lorenzo Bettini
http://www.lorenzobettini.it
http://www.gnu.org/software/src-highlite -->
<pre><tt>$ make
 APP    hello_joe<font color="#990000">.</font>app<font color="#990000">.</font>src
 GEN    distclean-relx-rel
 GEN    /home/essen/tmp/hello_joe/relx
<font color="#990000">===&gt;</font> Starting relx build process <font color="#990000">...</font>
<font color="#990000">===&gt;</font> Resolving OTP Applications from directories<font color="#990000">:</font>
          /home/essen/tmp/hello_joe/ebin
          /usr/lib/erlang/lib
          /home/essen/tmp/hello_joe/deps
<font color="#990000">===&gt;</font> Resolved hello_joe_release-<font color="#993399">1</font>
<font color="#990000">===&gt;</font> Including Erts from /usr/lib/erlang
<font color="#990000">===&gt;</font> release successfully created<font color="#990000">!</font></tt></pre>
</div></div>
<p>The first time you run this command, Erlang.mk will download <em>relx</em>, the release building tool. So don&apos;t worry if you see more output than above.</p>
<p>If building the release is slow, no need to upgrade your hardware just yet. Just consult the <a href="../relx">Releases</a> chapter for various tips to speed up build time during development.</p>
<p>You can start the release using the <em>./_rel/hello_joe_release/bin/hello_joe_release</em> script, or simply run <code>make run</code>. The latter will also compile your project and build the release if it wasn&apos;t already:</p>
<div class="listingblock"><div class="content"><!-- Generator: GNU source-highlight 3.1.8
by Lorenzo Bettini
http://www.lorenzobettini.it
http://www.gnu.org/software/src-highlite -->
<pre><tt>$ make run
 APP    hello_joe<font color="#990000">.</font>app<font color="#990000">.</font>src
 GEN    distclean-relx-rel
<font color="#990000">===&gt;</font> Starting relx build process <font color="#990000">...</font>
<font color="#990000">===&gt;</font> Resolving OTP Applications from directories<font color="#990000">:</font>
          /home/essen/tmp/hello_joe/ebin
          /usr/lib/erlang/lib
          /home/essen/tmp/hello_joe/deps
<font color="#990000">===&gt;</font> Resolved hello_joe_release-<font color="#993399">1</font>
<font color="#990000">===&gt;</font> Including Erts from /usr/lib/erlang
<font color="#990000">===&gt;</font> release successfully created<font color="#990000">!</font>
Exec<font color="#990000">:</font> /home/essen/tmp/hello_joe<font color="#990000">/</font>_rel/hello_joe_release/erts-<font color="#993399">7.0</font>/bin/erlexec -boot /home/essen/tmp/hello_joe<font color="#990000">/</font>_rel/hello_joe_release/releases<font color="#990000">/</font><font color="#993399">1</font>/hello_joe_release -boot_var ERTS_LIB_DIR /home/essen/tmp/hello_joe<font color="#990000">/</font>_rel/hello_joe_release/erts-<font color="#993399">7.0</font><font color="#990000">/..</font>/lib -env ERL_LIBS /home/essen/tmp/hello_joe<font color="#990000">/</font>_rel/hello_joe_release/releases<font color="#990000">/</font><font color="#993399">1</font>/lib -config /home/essen/tmp/hello_joe<font color="#990000">/</font>_rel/hello_joe_release/releases<font color="#990000">/</font><font color="#993399">1</font>/sys<font color="#990000">.</font>config -args_file /home/essen/tmp/hello_joe<font color="#990000">/</font>_rel/hello_joe_release/releases<font color="#990000">/</font><font color="#993399">1</font>/vm<font color="#990000">.</font>args -- console
Root<font color="#990000">:</font> /home/essen/tmp/hello_joe<font color="#990000">/</font>_rel/hello_joe_release
/home/essen/tmp/hello_joe<font color="#990000">/</font>_rel/hello_joe_release
heart_beat_kill_pid <font color="#990000">=</font> <font color="#993399">16389</font>
Erlang/OTP <font color="#993399">18</font> <font color="#990000">[</font>erts-<font color="#993399">7.0</font><font color="#990000">]</font> <font color="#990000">[</font><b><font color="#0000FF">source</font></b><font color="#990000">]</font> <font color="#990000">[</font><font color="#993399">64</font>-bit<font color="#990000">]</font> <font color="#990000">[</font>smp<font color="#990000">:</font><font color="#993399">4</font><font color="#990000">:</font><font color="#993399">4</font><font color="#990000">]</font> <font color="#990000">[</font>async-threads<font color="#990000">:</font><font color="#993399">10</font><font color="#990000">]</font> <font color="#990000">[</font>hipe<font color="#990000">]</font> <font color="#990000">[</font>kernel-poll<font color="#990000">:</font><b><font color="#0000FF">false</font></b><font color="#990000">]</font>

Eshell V7<font color="#990000">.</font><font color="#993399">0</font>  <font color="#990000">(</font>abort with <font color="#990000">^</font>G<font color="#990000">)</font>
<font color="#990000">(</font>hello_joe@<font color="#993399">127.0</font><font color="#990000">.</font><font color="#993399">0.1</font><font color="#990000">)</font><font color="#993399">1</font><font color="#990000">&gt;</font> </tt></pre>
</div></div>
<p>Simple as that!</p>
<h2 id="_getting_started_from_scratch">Getting started from scratch</h2>
<p>If you already have an application, or you want to have full control over what files will be created, you can setup Erlang.mk manually.</p>
<p>Erlang.mk is very easy to setup: all that you need to do is to create a folder, put Erlang.mk in it, and write a one line Makefile containing:</p>
<div class="listingblock"><div class="content"><!-- Generator: GNU source-highlight 3.1.8
by Lorenzo Bettini
http://www.lorenzobettini.it
http://www.gnu.org/software/src-highlite -->
<pre><tt>include erlang.mk</tt></pre>
</div></div>
<p>For a step by step:</p>
<div class="listingblock"><div class="content"><!-- Generator: GNU source-highlight 3.1.8
by Lorenzo Bettini
http://www.lorenzobettini.it
http://www.gnu.org/software/src-highlite -->
<pre><tt>$ mkdir hello_joe
$ cd hello_joe
$ curl https<font color="#990000">:</font>//erlang<font color="#990000">.</font>mk/erlang<font color="#990000">.</font>mk -o erlang<font color="#990000">.</font>mk
$ echo <font color="#FF0000">"include erlang.mk"</font> <font color="#990000">&gt;</font> Makefile
$ make</tt></pre>
</div></div>
<p>From that point onward you can create an <code>src/</code> folder or start using templates.</p>
<h2 id="_using_spaces_instead_of_tabs">Using spaces instead of tabs</h2>
<p>Erlang.mk defaults to tabs when creating files from templates. This is in part because of a personal preference, and in part because it is much easier to convert tabs to spaces than the opposite.</p>
<p>Use the <code>SP</code> variable if you prefer spaces. Set it to the number of spaces per indentation level you want.</p>
<p>For example, if you prefer two spaces per indentation level:</p>
<div class="listingblock"><div class="content"><!-- Generator: GNU source-highlight 3.1.8
by Lorenzo Bettini
http://www.lorenzobettini.it
http://www.gnu.org/software/src-highlite -->
<pre><tt>$ make -f erlang<font color="#990000">.</font>mk bootstrap <font color="#009900">SP</font><font color="#990000">=</font><font color="#993399">2</font></tt></pre>
</div></div>
<p>When you bootstrap the project initially, the variable automatically gets added to the Makefile, so you only need to provide it when you get started.</p>
<h2 id="_using_templates">Using templates</h2>
<p>It is no secret that Erlang&apos;s OTP behaviors tend to have some boilerplate. It is rarely an issue of course, except when creating new modules. That&apos;s why Erlang.mk not only comes with templates for generating projects, but also individual modules!</p>
<p>You can list all available templates with the <code>list-templates</code> target:</p>
<div class="listingblock"><div class="content"><!-- Generator: GNU source-highlight 3.1.8
by Lorenzo Bettini
http://www.lorenzobettini.it
http://www.gnu.org/software/src-highlite -->
<pre><tt>$ make list-templates
Available templates<font color="#990000">:</font> cowboy_http cowboy_loop cowboy_rest cowboy_ws gen_fsm gen_server gen_statem ranch_protocol supervisor</tt></pre>
</div></div>
<p>To generate a module, let&apos;s say a <code>gen_server</code>, all you need to do is to call <code>make new</code> with the appropriate arguments:</p>
<div class="listingblock"><div class="content"><!-- Generator: GNU source-highlight 3.1.8
by Lorenzo Bettini
http://www.lorenzobettini.it
http://www.gnu.org/software/src-highlite -->
<pre><tt>$ make new <font color="#009900">t</font><font color="#990000">=</font>gen_server <font color="#009900">n</font><font color="#990000">=</font>my_server</tt></pre>
</div></div>
<p>This will create a module located in <em>src/my_server.erl</em> using the <code>gen_server</code> template.</p>
<p>This module is automatically compiled the next time you run <code>make</code>:</p>
<div class="listingblock"><div class="content"><!-- Generator: GNU source-highlight 3.1.8
by Lorenzo Bettini
http://www.lorenzobettini.it
http://www.gnu.org/software/src-highlite -->
<pre><tt>$ make
 ERLC   my_server<font color="#990000">.</font>erl
 APP    hello_joe<font color="#990000">.</font>app<font color="#990000">.</font>src</tt></pre>
</div></div>
<p>All that&apos;s left to do is to open it in your favorite editor and make it do something!</p>
<h2 id="_hiding_erlang_mk_from_git">Hiding Erlang.mk from git</h2>
<p>Erlang.mk is a large text file. It can easily take a large part of a <code>git diff</code> or a <code>git grep</code> command. You can avoid this by telling Git that <em>erlang.mk</em> is a binary file.</p>
<p>Add this to your <em>.gitattributes</em> file. This is a file that you can create at the root of your repository:</p>
<div class="listingblock"><div class="content"><pre>erlang.mk -diff</pre></div></div>
<p>The <em>erlang.mk</em> file will still appear in diffs and greps, but as a binary file, meaning its contents won&apos;t be shown by default anymore.</p>
<h2 id="_getting_help">Getting help</h2>
<p>During development, if you don&apos;t remember the name of a target, you can always run <code>make help</code>:</p>
<div class="listingblock"><div class="content"><!-- Generator: GNU source-highlight 3.1.8
by Lorenzo Bettini
http://www.lorenzobettini.it
http://www.gnu.org/software/src-highlite -->
<pre><tt>$ make <b><font color="#0000FF">help</font></b>
erlang<font color="#990000">.</font>mk <font color="#990000">(</font>version <font color="#993399">1.2</font><font color="#990000">.</font><font color="#993399">0</font>-<font color="#993399">642</font>-gccd2b9f<font color="#990000">)</font> is distributed under the terms of the ISC License<font color="#990000">.</font>
Copyright <font color="#990000">(</font>c<font color="#990000">)</font> <font color="#993399">2013</font>-<font color="#993399">2016</font> Loïc Hoguin <font color="#990000">&lt;</font>essen@ninenines<font color="#990000">.</font>eu<font color="#990000">&gt;</font>

Usage<font color="#990000">:</font> <font color="#990000">[</font><font color="#009900">V</font><font color="#990000">=</font><font color="#993399">1</font><font color="#990000">]</font> make <font color="#990000">[</font>target<font color="#990000">]...</font>

Core targets<font color="#990000">:</font>
  all           Run deps<font color="#990000">,</font> app and rel targets <b><font color="#0000FF">in</font></b> that order
  app           Compile the project
  deps          Fetch dependencies <font color="#990000">(</font><b><font color="#0000FF">if</font></b> needed<font color="#990000">)</font> and compile them
  search <font color="#009900">q</font><font color="#990000">=...</font>  Search <b><font color="#0000FF">for</font></b> a package <b><font color="#0000FF">in</font></b> the built-in index
  rel           Build a release <b><font color="#0000FF">for</font></b> this project<font color="#990000">,</font> <b><font color="#0000FF">if</font></b> applicable
  docs          Build the documentation <b><font color="#0000FF">for</font></b> this project
  install-docs  Install the man pages <b><font color="#0000FF">for</font></b> this project
  check         Compile and run all tests and analysis <b><font color="#0000FF">for</font></b> this project
  tests         Run the tests <b><font color="#0000FF">for</font></b> this project
  clean         Delete temporary and output files from most targets
  distclean     Delete all temporary and output files
  <b><font color="#0000FF">help</font></b>          Display this <b><font color="#0000FF">help</font></b> and <b><font color="#0000FF">exit</font></b>
  erlang-mk     Update erlang<font color="#990000">.</font>mk to the latest version

Bootstrap targets<font color="#990000">:</font>
  bootstrap          Generate a skeleton of an OTP application
  bootstrap-lib      Generate a skeleton of an OTP library
  bootstrap-rel      Generate the files needed to build a release
  new <font color="#009900">t</font><font color="#990000">=</font>TPL <font color="#009900">n</font><font color="#990000">=</font>NAME   Generate a module NAME based on the template TPL
  list-templates     List available templates
<font color="#990000">...</font></tt></pre>
</div></div>
<p>This guide should provide any other answer. If not, please open a ticket on <a href="https://github.com/ninenines/erlang.mk/issues">the official repository</a> and we will work on improving the guide.</p>
<p>Commercial support is available through Nine Nines. Please contact Loïc Hoguin by sending an email to <a href="mailto:[email protected]">[email protected]</a>.</p>




	
		
		
		
		
		

		<nav style="margin:1em 0">
			
				<a style="float:left" href="https://ninenines.eu/docs/en/erlang.mk/1/guide/installation/">
					Installation
				</a>
			

			
				<a style="float:right" href="https://ninenines.eu/docs/en/erlang.mk/1/guide/overview/">
					Overview
				</a>
			
		</nav>
	



</div>

<div class="span3 sidecol">


<h3>
	Erlang.mk
	1
	
	User Guide
</h3>

<ul>
	
	
	
</ul>

<h4 id="docs-nav">Navigation</h4>

<h4>Version select</h4>
<ul>
	
	
	
		<li><a href="/docs/en/erlang.mk/1/guide">1</a></li>
	
</ul>

<h3 id="_like_my_work__donate">Like my work? Donate!</h3>
<p>Donate to Loïc Hoguin because his work on Cowboy, Ranch, Gun and Erlang.mk is fantastic:</p>
<form action="https://www.paypal.com/cgi-bin/webscr" method="post" style="display:inline">
<input type="hidden" name="cmd" value="_donations">
<input type="hidden" name="business" value="[email protected]">
<input type="hidden" name="lc" value="FR">
<input type="hidden" name="item_name" value="Loic Hoguin">
<input type="hidden" name="item_number" value="99s">
<input type="hidden" name="currency_code" value="EUR">
<input type="hidden" name="bn" value="PP-DonationsBF:btn_donate_LG.gif:NonHosted">
<input type="image" src="https://www.paypalobjects.com/en_US/i/btn/btn_donate_LG.gif" border="0" name="submit" alt="PayPal - The safer, easier way to pay online!">
<img alt="" border="0" src="https://www.paypalobjects.com/fr_FR/i/scr/pixel.gif" width="1" height="1">
</form><p>Recurring payment options are also available via <a href="https://salt.bountysource.com/teams/ninenines">BountySource</a>. These funds are used to cover the recurring expenses like dedicated servers or domain names.</p>



</div>
</div>
</div>
</div>

      <footer>
        <div class="container">
          <div class="row">
            <div class="span6">
              <p id="scroll-top"><a href="#">↑ Scroll to top</a></p>
              <nav>
                <ul>
                  <li><a href="mailto:[email protected]" title="Contact us">Contact us</a></li><li><a href="https://github.com/ninenines/ninenines.github.io" title="Github repository">Contribute to this site</a></li>
                </ul>
              </nav>
            </div>
            <div class="span6 credits">
               <p><img src="/img/footer_logo.png"></p>
               <p>Copyright &copy; Loïc Hoguin 2012-2018</p>
            </div>
          </div>
        </div>
      </footer>

    
    <script src="/js/custom.js"></script>
  </body>
</html>