diff --git a/.travis.yml b/.travis.yml index 5dae2f4..6490e13 100644 --- a/.travis.yml +++ b/.travis.yml @@ -7,8 +7,7 @@ otp_release: - R14B04 - R14B03 - R14B02 -script: "make" +script: "make rebuild" branches: only: - master - - next diff --git a/Makefile b/Makefile index e05f06a..47acb32 100644 --- a/Makefile +++ b/Makefile @@ -3,22 +3,49 @@ # BSD License see COPYING ERL = $(shell which erl) -ERL_VER = $(shell erl -eval 'erlang:display(erlang:system_info(otp_release)), halt().' -noshell) +ERL_VER = $(shell erl -eval 'io:format("~s", [erlang:system_info(otp_release)]), halt().' -noshell) +ERLWARE_COMMONS_PLT=$(CURDIR)/.erlware_commons_plt ERLFLAGS= -pa $(CURDIR)/.eunit -pa $(CURDIR)/ebin -pa $(CURDIR)/*/ebin +# ============================================================================= +# Verify that the programs we need to run are installed on this system +# ============================================================================= + REBAR=$(shell which rebar) ifeq ($(REBAR),) $(error "Rebar not available on this system") endif -ERLWARE_COMMONS_PLT=$(CURDIR)/.erlware_commons_plt +# ============================================================================= +# Handle version discovery +# ============================================================================= + +# We have a problem that we only have 10 minutes to build on travis +# and those travis boxes are quite small. This is ok for the fast +# dialyzer on R15 and above. However on R14 and below we have the +# problem that travis times out. The code below lets us not run +# dialyzer on R14 +OTP_VSN=$(shell erl -noshell -eval 'io:format("~p", [erlang:system_info(otp_release)]), erlang:halt(0).' | perl -lne 'print for /R(\d+).*/g') +TRAVIS_SLOW=$(shell expr $(OTP_VSN) \<= 15 ) + +ifeq ($(TRAVIS_SLOW), 0) +DIALYZER=$(shell which dialyzer) +else +DIALYZER=: not running dialyzer on R14 or R15 +endif + +# ============================================================================= +# Rules to build the system +# ============================================================================= .PHONY: all compile doc clean test shell distclean pdf get-deps rebuild dialyzer typer all: compile doc test +rebuild: distclean deps compile dialyzer test + deps: .DEV_MODE $(REBAR) get-deps compile @@ -43,29 +70,29 @@ $(ERLWARE_COMMONS_PLT).$(ERL_VER).erts: @echo Building local plt at $(ERLWARE_COMMONS_PLT).$(ERL_VER).base @echo - - dialyzer --fullpath --verbose --output_plt $(ERLWARE_COMMONS_PLT).$(ERL_VER).base --build_plt \ + - $(DIALYZER) --fullpath --verbose --output_plt $(ERLWARE_COMMONS_PLT).$(ERL_VER).erts --build_plt \ --apps erts $(ERLWARE_COMMONS_PLT).$(ERL_VER).kernel:$(ERLWARE_COMMONS_PLT).$(ERL_VER).erts @echo Building local plt at $(ERLWARE_COMMONS_PLT).$(ERL_VER).base @echo - - dialyzer --fullpath --verbose --output_plt $(ERLWARE_COMMONS_PLT).$(ERL_VER).base --build_plt \ + - $(DIALYZER) --fullpath --verbose --output_plt $(ERLWARE_COMMONS_PLT).$(ERL_VER).kernel --build_plt \ --apps kernel $(ERLWARE_COMMONS_PLT).$(ERL_VER).base:$(ERLWARE_COMMONS_PLT).$(ERL_VER).kernel @echo Building local plt at $(ERLWARE_COMMONS_PLT).$(ERL_VER).base @echo - - dialyzer --fullpath --verbose --output_plt $(ERLWARE_COMMONS_PLT).$(ERL_VER).base --build_plt \ + - $(DIALYZER) --fullpath --verbose --output_plt $(ERLWARE_COMMONS_PLT).$(ERL_VER).base --build_plt \ --apps stdlib $(ERLWARE_COMMONS_PLT).$(ERL_VER): $(ERLWARE_COMMONS_PLT).$(ERL_VER).base @echo Building local plt at $(ERLWARE_COMMONS_PLT).$(ERL_VER) @echo - - dialyzer --fullpath --verbose --output_plt $(ERLWARE_COMMONS_PLT).$(ERL_VER) --add_to_plt --plt $(ERLWARE_COMMONS_PLT).$(ERL_VER).base \ + - $(DIALYZER) --fullpath --verbose --output_plt $(ERLWARE_COMMONS_PLT).$(ERL_VER) --add_to_plt --plt $(ERLWARE_COMMONS_PLT).$(ERL_VER).base \ --apps eunit -r deps -dialyzer: $(ERLWARE_COMMONS_PLT).$(ERL_VER) - dialyzer --fullpath --plt $(ERLWARE_COMMONS_PLT).$(ERL_VER) -Wrace_conditions -r ./ebin +dialyzer: compile $(ERLWARE_COMMONS_PLT).$(ERL_VER) + $(DIALYZER) --fullpath --plt $(ERLWARE_COMMONS_PLT).$(ERL_VER) -Wrace_conditions -r ./ebin typer: $(ERLWARE_COMMONS_PLT).$(ERL_VER) typer --plt $(ERLWARE_COMMONS_PLT).$(ERL_VER) -r ./src @@ -90,5 +117,3 @@ distclean: clean rm -rf $(ERLWARE_COMMONS_PLT).$(ERL_VER) rm -rvf $(CURDIR)/deps rm -rvf .DEV_MODE - -rebuild: distclean all