Browse Source

Do not require rebar to build Ranch

All is done in the Makefile, like with Cowboy.
Loïc Hoguin 12 years ago
parent
commit
d20989e722
4 changed files with 34 additions and 29 deletions
  1. 34 19
      Makefile
  2. 0 6
      rebar.config
  3. 0 4
      rebar.tests.config
  4. 0 0
      test/cover.spec

+ 34 - 19
Makefile

@@ -1,27 +1,40 @@
 # See LICENSE for licensing information.
 # See LICENSE for licensing information.
 
 
 PROJECT = ranch
 PROJECT = ranch
+ERLC_OPTS = -Werror +debug_info +warn_export_all # +bin_opt_info +warn_missing_spec
 
 
-DIALYZER = dialyzer
-REBAR = rebar
+DEPS_DIR ?= $(CURDIR)/deps
+export DEPS_DIR
 
 
-all: app
+.PHONY: all clean-all app clean docs clean-docs tests build-plt dialyze
 
 
 # Application.
 # Application.
 
 
-deps:
-	@$(REBAR) get-deps
+all: app
+
+clean-all: clean clean-docs
+	rm -f .$(PROJECT).plt
+	rm -rf $(DEPS_DIR) logs
 
 
-app: deps
-	@$(REBAR) compile
+MODULES = $(shell ls src/*.erl | sed 's/src\///;s/\.erl/,/' | sed '$$s/.$$//')
+
+app:
+	@mkdir -p ebin/
+	@cat src/$(PROJECT).app.src \
+		| sed 's/{modules, \[\]}/{modules, \[$(MODULES)\]}/' \
+		> ebin/$(PROJECT).app
+	erlc -v $(ERLC_OPTS) -o ebin/ -pa ebin/ \
+		src/$(PROJECT)_transport.erl src/*.erl
 
 
 clean:
 clean:
-	@$(REBAR) clean
+	rm -rf ebin/
 	rm -f test/*.beam
 	rm -f test/*.beam
 	rm -f erl_crash.dump
 	rm -f erl_crash.dump
 
 
+# Documentation.
+
 docs: clean-docs
 docs: clean-docs
-	@$(REBAR) doc skip_deps=true
+	erl -noshell -eval 'edoc:application($(PROJECT), ".", []), init:stop().'
 
 
 clean-docs:
 clean-docs:
 	rm -f doc/*.css
 	rm -f doc/*.css
@@ -31,20 +44,22 @@ clean-docs:
 
 
 # Tests.
 # Tests.
 
 
-tests: clean app eunit ct
-
-eunit:
-	@$(REBAR) -C rebar.tests.config eunit skip_deps=true
+CT_RUN = ct_run \
+	-pa ebin $(DEPS_DIR)/*/ebin \
+	-dir test \
+	-logdir logs \
+	-cover test/cover.spec
 
 
-ct:
-	@$(REBAR) -C rebar.tests.config ct skip_deps=true
+tests: clean app
+	@mkdir -p logs/
+	@$(CT_RUN) -suite acceptor_SUITE
 
 
 # Dialyzer.
 # Dialyzer.
 
 
-build-plt:
-	@$(DIALYZER) --build_plt --output_plt .$(PROJECT).plt \
-		--apps kernel stdlib sasl tools inets crypto public_key ssl
+build-plt: app
+	@dialyzer --build_plt --output_plt .$(PROJECT).plt \
+		--apps erts kernel stdlib crypto public_key ssl
 
 
 dialyze:
 dialyze:
-	@$(DIALYZER) --src src --plt .$(PROJECT).plt \
+	@dialyzer --src src --plt .$(PROJECT).plt \
 		-Werror_handling -Wrace_conditions -Wunmatched_returns # -Wunderspecs
 		-Werror_handling -Wrace_conditions -Wunmatched_returns # -Wunderspecs

+ 0 - 6
rebar.config

@@ -1,6 +0,0 @@
-{erl_opts, [
-%%	bin_opt_info,
-%%	warn_missing_spec,
-	warnings_as_errors,
-	warn_export_all
-]}.

+ 0 - 4
rebar.tests.config

@@ -1,4 +0,0 @@
-{cover_enabled, true}.
-{deps, []}.
-{eunit_opts, [verbose, {report, {eunit_surefire, [{dir, "."}]}}]}.
-{erl_opts, []}.

+ 0 - 0
cover.spec → test/cover.spec