Chapter 4. Cheat sheet

Run these from the project root, the directory with the Makefile and erlang.mk. Use make -C path for a nested application or dependency.

4.1. General commands

$ make              # build app and/or release
$ make docs         # project documentation
$ make tests        # all test plugins
$ make check        # tests + Dialyzer (+ extras)
$ make dialyze xref # static checks only

make docs runs the documentation plugins that are enabled: EDoc, Asciidoc and Sphinx. make check runs the tests and Dialyzer. Concuerror is included when CONCUERROR_TESTS is set. Xref is a separate target.

4.2. Running tests

$ make eunit                    # all EUnit tests
$ make eunit EUNIT_OPTS=verbose # verbose output
$ make eunit t=mod              # one module
$ make eunit t=mod:case         # one test

$ make ct                       # all Common Test suites
$ make ct-http                  # test/http_SUITE.erl
$ make ct-http t=group          # one group
$ make ct-http t=group:case     # one case in a group
$ make ct-http t=[g1,g2]:case   # nested groups

$ make proper                   # all PropEr properties
$ make proper t=foo_tests       # one module
$ make proper t=foo_tests:bar   # one property

$ make triq                     # all Triq properties
$ make triq t=foo_tests         # one module
$ make triq t=foo_tests:bar     # one property

See EUnit, Common Test, PropEr, Triq and code coverage.

4.3. Shell

The shell target does not build the application:

$ make app && make shell SHELL_OPTS='-eval "my_app:run()."'

See the Erlang shell chapter for SHELL_OPTS and for make shell RELOAD=1.

4.4. Cleaning

$ make clean      # this app's build output
$ make distclean  # everything (deps, PLT, CT logs, tmp, ...)

4.5. Bootstrap and templates

$ make -f erlang.mk bootstrap
$ make -f erlang.mk bootstrap-lib
$ make -f erlang.mk bootstrap-lib bootstrap-rel
$ make list-templates
$ make new t=gen_server n=my_server

See Getting started.

4.6. Packages

List applications in DEPS before including Erlang.mk. dep_NAME = hex VERSION downloads that version from Hex. Add the Hex package name after the version when it differs from the application name:

DEPS = cowboy
dep_cowboy = hex 2.19.0

Dependencies are fetched and built when running make.

See Packages and dependencies.

4.7. Dependency lock

$ make lock         # fetch anything missing and enable the pins
$ make unlock       # disable the pins and keep lock.mk

lock.mk records git, git-subfolder and hex dependencies, including dependencies of dependencies. ERLANG_MK_LOCK := 1 enables the dep_* lines inside ifdef ERLANG_MK_LOCK. Commit the file. The file is not removed on distclean.

See Packages and dependencies.

4.8. Dependency tree

$ make tree

Prints the name and version of BUILD_DEPS and DEPS. See Packages and dependencies.

4.9. Help and updating

$ make help
$ make erlang-mk

See Updating Erlang.mk.

4.10. Running a release

$ make run

See Releases.