aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLoïc Hoguin <[email protected]>2013-01-17 16:00:05 +0100
committerLoïc Hoguin <[email protected]>2013-01-17 16:04:03 +0100
commit563e7d91ce79a1e60a9c21f2e2a7a9e0bccfe922 (patch)
tree0aeba4918ba6d3e583e21f01bb7deeaa200b4256
parent305e639feff66a413e17ed00ff48609c5abba85e (diff)
downloadcowboy-563e7d91ce79a1e60a9c21f2e2a7a9e0bccfe922.tar.gz
cowboy-563e7d91ce79a1e60a9c21f2e2a7a9e0bccfe922.tar.bz2
cowboy-563e7d91ce79a1e60a9c21f2e2a7a9e0bccfe922.zip
Add recursive dependency fetching to the Makefile
Also small other changes like how we build the PLT.
-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 \