diff options
Diffstat (limited to 'guide/getting_started.html')
-rw-r--r-- | guide/getting_started.html | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/guide/getting_started.html b/guide/getting_started.html index b34b6e0..1d63499 100644 --- a/guide/getting_started.html +++ b/guide/getting_started.html @@ -115,13 +115,22 @@ heart_beat_kill_pid = 16389 Erlang/OTP 18 [erts-7.0] [source] [64-bit] [smp:4:4] [async-threads:10] [hipe] [kernel-poll:false] Eshell V7.0 (abort with ^G) -([email protected])1></pre><p>Simple as that!</p></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="_using_spaces_instead_of_tabs"></a>2.6. Using spaces instead of tabs</h2></div></div></div><p>Erlang.mk defaults to tabs when creating files from templates. +([email protected])1></pre><p>Simple as that!</p></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="_getting_started_from_scratch"></a>2.6. Getting started from scratch</h2></div></div></div><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><pre class="programlisting">include erlang.mk</pre><p>For a step by step:</p><pre class="programlisting">$ mkdir hello_joe +$ cd hello_joe +$ curl https://raw.githubusercontent.com/ninenines/erlang.mk/master/erlang.mk +$ echo "include erlang.mk" > Makefile +$ make</pre><p>From that point onward you can create an <code class="literal">src/</code> folder or start +using templates.</p></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="_using_spaces_instead_of_tabs"></a>2.7. Using spaces instead of tabs</h2></div></div></div><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 class="literal">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><pre class="programlisting">$ make -f erlang.mk bootstrap SP=2</pre><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></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="_using_templates"></a>2.7. Using templates</h2></div></div></div><p>It is no secret that Erlang’s OTP behaviors tend to have some +you get started.</p></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="_using_templates"></a>2.8. Using templates</h2></div></div></div><p>It is no secret that Erlang’s OTP behaviors tend to have some boilerplate. It is rarely an issue of course, except when creating new modules. That’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 class="literal">list-templates</code> @@ -132,12 +141,12 @@ using the <code class="literal">gen_server</code> template.</p><p>This module is <code class="literal">make</code>:</p><pre class="programlisting">$ make ERLC my_server.erl APP hello_joe.app.src</pre><p>All that’s left to do is to open it in your favorite editor -and make it do something!</p></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="_hiding_erlang_mk_from_git"></a>2.8. Hiding Erlang.mk from git</h2></div></div></div><p>Erlang.mk is a large text file. It can easily take a large part of +and make it do something!</p></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="_hiding_erlang_mk_from_git"></a>2.9. Hiding Erlang.mk from git</h2></div></div></div><p>Erlang.mk is a large text file. It can easily take a large part of a <code class="literal">git diff</code> or a <code class="literal">git grep</code> command. You can avoid this by telling Git that <span class="emphasis"><em>erlang.mk</em></span> is a binary file.</p><p>Add this to your <span class="emphasis"><em>.gitattributes</em></span> file. This is a file that you can create at the root of your repository:</p><pre class="screen">erlang.mk -diff</pre><p>The <span class="emphasis"><em>erlang.mk</em></span> file will still appear in diffs and greps, but as a binary file, meaning its contents won’t be shown by default -anymore.</p></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="_getting_help"></a>2.9. Getting help</h2></div></div></div><p>During development, if you don’t remember the name of a target, +anymore.</p></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="_getting_help"></a>2.10. Getting help</h2></div></div></div><p>During development, if you don’t remember the name of a target, you can always run <code class="literal">make help</code>:</p><pre class="programlisting">$ make help erlang.mk (version 1.2.0-642-gccd2b9f) is distributed under the terms of the ISC License. Copyright (c) 2013-2015 Loïc Hoguin <[email protected]> |