Skip to content

Instantly share code, notes, and snippets.

@leandrosilva
Created March 11, 2011 15:58
Show Gist options
  • Star 8 You must be signed in to star a gist
  • Fork 3 You must be signed in to fork a gist
  • Save leandrosilva/866072 to your computer and use it in GitHub Desktop.
Save leandrosilva/866072 to your computer and use it in GitHub Desktop.
Makefile to compile, run, and test Erlang applications
APP_NAME := my_awesome_app
all: compile
compile: clear
@cp src/$(APP_NAME).app ebin/
@erlc -pa ebin/ -o ebin/ src/*.erl
compile_test: compile
@erlc -pa ebin/ -o ebin/ test/*.erl
run:
@erl -pa ebin/ deps/**/ebin/ -sname $(APP_NAME) -s $(APP_NAME) \
-config priv/config/production
run_dev:
@erl -pa ebin/ deps/**/ebin/ -sname $(APP_NAME) \
-boot start_sasl -s $(APP_NAME) \
-config priv/config/development
run_test: compile_test
@erl -noshell -pa ebin/ deps/**/ebin/ -s $(APP_NAME) \
-run $(MODULE) test -run init stop \
-config priv/config/test
run_all_tests: compile_test
@for fullfilename in `find ./test -name "*_test.erl"`; do \
filename=$$(basename $$fullfilename); \
module=$${filename%%.*}; \
echo ; \
echo running: $$module; \
erl -noshell -pa ebin/ deps/**/ebin/ -s $(APP_NAME) \
-run $$module test -run init stop \
-config priv/config/test; \
done
clear:
@rm -f ebin/*.beam
@rm -f erl_crash.dump
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment