From 60e94237c23bb339f13c9df4fac11e7a57a082f1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Hoguin?= Date: Wed, 6 Feb 2013 18:29:20 +0100 Subject: Makefile: separate deps compilation from app compilation --- Makefile | 34 ++++++++++++++++++++-------------- 1 file changed, 20 insertions(+), 14 deletions(-) (limited to 'Makefile') diff --git a/Makefile b/Makefile index 127e176..6d910a9 100644 --- a/Makefile +++ b/Makefile @@ -20,27 +20,21 @@ erlc_verbose = $(erlc_verbose_$(V)) gen_verbose_0 = @echo " GEN " $@; gen_verbose = $(gen_verbose_$(V)) -.PHONY: all clean-all app clean docs clean-docs tests autobahn build-plt dialyze +.PHONY: all clean-all app clean deps clean-deps docs clean-docs tests autobahn build-plt dialyze # Application. -all: app +all: deps app -clean-all: clean clean-docs +clean-all: clean clean-deps clean-docs $(gen_verbose) rm -rf .$(PROJECT).plt $(DEPS_DIR) logs -deps/ranch: - @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 ebin/$(PROJECT).app +app: ebin/$(PROJECT).app $(appsrc_verbose) cat src/$(PROJECT).app.src \ | sed 's/{modules, \[\]}/{modules, \[$(MODULES)\]}/' \ > ebin/$(PROJECT).app - @$(MAKE) -C $(DEPS_DIR)/ranch ebin/$(PROJECT).app: src/*.erl @mkdir -p ebin/ @@ -48,9 +42,21 @@ ebin/$(PROJECT).app: src/*.erl src/$(PROJECT)_middleware.erl $? clean: - -@$(MAKE) -C $(DEPS_DIR)/ranch clean $(gen_verbose) rm -rf ebin/ test/*.beam erl_crash.dump +# Dependencies. + +$(DEPS_DIR)/ranch: + @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) + +deps: $(DEPS_DIR)/ranch + @$(MAKE) -C $(DEPS_DIR)/ranch + +clean-deps: + -@$(MAKE) -C $(DEPS_DIR)/ranch clean + # Documentation. docs: clean-docs @@ -69,17 +75,17 @@ CT_RUN = ct_run \ -cover test/cover.spec tests: ERLC_OPTS += -DTEST=1 -tests: clean app +tests: clean clean-deps deps app @mkdir -p logs/ @$(CT_RUN) -suite eunit_SUITE http_SUITE ws_SUITE -autobahn: clean app +autobahn: clean clean-deps deps app @mkdir -p logs/ @$(CT_RUN) -suite autobahn_SUITE # Dialyzer. -build-plt: app +build-plt: deps app @dialyzer --build_plt --output_plt .$(PROJECT).plt \ --apps erts kernel stdlib crypto public_key ssl $(DEPS_DIR)/ranch -- cgit v1.2.3