<commit_before>erlang.mk
=========

Common Makefile rules for building and testing Erlang applications.

Also features support for dependencies and a package index.

Requirements
------------

`erlang.mk` requires GNU Make and expects to be ran in a standard
unix environment with Erlang installed and in the `$PATH`.

`erlang.mk` uses `wget` for downloading the package index file.

`erlang.mk` will NOT work if the path contains spaces. This is a
limitation of POSIX compatible make build tools.

Usage
-----

Add the file `erlang.mk` to your project, then use the following base
Makefile:

``` Makefile
PROJECT = my_project
include erlang.mk
```

Alternatively you can use the following command to generate a skeleton
of an OTP application:

``` bash
$ make -f erlang.mk bootstrap
```

To generate a skeleton of an OTP library:

``` bash
$ make -f erlang.mk bootstrap-lib
```

Finally if you are going to create a release of this project you may
want to also use the `bootstrap-rel` target.

You can combine targets to perform many operations. For example, the
shell command `make clean app` will have the effect of recompiling
the application fully, without touching the dependencies.

A common workflow when editing a file would be to run `make` regularly
to see if it compiles (or less often `make clean app` if you want to
recompile everything), followed by `make dialyze` to see if there are
any type errors and then `make tests` to run the test suites. The
result of the test runs can be browsed from the `logs/index.html` file.

Getting help
------------

You can use `make help` to get help about erlang.mk or its plugins.

Packages
--------

A package index functionality is included with erlang.mk.

To use a package, you simply have to add it to the `DEPS` variable
in your Makefile. For example this depends on Cowboy:

``` Makefile
PROJECT = my_project
DEPS = cowboy
include erlang.mk
```

If the project you want is not included in the package index, or if
you want a different version, a few options are available. You can
edit the package file and contribute to it by opening a pull request.
You can use a custom package file, in which case you will probably
want to set the `PKG_FILE2` variable to its location. Or you can
put the project information directly in the Makefile.

In the latter case you need to create a variable `dep_*` with the
asterisk replaced by the project name, for example `cowboy`. This
variable must contain three things: the fetching method used, the
URL and the version requested. These lines must be defined before
the erlang.mk include line.

The following snippet overrides the Cowboy version required:

``` Makefile
DEPS = cowboy
dep_cowboy = git https://github.com/ninenines/cowboy 1.0.0
```

They will always be compiled using the command `make`. If the dependency
does not feature a Makefile, then erlang.mk will be used for building.<commit_msg>Update README to include multi dependency example<commit_after>erlang.mk
=========

Common Makefile rules for building and testing Erlang applications.

Also features support for dependencies and a package index.

Requirements
------------

`erlang.mk` requires GNU Make and expects to be ran in a standard
unix environment with Erlang installed and in the `$PATH`.

`erlang.mk` uses `wget` for downloading the package index file.

`erlang.mk` will NOT work if the path contains spaces. This is a
limitation of POSIX compatible make build tools.

Usage
-----

Add the file `erlang.mk` to your project, then use the following base
Makefile:

``` Makefile
PROJECT = my_project
include erlang.mk
```

Alternatively you can use the following command to generate a skeleton
of an OTP application:

``` bash
$ make -f erlang.mk bootstrap
```

To generate a skeleton of an OTP library:

``` bash
$ make -f erlang.mk bootstrap-lib
```

Finally if you are going to create a release of this project you may
want to also use the `bootstrap-rel` target.

You can combine targets to perform many operations. For example, the
shell command `make clean app` will have the effect of recompiling
the application fully, without touching the dependencies.

A common workflow when editing a file would be to run `make` regularly
to see if it compiles (or less often `make clean app` if you want to
recompile everything), followed by `make dialyze` to see if there are
any type errors and then `make tests` to run the test suites. The
result of the test runs can be browsed from the `logs/index.html` file.

Getting help
------------

You can use `make help` to get help about erlang.mk or its plugins.

Packages
--------

A package index functionality is included with erlang.mk.

To use a package, you simply have to add it to the `DEPS` variable
in your Makefile. For example this depends on Cowboy:

``` Makefile
PROJECT = my_project
DEPS = cowboy
include erlang.mk
```

If you need to specify multiple dependencies, you can specify each
of them separated by spaces:

``` Makefile
PROJECT = my_project
DEPS = cowboy gun
include erlang.mk
```

If the project you want is not included in the package index, or if
you want a different version, a few options are available. You can
edit the package file and contribute to it by opening a pull request.
You can use a custom package file, in which case you will probably
want to set the `PKG_FILE2` variable to its location. Or you can
put the project information directly in the Makefile.

In the latter case you need to create a variable `dep_*` with the
asterisk replaced by the project name, for example `cowboy`. This
variable must contain three things: the fetching method used, the
URL and the version requested. These lines must be defined before
the erlang.mk include line.

The following snippet overrides the Cowboy version required:

``` Makefile
DEPS = cowboy
dep_cowboy = git https://github.com/ninenines/cowboy 1.0.0
```

They will always be compiled using the command `make`. If the dependency
does not feature a Makefile, then erlang.mk will be used for building.
{'fraction_non_alphanumeric': 0.06676656676656677, 'fraction_numerical': 0.001332001332001332, 'mean_word_length': 3.997504159733777, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3884005', 'n_tokens_mistral': 1641, 'n_tokens_neox': 1588, 'n_words': 925}