diff --git a/Makefile b/Makefile index 75302b2..39d5fef 100644 --- a/Makefile +++ b/Makefile @@ -1,42 +1,41 @@ -REBAR = $(shell command -v rebar || echo ./rebar) -DEPS_PLT=./.deps_plt -DEPS=erts kernel stdlib +REBAR3_URL=https://s3.amazonaws.com/rebar3/rebar3 -.PHONY: all get-deps compile clean dialyze xref +ifeq ($(wildcard rebar3),rebar3) + REBAR3 = $(CURDIR)/rebar3 +endif -all: get-deps compile +REBAR3 ?= $(shell test -e `which rebar3` 2>/dev/null && which rebar3 || echo "./rebar3") -get-deps: - @$(REBAR) get-deps +ifeq ($(REBAR3),) + REBAR3 = $(CURDIR)/rebar3 +endif -compile: - @$(REBAR) compile +.PHONY: deps build clean dialyzer xref doc test publish -test: compile - $(REBAR) eunit skip_deps=true +all: build + +build: $(REBAR3) + @$(REBAR3) compile + +$(REBAR3): + wget $(REBAR3_URL) || curl -Lo rebar3 $(REBAR3_URL) + @chmod a+x rebar3 clean: - @$(REBAR) clean - -$(DEPS_PLT): - @echo Building $(DEPS_PLT) - dialyzer --build_plt \ - --output_plt $(DEPS_PLT) \ - --apps $(DEPS) -#-r deps \ - -dialyze: compile $(DEPS_PLT) - dialyzer --fullpath \ - --src src \ - -Wunmatched_returns \ - -Werror_handling \ - -Wrace_conditions \ - -Wunderspecs \ - -r ebin \ - --plt $(DEPS_PLT) + @$(REBAR3) clean + +dialyzer: + @$(REBAR3) dialyzer xref: - @$(REBAR) xref + @$(REBAR3) xref -doc: compile +test: + @$(REBAR3) eunit + +doc: build + ./scripts/hackish_inject_version_in_docs.sh ./scripts/hackish_make_docs.sh + +publish: + @$(REBAR3) as publish hex publish diff --git a/README.md b/README.md index c96df8f..a941744 100644 --- a/README.md +++ b/README.md @@ -4,12 +4,13 @@ Copyright (c) 2016 Guilherme Andrade -__Version:__ 1.0.3 +__Version:__ 1.0.3-1-gae0fecf __Authors:__ Guilherme Andrade ([`nlocks(at)gandrade(dot)net`](mailto:nlocks(at)gandrade(dot)net)). `nlocks`: Native spinlocks for Erlang + --------- An experiment on Erlang native spinlocks: @@ -36,7 +37,6 @@ end, ### Brutal kills and unreleased locks ### - Hackish solution. Other than setting up some sort of monitor in the Erlang land, I found no practical way to deal with these other than making use of _ownership_ objects, references to which should never leave the process under which they were created; the release therefore becomes dependent on the garbage collector calling their destructor, but this also makes it more convenient for regularly terminated processes that forget to clean up. @@ -77,7 +77,6 @@ struct Lock { ### The spinning ### - * It uses C++ 11 [compare_exchange_weak](http://en.cppreference.com/w/cpp/atomic/atomic/compare_exchange) * For each attempt, a new NIF call is scheduled; this brings some overhead to the table but it's crucial to play nice with the VM * If the timeout is other than 'infinity', for each attempt it compares the deadline against the current [steady_clock](http://en.cppreference.com/w/cpp/chrono/steady_clock) value; this feels excessive and might hurt performance. diff --git a/cpp_src/Makefile b/cpp_src/Makefile index 944249f..75e1e61 100644 --- a/cpp_src/Makefile +++ b/cpp_src/Makefile @@ -6,7 +6,7 @@ endif CXX=g++ RM=rm -f -INC=-I$(ERL_INCLUDE) +INC= CPPFLAGS=-std=c++11 -Wall -Wextra -Wpedantic -fPIC -O2 $(INC) LDLIBS= diff --git a/doc/utf8/README.md b/doc/README.md similarity index 99% rename from doc/utf8/README.md rename to doc/README.md index 965e9b8..7bd18bd 100644 --- a/doc/utf8/README.md +++ b/doc/README.md @@ -4,11 +4,12 @@ Copyright (c) 2016 Guilherme Andrade -__Version:__ 1.0.3 +__Version:__ 1.0.3-1-gae0fecf __Authors:__ Guilherme Andrade ([`nlocks(at)gandrade(dot)net`](mailto:nlocks(at)gandrade(dot)net)). `nlocks`: Native spinlocks for Erlang + --------- An experiment on Erlang native spinlocks: @@ -35,7 +36,6 @@ end, ### Brutal kills and unreleased locks ### - Hackish solution. Other than setting up some sort of monitor in the Erlang land, I found no practical way to deal with these other than making use of _ownership_ objects, references to which should never leave the process under which they were created; the release therefore becomes dependent on the garbage collector calling their destructor, but this also makes it more convenient for regularly terminated processes that forget to clean up. @@ -76,7 +76,6 @@ struct Lock { ### The spinning ### - * It uses C++ 11 [compare_exchange_weak](http://en.cppreference.com/w/cpp/atomic/atomic/compare_exchange) * For each attempt, a new NIF call is scheduled; this brings some overhead to the table but it's crucial to play nice with the VM * If the timeout is other than 'infinity', for each attempt it compares the deadline against the current [steady_clock](http://en.cppreference.com/w/cpp/chrono/steady_clock) value; this feels excessive and might hurt performance. diff --git a/doc/edoc-info b/doc/edoc-info index 38f3977..ee81130 100644 --- a/doc/edoc-info +++ b/doc/edoc-info @@ -1,3 +1,3 @@ %% encoding: UTF-8 -{packages,[]}. +{application,nlocks}. {modules,[nlocks]}. diff --git a/doc/index.html b/doc/index.html index 047b9dc..434eaf6 100644 --- a/doc/index.html +++ b/doc/index.html @@ -1,7 +1,7 @@
-