2011-03-07 22:59:22 +01:00
|
|
|
# See LICENSE for licensing information.
|
|
|
|
|
2012-04-12 22:04:58 +02:00
|
|
|
PROJECT = cowboy
|
2013-01-05 17:25:04 +01:00
|
|
|
RANCH_VSN = 0.6.0
|
|
|
|
ERLC_OPTS = -Werror +debug_info +warn_export_all # +bin_opt_info +warn_missing_spec
|
2012-04-12 22:04:58 +02:00
|
|
|
|
2013-01-17 16:00:05 +01:00
|
|
|
DEPS_DIR ?= $(CURDIR)/deps
|
|
|
|
export DEPS_DIR
|
|
|
|
|
2013-01-05 17:25:04 +01:00
|
|
|
.PHONY: all clean-all app clean docs clean-docs tests autobahn build-plt dialyze
|
|
|
|
|
|
|
|
# Application.
|
2011-03-23 10:54:09 +01:00
|
|
|
|
2011-03-07 22:59:22 +01:00
|
|
|
all: app
|
|
|
|
|
2013-01-05 17:25:04 +01:00
|
|
|
clean-all: clean clean-docs
|
|
|
|
rm -f .$(PROJECT).plt
|
2013-01-17 16:00:05 +01:00
|
|
|
rm -rf $(DEPS_DIR) logs
|
2011-03-07 22:59:22 +01:00
|
|
|
|
2012-08-27 11:50:35 +02:00
|
|
|
deps/ranch:
|
2013-01-17 16:00:05 +01:00
|
|
|
@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)
|
2013-01-05 17:25:04 +01:00
|
|
|
|
|
|
|
MODULES = $(shell ls src/*.erl | sed 's/src\///;s/\.erl/,/' | sed '$$s/.$$//')
|
2011-07-20 17:38:10 +02:00
|
|
|
|
2012-08-27 11:50:35 +02:00
|
|
|
app: deps/ranch
|
2013-01-17 16:00:05 +01:00
|
|
|
@$(MAKE) -C $(DEPS_DIR)/ranch
|
2013-01-05 17:25:04 +01:00
|
|
|
@mkdir -p ebin/
|
2013-01-17 16:00:05 +01:00
|
|
|
@cat src/$(PROJECT).app.src \
|
2013-01-05 17:25:04 +01:00
|
|
|
| sed 's/{modules, \[\]}/{modules, \[$(MODULES)\]}/' \
|
2013-01-17 16:00:05 +01:00
|
|
|
> ebin/$(PROJECT).app
|
|
|
|
erlc -v $(ERLC_OPTS) -o ebin/ -pa ebin/ \
|
|
|
|
src/$(PROJECT)_middleware.erl src/*.erl
|
2012-04-12 22:04:58 +02:00
|
|
|
|
2011-03-07 22:59:22 +01:00
|
|
|
clean:
|
2013-01-17 16:00:05 +01:00
|
|
|
-@$(MAKE) -C $(DEPS_DIR)/ranch clean
|
2013-01-05 17:25:04 +01:00
|
|
|
rm -rf ebin/
|
2011-04-08 16:30:37 +02:00
|
|
|
rm -f test/*.beam
|
2011-03-07 22:59:22 +01:00
|
|
|
rm -f erl_crash.dump
|
|
|
|
|
2013-01-05 17:25:04 +01:00
|
|
|
# Documentation.
|
|
|
|
|
2012-04-13 12:29:13 +02:00
|
|
|
docs: clean-docs
|
2013-01-17 16:00:05 +01:00
|
|
|
erl -noshell -eval 'edoc:application($(PROJECT), ".", []), init:stop().'
|
2012-04-13 12:29:13 +02:00
|
|
|
|
|
|
|
clean-docs:
|
|
|
|
rm -f doc/*.css
|
|
|
|
rm -f doc/*.html
|
|
|
|
rm -f doc/*.png
|
|
|
|
rm -f doc/edoc-info
|
|
|
|
|
2012-04-12 22:04:58 +02:00
|
|
|
# Tests.
|
|
|
|
|
2013-01-04 17:56:49 +01:00
|
|
|
CT_RUN = ct_run \
|
2013-01-17 16:00:05 +01:00
|
|
|
-pa ebin $(DEPS_DIR)/*/ebin \
|
2013-01-04 17:56:49 +01:00
|
|
|
-dir test \
|
|
|
|
-logdir logs \
|
|
|
|
-cover test/cover.spec
|
|
|
|
|
2013-01-05 17:25:04 +01:00
|
|
|
tests: ERLC_OPTS += -DTEST=1
|
|
|
|
tests: clean app
|
2013-01-04 17:56:49 +01:00
|
|
|
@mkdir -p logs/
|
2013-01-05 17:25:04 +01:00
|
|
|
@$(CT_RUN) -suite eunit_SUITE http_SUITE ws_SUITE
|
2011-12-24 00:58:03 +01:00
|
|
|
|
2013-01-10 19:54:10 +01:00
|
|
|
autobahn: clean app
|
2013-01-04 17:56:49 +01:00
|
|
|
@mkdir -p logs/
|
|
|
|
@$(CT_RUN) -suite autobahn_SUITE
|
2012-04-12 22:04:58 +02:00
|
|
|
|
|
|
|
# Dialyzer.
|
2011-04-03 16:07:27 +02:00
|
|
|
|
2013-01-05 17:25:04 +01:00
|
|
|
build-plt: app
|
|
|
|
@dialyzer --build_plt --output_plt .$(PROJECT).plt \
|
2013-01-17 16:00:05 +01:00
|
|
|
--apps erts kernel stdlib crypto public_key ssl $(DEPS_DIR)/ranch
|
2011-06-21 17:24:07 +02:00
|
|
|
|
2011-04-03 16:07:27 +02:00
|
|
|
dialyze:
|
2013-01-05 17:25:04 +01:00
|
|
|
@dialyzer --src src --plt .$(PROJECT).plt --no_native \
|
2012-01-31 08:49:25 +01:00
|
|
|
-Werror_handling -Wrace_conditions -Wunmatched_returns # -Wunderspecs
|