aboutsummaryrefslogtreecommitdiffstats
path: root/Makefile
diff options
context:
space:
mode:
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile28
1 files changed, 16 insertions, 12 deletions
diff --git a/Makefile b/Makefile
index e98b409..fb00e22 100644
--- a/Makefile
+++ b/Makefile
@@ -4,6 +4,9 @@ PROJECT = cowboy
RANCH_VSN = 0.6.0
ERLC_OPTS = -Werror +debug_info +warn_export_all # +bin_opt_info +warn_missing_spec
+DEPS_DIR ?= $(CURDIR)/deps
+export DEPS_DIR
+
.PHONY: all clean-all app clean docs clean-docs tests autobahn build-plt dialyze
# Application.
@@ -12,25 +15,26 @@ all: app
clean-all: clean clean-docs
rm -f .$(PROJECT).plt
- rm -rf deps logs
+ rm -rf $(DEPS_DIR) logs
deps/ranch:
- @mkdir -p deps/
- git clone -n -- https://github.com/extend/ranch.git deps/ranch
- cd deps/ranch ; git checkout -q $(RANCH_VSN)
+ @mkdir -p $(DEPS_DIR)
+ git clone -n -- https://github.com/extend/ranch.git $(DEPS_DIR)/ranch
+ cd $(DEPS_DIR)/ranch ; git checkout -q $(RANCH_VSN)
MODULES = $(shell ls src/*.erl | sed 's/src\///;s/\.erl/,/' | sed '$$s/.$$//')
app: deps/ranch
- @cd deps/ranch ; make
+ @$(MAKE) -C $(DEPS_DIR)/ranch
@mkdir -p ebin/
- @cat src/cowboy.app.src \
+ @cat src/$(PROJECT).app.src \
| sed 's/{modules, \[\]}/{modules, \[$(MODULES)\]}/' \
- > ebin/cowboy.app
- erlc -v $(ERLC_OPTS) -o ebin/ -pa ebin/ src/cowboy_middleware.erl src/*.erl
+ > ebin/$(PROJECT).app
+ erlc -v $(ERLC_OPTS) -o ebin/ -pa ebin/ \
+ src/$(PROJECT)_middleware.erl src/*.erl
clean:
- -@cd deps/ranch && make clean
+ -@$(MAKE) -C $(DEPS_DIR)/ranch clean
rm -rf ebin/
rm -f test/*.beam
rm -f erl_crash.dump
@@ -38,7 +42,7 @@ clean:
# Documentation.
docs: clean-docs
- erl -noshell -eval 'edoc:application(cowboy, ".", []), init:stop().'
+ erl -noshell -eval 'edoc:application($(PROJECT), ".", []), init:stop().'
clean-docs:
rm -f doc/*.css
@@ -49,7 +53,7 @@ clean-docs:
# Tests.
CT_RUN = ct_run \
- -pa ebin deps/*/ebin \
+ -pa ebin $(DEPS_DIR)/*/ebin \
-dir test \
-logdir logs \
-cover test/cover.spec
@@ -67,7 +71,7 @@ autobahn: clean app
build-plt: app
@dialyzer --build_plt --output_plt .$(PROJECT).plt \
- --apps erts kernel stdlib sasl inets crypto public_key ssl deps/ranch
+ --apps erts kernel stdlib crypto public_key ssl $(DEPS_DIR)/ranch
dialyze:
@dialyzer --src src --plt .$(PROJECT).plt --no_native \