erlware_commons/Makefile
Seth Falcon d9c6ec1d28 Make proper and neotoma dev-only dependencies
This patch makes erlware_commons easier to include as a dependency by
removing depedencies that are not needed at run time.

The top-level Makefile creates a .DEV_MODE marker file which is
detected by rebar.config.script. When the marker file is present, the
development only dependencies proper and neotoma are included and a
macro 'DEV_ONLY' is defined. The macro is used to only enable the
proper tests for development mode.

The ec_semver_parser.peg is now located in priv/ and is moved into
src/ by the Makefile. The generated ec_semver_parser.erl is now under
version control; it need not be rebuilt by all projects wishing to
include erlware_commons. It will be rebuilt, as before this change, on
every make invocation.
2013-04-22 14:48:08 -07:00

94 lines
2.8 KiB
Makefile

# Copyright 2012 Erlware, LLC. All Rights Reserved.
#
# BSD License see COPYING
ERL = $(shell which erl)
ERL_VER = $(shell erl -eval 'erlang:display(erlang:system_info(otp_release)), halt().' -noshell)
ERLFLAGS= -pa $(CURDIR)/.eunit -pa $(CURDIR)/ebin -pa $(CURDIR)/*/ebin
REBAR=$(shell which rebar)
ifeq ($(REBAR),)
$(error "Rebar not available on this system")
endif
ERLWARE_COMMONS_PLT=$(CURDIR)/.erlware_commons_plt
.PHONY: all compile doc clean test shell distclean pdf get-deps rebuild #dialyzer typer #fail on Travis.
all: compile doc test #dialyzer #fail on travis
deps: .DEV_MODE
$(REBAR) get-deps compile
.DEV_MODE:
touch $@
cp priv/ec_semver_parser.peg src
get-deps:
$(REBAR) get-deps compile
compile: deps
$(REBAR) skip_deps=true compile
doc: compile
- $(REBAR) skip_deps=true doc
test: compile
$(REBAR) skip_deps=true eunit
$(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 \
--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 \
--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 \
--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 \
--apps eunit -r deps
dialyzer: $(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
shell: compile
# You often want *rebuilt* rebar tests to be available to the
# shell you have to call eunit (to get the tests
# rebuilt). However, eunit runs the tests, which probably
# fails (thats probably why You want them in the shell). This
# runs eunit but tells make to ignore the result.
- @$(REBAR) skip_deps=true eunit
@$(ERL) $(ERLFLAGS)
clean:
$(REBAR) skip_deps=true clean
- rm $(CURDIR)/doc/*.html
- rm $(CURDIR)/doc/*.css
- rm $(CURDIR)/doc/*.png
- rm $(CURDIR)/doc/edoc-info
distclean: clean
rm -rf $(ERLWARE_COMMONS_PLT).$(ERL_VER)
rm -rvf $(CURDIR)/deps
rm -rvf .DEV_MODE
rebuild: distclean get-deps all