diff options
-rw-r--r-- | LICENSE | 2 | ||||
-rw-r--r-- | Makefile | 9 | ||||
-rw-r--r-- | README.md | 123 | ||||
-rw-r--r-- | build.config | 9 | ||||
-rw-r--r-- | core/core.mk | 108 | ||||
-rw-r--r-- | core/deps.mk | 220 | ||||
-rw-r--r-- | core/docs.mk | 19 | ||||
-rw-r--r-- | core/erlc.mk | 40 | ||||
-rw-r--r-- | core/test.mk | 48 | ||||
-rw-r--r-- | erlang.mk | 1099 | ||||
-rw-r--r-- | packages.v1.tsv | 143 | ||||
-rw-r--r-- | packages.v1.txt | 143 | ||||
-rw-r--r-- | packages.v2.tsv | 147 | ||||
-rw-r--r-- | plugins/asciidoc.mk | 46 | ||||
-rw-r--r-- | plugins/bootstrap.mk | 542 | ||||
-rw-r--r-- | plugins/c_src.mk | 37 | ||||
-rw-r--r-- | plugins/ci.mk | 65 | ||||
-rw-r--r-- | plugins/cover.mk | 139 | ||||
-rw-r--r-- | plugins/ct.mk | 68 | ||||
-rw-r--r-- | plugins/dialyzer.mk | 4 | ||||
-rw-r--r-- | plugins/edoc.mk | 11 | ||||
-rw-r--r-- | plugins/elvis.mk | 10 | ||||
-rw-r--r-- | plugins/erlydtl.mk | 18 | ||||
-rw-r--r-- | plugins/escript.mk | 8 | ||||
-rw-r--r-- | plugins/eunit.mk | 69 | ||||
-rw-r--r-- | plugins/relx.mk | 33 | ||||
-rw-r--r-- | plugins/shell.mk | 2 | ||||
-rw-r--r-- | plugins/triq.mk | 43 | ||||
-rw-r--r-- | plugins/xref.mk | 38 | ||||
-rw-r--r-- | test/Makefile | 256 |
30 files changed, 1914 insertions, 1585 deletions
@@ -1,4 +1,4 @@ -Copyright (c) 2013-2014, Loïc Hoguin <[email protected]> +Copyright (c) 2013-2015, Loïc Hoguin <[email protected]> Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above @@ -1,4 +1,4 @@ -# Copyright (c) 2013-2014, Loïc Hoguin <[email protected]> +# Copyright (c) 2013-2015, Loïc Hoguin <[email protected]> # # Permission to use, copy, modify, and/or distribute this software for any # purpose with or without fee is hereby granted, provided that the above @@ -18,12 +18,15 @@ BUILD_CONFIG = $(shell sed "s/\#.*//" $(BUILD_CONFIG_FILE)) ERLANG_MK = erlang.mk ERLANG_MK_VERSION = $(shell git describe --tags --dirty) -.PHONY: all +.PHONY: all check all: pkg awk 'FNR==1 && NR!=1{print ""}1' $(patsubst %,%.mk,$(BUILD_CONFIG)) \ - | sed 's/^ERLANG_MK_VERSION = .*/ERLANG_MK_VERSION = $(ERLANG_MK_VERSION)/' > $(ERLANG_MK) + | sed 's/^ERLANG_MK_VERSION = .*/ERLANG_MK_VERSION = $(ERLANG_MK_VERSION)/' > $(ERLANG_MK) pkg: cat packages.v2.tsv | awk 'BEGIN { FS = "\t" }; { print $$1 "\t" $$3 "\t" $$5 "\t" $$6 }' > packages.v1.tsv cp packages.v1.tsv packages.v1.txt + +check: + $(MAKE) -C test @@ -13,6 +13,7 @@ an Erlang-based build tool, including but not limited to the following: * You want a very fast compilation and test cycle * You want the full power of Unix at your disposal when hooking into your build tool + * You want to be able to easily edit the damn build tool and fix it when it fails * You want to use the deps mechanism with non-Erlang Makefile-based projects * Your project will be part of a larger make or automake based environment @@ -115,6 +116,17 @@ dep_cowboy = git https://github.com/ninenines/cowboy 1.0.0 They will always be compiled using the command `make`. If the dependency does not feature a Makefile, then erlang.mk will be used for building. +For subversion dependencies, the url specifies trunk, branch or +tag. To specify a particular revision, use `@revision` at the end of +the url. No separate specification of branch, tag, or revision is +required or possible. + +``` erlang +DEPS = ex1 ex2 +dep_ex1 = svn https://example.com/svn/trunk/project/ex1 +dep_ex2 = svn svn://example.com/svn/branches/erlang-proj/ex2@264 +``` + You can also specify test-only dependencies. These dependencies will only be downloaded when running `make tests`. The format is the same as above, except the variable `TEST_DEPS` holds the list of test-only dependencies. @@ -127,6 +139,24 @@ dep_ct_helper = git https://github.com/extend/ct_helper.git master Please note that the test dependencies will only be compiled once when they are fetched, unlike the normal dependencies. +Autopatch +--------- + +The autopatch features allows you to automatically fix packages +that are not compatible with erlang.mk. It can also be used to +convert compatible packages to use erlang.mk itself for building +when used as dependency. + +The patching occurs only once, immediately after the package has +been fetched. + +erlang.mk defines a number of packages to be patched. You can add +more packages to the list by appending the `AUTOPATCH` variable. + +``` Makefile +AUTOPATCH += gproc +``` + Releases -------- @@ -194,6 +224,30 @@ You can enable verbose mode by calling Make with the variable $ V=1 make ``` +Parallel execution can be enabled through the use of the +`-j` option. The following output showcases concurrent +downloading of dependencies. + +``` bash +$ make -j32 +Cloning into '/home/essen/ninenines/cowboy/deps/ranch'... +Cloning into '/home/essen/ninenines/cowboy/deps/cowlib'... +``` + +The `-O` option will ensure that output from different +targets is grouped, which is particularly useful when +running tests with different frameworks at the same time. +The disadvantage of this option however is that there is +no output until the target is completed. + +The``MAKEFLAGS` variable can be used to set it permanently +on your system. It can be set in your `.zshrc`, `.bashrc` +or equivalent file. + +``` bash +MAKEFLAGS="-j32 -O" +``` + Core package functionality -------------------------- @@ -201,7 +255,7 @@ The following targets are specific to packages: `pkg-list` lists all packages in the index. -`pkg-search n=STRING` searches the index for STRING. +`pkg-search q=STRING` searches the index for STRING. Packages are downloaded into `DEPS_DIR` (`./deps/` by default). @@ -223,6 +277,9 @@ You can change compilation options by setting the `ERLC_OPTS` variable. It takes the arguments that will then be passed to `erlc`. For more information, please see `erl -man erlc`. +Test target compilation options can be specified in `TEST_ERLC_OPTS`. +It will override `ERLC_OPTS`. + You can specify a list of modules to be compiled first using the `COMPILE_FIRST` variable. @@ -296,7 +353,10 @@ The defaults are system dependent. Common_test plugin ------------------ -This plugin is available by default. +This plugin is available by default. It adds the following +target: + +`ct` runs all test suites for this application. There is nothing to configure to use it, simply create your test suites in the `./test/` directory and erlang.mk will @@ -367,7 +427,14 @@ ErlyDTL plugin This plugin is available by default. It adds automatic compilation of ErlyDTL templates found in `templates/*.dtl` -or any subdirectory. +or any subdirectory. + +By default it ignores names of subdirectories and compiles +`a/b/templatename.dtl` into `templatename_dtl.beam`. To include +subdirectories names in the compiled module name add +`DTL_FULL_PATH=1` into your Makefile - `a/b/templatename.dtl` +will be compiled into `a_b_templatename_dtl.beam`. + Escript plugin -------------- @@ -402,16 +469,14 @@ EUnit plugin This plugin is available by default. It adds the following target: -`eunit` which runs all the EUnit tests found in `ebin` and -any of the additional EUnit directories specified in -`EUNIT_DIR`. +`eunit` which runs all the EUnit tests found in `ebin` or +the test directory specified in `TEST_DIR`. `EUNIT_OPTS` can be used to specify EUnit-specific options (e.g. `verbose`) that will be used when calling -`eunit:test/2`. This configuration parameter defaults to -`verbose`. Note -that EUnit options are specified as a comma-separated -list of options. +`eunit:test/2`. This configuration parameter is empty +by default.. Note that EUnit options are specified as +a comma-separated list of options. Relx plugin ----------- @@ -451,6 +516,41 @@ For more information please see `erl -man erl`. `SHELL_PATH` adds paths to the shell's library search path. By default this option sets the paths to `-pa ../$(PROJECT)/ebin $(DEPS_DIR)/*/ebin`. +Triq plugin +----------- + +This plugin is available by default. It adds the following +target: + +`triq` will check all the properties found in `ebin` or +the test directory specified in `TEST_DIR`. + +You can use the `t` variable to give a specific module +or function to run, for example: + +``` bash +$ make triq t=cow_http_hd +``` + +Or: + +``` bash +$ make triq t=cow_http_hd:prop_parse_accept +``` + +Xref plugin +------------ + +This plugin is available by default. It adds the following +target: + +`xref` Erlang Xref Runner (inspired in rebar's rebar_xref) + +The `XREF_CONFIG` variable specifies the location of the +configuration file which holds the checks to be applied. +If there is no `xref.config` all `xref` checks will be +applied to the binaries located in the `/ebin` directory. + Contributing ------------ @@ -478,8 +578,7 @@ You can submit as many packages as you want in one pull request as long as you follow the instructions above. For patches or plugins, you have to edit the `core/*.mk` -or `plugins/*.mk` files and then run `make` to create an -updated `erlang.mk`. If you submit a new plugin, you also +or `plugins/*.mk` files. If you submit a new plugin, you also need to add it to the `build.config` file. Make sure to keep the commit title short, to have a single diff --git a/build.config b/build.config index 8b6e721..d68eaff 100644 --- a/build.config +++ b/build.config @@ -5,12 +5,16 @@ core/core core/deps core/erlc +core/docs +core/test # Plugins. # # Comment to disable, uncomment to enable. +plugins/asciidoc plugins/bootstrap plugins/c_src +plugins/ci plugins/ct plugins/dialyzer plugins/edoc @@ -20,3 +24,8 @@ plugins/escript plugins/eunit plugins/relx plugins/shell +plugins/triq +plugins/xref + +# Plugins enhancing the functionality of other plugins. +plugins/cover diff --git a/core/core.mk b/core/core.mk index 0b06f73..497c431 100644 --- a/core/core.mk +++ b/core/core.mk @@ -1,4 +1,4 @@ -# Copyright (c) 2013-2014, Loïc Hoguin <[email protected]> +# Copyright (c) 2013-2015, Loïc Hoguin <[email protected]> # # Permission to use, copy, modify, and/or distribute this software for any # purpose with or without fee is hereby granted, provided that the above @@ -12,7 +12,7 @@ # ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -.PHONY: all deps app rel docs tests clean distclean help erlang-mk +.PHONY: all deps app rel docs install-docs tests check clean distclean help erlang-mk ERLANG_MK_VERSION = 1 @@ -28,12 +28,59 @@ V ?= 0 gen_verbose_0 = @echo " GEN " $@; gen_verbose = $(gen_verbose_$(V)) +# "erl" command. + +ERL = erl +A0 -noinput -boot start_clean + +# Platform detection. +# @todo Add Windows/Cygwin detection eventually. + +ifeq ($(PLATFORM),) +UNAME_S := $(shell uname -s) + +ifeq ($(UNAME_S),Linux) +PLATFORM = linux +else ifeq ($(UNAME_S),Darwin) +PLATFORM = darwin +else ifeq ($(UNAME_S),SunOS) +PLATFORM = solaris +else ifeq ($(UNAME_S),GNU) +PLATFORM = gnu +else ifeq ($(UNAME_S),FreeBSD) +PLATFORM = freebsd +else ifeq ($(UNAME_S),NetBSD) +PLATFORM = netbsd +else ifeq ($(UNAME_S),OpenBSD) +PLATFORM = openbsd +else +$(error Unable to detect platform. Please open a ticket with the output of uname -a.) +endif + +export PLATFORM +endif + # Core targets. -all:: deps app rel +ifneq ($(words $(MAKECMDGOALS)),1) +.NOTPARALLEL: +endif + +all:: deps + @$(MAKE) --no-print-directory app + @$(MAKE) --no-print-directory rel + +# Noop to avoid a Make warning when there's nothing to do. +rel:: + @echo -n + +check:: clean app tests + +clean:: clean-crashdump -clean:: +clean-crashdump: +ifneq ($(wildcard erl_crash.dump),) $(gen_verbose) rm -f erl_crash.dump +endif distclean:: clean @@ -42,33 +89,60 @@ help:: "erlang.mk (version $(ERLANG_MK_VERSION)) is distributed under the terms of the ISC License." \ "Copyright (c) 2013-2014 Loïc Hoguin <[email protected]>" \ "" \ - "Usage: [V=1] make [target]" \ + "Usage: [V=1] $(MAKE) [-jNUM] [target]" \ "" \ "Core targets:" \ - " all Run deps, app and rel targets in that order" \ - " deps Fetch dependencies (if needed) and compile them" \ - " app Compile the project" \ - " rel Build a release for this project, if applicable" \ - " docs Build the documentation for this project" \ - " tests Run the tests for this project" \ - " clean Delete temporary and output files from most targets" \ - " distclean Delete all temporary and output files" \ - " help Display this help and exit" \ + " all Run deps, app and rel targets in that order" \ + " deps Fetch dependencies (if needed) and compile them" \ + " app Compile the project" \ + " rel Build a release for this project, if applicable" \ + " docs Build the documentation for this project" \ + " install-docs Install the man pages for this project" \ + " tests Run the tests for this project" \ + " check Compile and run all tests and analysis for this project" \ + " clean Delete temporary and output files from most targets" \ + " distclean Delete all temporary and output files" \ + " help Display this help and exit" \ "" \ "The target clean only removes files that are commonly removed." \ "Dependencies and releases are left untouched." \ "" \ - "Setting V=1 when calling make enables verbose mode." + "Setting V=1 when calling $(MAKE) enables verbose mode." \ + "Parallel execution is supported through the -j $(MAKE) flag." # Core functions. +define newline + + +endef + +define erlang +$(ERL) -eval "$(subst $(newline),,$(subst ",\",$(1)))" +endef + ifeq ($(shell which wget 2>/dev/null | wc -l), 1) define core_http_get wget --no-check-certificate -O $(1) $(2)|| rm $(1) endef else +define core_http_get.erl + ssl:start(), + inets:start(), + case httpc:request(get, {"$(2)", []}, [{autoredirect, true}], []) of + {ok, {{_, 200, _}, _, Body}} -> + case file:write_file("$(1)", Body) of + ok -> ok; + {error, R1} -> halt(R1) + end; + {error, R2} -> + halt(R2) + end, + halt(0). +endef + define core_http_get - erl -noshell -eval 'ssl:start(), inets:start(), case httpc:request(get, {"$(2)", []}, [{autoredirect, true}], []) of {ok, {{_, 200, _}, _, Body}} -> case file:write_file("$(1)", Body) of ok -> ok; {error, R1} -> halt(R1) end; {error, R2} -> halt(R2) end, halt(0).' + $(call erlang,$(call core_http_get.erl,$(1),$(2))) endef endif @@ -80,6 +154,6 @@ ERLANG_MK_BUILD_DIR ?= .erlang.mk.build erlang-mk: git clone https://github.com/ninenines/erlang.mk $(ERLANG_MK_BUILD_DIR) if [ -f $(ERLANG_MK_BUILD_CONFIG) ]; then cp $(ERLANG_MK_BUILD_CONFIG) $(ERLANG_MK_BUILD_DIR); fi - cd $(ERLANG_MK_BUILD_DIR) && make + cd $(ERLANG_MK_BUILD_DIR) && $(MAKE) cp $(ERLANG_MK_BUILD_DIR)/erlang.mk ./erlang.mk rm -rf $(ERLANG_MK_BUILD_DIR) diff --git a/core/deps.mk b/core/deps.mk index 80bedda..5a7f542 100644 --- a/core/deps.mk +++ b/core/deps.mk @@ -1,10 +1,13 @@ -# Copyright (c) 2013-2014, Loïc Hoguin <[email protected]> +# Copyright (c) 2013-2015, Loïc Hoguin <[email protected]> # This file is part of erlang.mk and subject to the terms of the ISC License. .PHONY: distclean-deps distclean-pkg pkg-list pkg-search # Configuration. +AUTOPATCH ?= edown gen_leader gproc +export AUTOPATCH + DEPS_DIR ?= $(CURDIR)/deps export DEPS_DIR @@ -27,28 +30,204 @@ export PKG_FILE2 PKG_FILE_URL ?= https://raw.githubusercontent.com/ninenines/erlang.mk/master/packages.v2.tsv +# Verbosity. + +dep_verbose_0 = @echo " DEP " $(1); +dep_verbose = $(dep_verbose_$(V)) + # Core targets. +ifneq ($(SKIP_DEPS),) +deps:: +else deps:: $(ALL_DEPS_DIRS) @for dep in $(ALL_DEPS_DIRS) ; do \ if [ -f $$dep/GNUmakefile ] || [ -f $$dep/makefile ] || [ -f $$dep/Makefile ] ; then \ - $(MAKE) -C $$dep ; \ + $(MAKE) -C $$dep IS_DEP=1 || exit $$? ; \ else \ - echo "include $(CURDIR)/erlang.mk" | ERLC_OPTS=+debug_info $(MAKE) -f - -C $$dep ; \ + echo "ERROR: No makefile to build dependency $$dep. Consider adding it to AUTOPATCH." ; \ + exit 1 ; \ fi ; \ done +endif distclean:: distclean-deps distclean-pkg # Deps related targets. +# @todo rename GNUmakefile and makefile into Makefile first, if they exist +# While Makefile file could be GNUmakefile or makefile, +# in practice only Makefile is needed so far. +define dep_autopatch + if [ -f $(DEPS_DIR)/$(1)/Makefile ]; then \ + if [ 0 != `grep -ci rebar $(DEPS_DIR)/$(1)/Makefile` ]; then \ + $(call dep_autopatch2,$(1)); \ + elif [ 0 != `find $(DEPS_DIR)/$(1)/ -type f -name \*.mk -not -name erlang.mk | xargs grep -ci rebar` ]; then \ + $(call dep_autopatch2,$(1)); \ + else \ + $(call dep_autopatch_erlang_mk,$(1)); \ + fi \ + else \ + if [ ! -d $(DEPS_DIR)/$(1)/src/ ]; then \ + $(call dep_autopatch_noop,$(1)); \ + else \ + $(call dep_autopatch2,$(1)); \ + fi \ + fi +endef + +define dep_autopatch2 + if [ ! -f $(DEPS_DIR)/$(1)/rebar.config ]; then \ + $(call dep_autopatch_gen,$(1)); \ + else \ + $(call dep_autopatch_rebar,$(1)); \ + fi +endef + +define dep_autopatch_noop + printf "noop:\n" > $(DEPS_DIR)/$(1)/Makefile +endef + +# Overwrite erlang.mk with the current file by default. +ifeq ($(NO_AUTOPATCH_ERLANG_MK),) +define dep_autopatch_erlang_mk + rm -f $(DEPS_DIR)/$(1)/erlang.mk; \ + cd $(DEPS_DIR)/$(1)/ && ln -s ../../erlang.mk; \ + $(call erlang,$(call dep_autopatch_appsrc.erl,$(1))) +endef +else +define dep_autopatch_erlang_mk + $(call erlang,$(call dep_autopatch_appsrc.erl,$(1))) +endef +endif + +define dep_autopatch_gen + printf "%s\n" \ + "ERLC_OPTS = +debug_info" \ + "include ../../erlang.mk" > $(DEPS_DIR)/$(1)/Makefile; \ + $(call erlang,$(call dep_autopatch_appsrc.erl,$(1))) +endef + +define dep_autopatch_rebar + if [ -f $(DEPS_DIR)/$(1)/Makefile ]; then \ + mv $(DEPS_DIR)/$(1)/Makefile $(DEPS_DIR)/$(1)/Makefile.orig.mk; \ + fi; \ + $(call erlang,$(call dep_autopatch_rebar.erl,$(1))); \ + $(call erlang,$(call dep_autopatch_appsrc.erl,$(1))) +endef + +define dep_autopatch_rebar.erl + {ok, Conf} = file:consult("$(DEPS_DIR)/$(1)/rebar.config"), + Write = fun (Text) -> + file:write_file("$(DEPS_DIR)/$(1)/Makefile", Text, [append]) + end, + Escape = fun (Text) -> + re:replace(Text, "\\\\$$$$", "\$$$$$$$$", [global, {return, list}]) + end, + Write("ERLC_OPTS = +debug_info\n\n"), + fun() -> + File = case lists:keyfind(deps, 1, Conf) of + false -> []; + {_, Deps} -> + [begin + Name = element(1, Dep), + {Method, Repo, Commit} = case element(3, Dep) of + {git, R} -> {git, R, master}; + {M, R, {branch, C}} -> {M, R, C}; + {M, R, {tag, C}} -> {M, R, C}; + {M, R, C} -> {M, R, C} + end, + Write(io_lib:format("DEPS += ~s\ndep_~s = ~s ~s ~s~n", [Name, Name, Method, Repo, Commit])) + end || Dep <- Deps, tuple_size(Dep) > 2] + end + end(), + fun() -> + First = case lists:keyfind(erl_first_files, 1, Conf) of false -> []; {_, Files} -> + Names = [[" ", begin "lre." ++ Elif = lists:reverse(F), lists:reverse(Elif) end] + || "src/" ++ F <- Files], + Write(io_lib:format("COMPILE_FIRST +=~s\n", [Names])) + end + end(), + fun() -> + case lists:keyfind(port_env, 1, Conf) of + {_, Vars} -> + [Write(K ++ " = $$$$\(shell echo " ++ Escape(V) ++ "\)\n") || {K, V} <- Vars], + Write("CFLAGS += $$$$\(DRV_CFLAGS\)\n"), + Write("CXXFLAGS += $$$$\(DRV_CFLAGS\)\n"), + Write("LDFLAGS += $$$$\(DRV_LDFLAGS\)\n"); + _ -> ok + end + end(), + fun() -> + case filelib:is_dir("$(DEPS_DIR)/$(1)/c_src") of + false -> ok; + true -> + Sources = [[" ./c_src/", S] || S <- filelib:wildcard("*.{c,C,cc,cpp}", "$(DEPS_DIR)/$(1)/c_src")], + Write(io_lib:format("SOURCES := ~s\n", [Sources])) + end + end(), + Write("\n\nrebar_dep: pre-deps deps pre-app app\n"), + Write("\npre-deps::\n"), + Write("\npre-app::\n"), + fun() -> + case lists:keyfind(pre_hooks, 1, Conf) of + false -> ok; + {_, Hooks} -> + [case H of + {'get-deps', Command} -> + Write("\npre-deps::\n\t" ++ Escape(Command) ++ "\n"); + {compile, Command} -> + Write("\npre-app::\n\t" ++ Escape(Command) ++ "\n"); + {Regex, compile, Command0} -> + case re:run("$(PLATFORM)", Regex, [{capture, none}]) of + match -> + Command = case Command0 of + "make -C" ++ _ -> Escape(Command0); + "gmake -C" ++ _ -> Escape(Command0); + "make " ++ Command1 -> "make -f Makefile.orig.mk " ++ Escape(Command1); + "gmake " ++ Command1 -> "gmake -f Makefile.orig.mk " ++ Escape(Command1); + _ -> Command0 + end, + Write("\npre-app::\n\t" ++ Command ++ "\n"); + nomatch -> + ok + end; + _ -> ok + end || H <- Hooks] + end + end(), + Write("\ninclude ../../erlang.mk"), + halt() +endef + +define dep_autopatch_appsrc.erl + AppSrcOut = "$(DEPS_DIR)/$(1)/src/$(1).app.src", + AppSrcIn = case filelib:is_regular(AppSrcOut) of false -> "$(DEPS_DIR)/$(1)/ebin/$(1).app"; true -> AppSrcOut end, + case filelib:is_regular(AppSrcIn) of + false -> ok; + true -> + fun() -> + {ok, [{application, $(1), L}]} = file:consult(AppSrcIn), + L2 = case lists:keyfind(modules, 1, L) of {_, _} -> L; false -> [{modules, []}|L] end, + L3 = case lists:keyfind(vsn, 1, L2) of {vsn, git} -> lists:keyreplace(vsn, 1, L2, {vsn, "git"}); _ -> L2 end, + ok = file:write_file(AppSrcOut, io_lib:format("~p.~n", [{application, $(1), L3}])) + end(), + case AppSrcOut of AppSrcIn -> ok; _ -> ok = file:delete(AppSrcIn) end + end, + halt() +endef + define dep_fetch if [ "$$$$VS" = "git" ]; then \ - git clone -n -- $$$$REPO $(DEPS_DIR)/$(1); \ + git clone -q -n -- $$$$REPO $(DEPS_DIR)/$(1); \ cd $(DEPS_DIR)/$(1) && git checkout -q $$$$COMMIT; \ elif [ "$$$$VS" = "hg" ]; then \ - hg clone -U $$$$REPO $(DEPS_DIR)/$(1); \ + hg clone -q -U $$$$REPO $(DEPS_DIR)/$(1); \ cd $(DEPS_DIR)/$(1) && hg update -q $$$$COMMIT; \ + elif [ "$$$$VS" = "svn" ]; then \ + svn checkout -q $$$$REPO $(DEPS_DIR)/$(1); \ + elif [ "$$$$VS" = "cp" ]; then \ + cp -R $$$$REPO $(DEPS_DIR)/$(1); \ else \ echo "Unknown or invalid dependency: $(1). Please consult the erlang.mk README for instructions." >&2; \ exit 78; \ @@ -60,17 +239,42 @@ $(DEPS_DIR)/$(1): @mkdir -p $(DEPS_DIR) ifeq (,$(dep_$(1))) @if [ ! -f $(PKG_FILE2) ]; then $(call core_http_get,$(PKG_FILE2),$(PKG_FILE_URL)); fi - @DEPPKG=$$$$(awk 'BEGIN { FS = "\t" }; $$$$1 == "$(1)" { print $$$$2 " " $$$$3 " " $$$$4 }' $(PKG_FILE2);); \ + $(dep_verbose) DEPPKG=$$$$(awk 'BEGIN { FS = "\t" }; $$$$1 == "$(1)" { print $$$$2 " " $$$$3 " " $$$$4 }' $(PKG_FILE2);); \ VS=$$$$(echo $$$$DEPPKG | cut -d " " -f1); \ REPO=$$$$(echo $$$$DEPPKG | cut -d " " -f2); \ COMMIT=$$$$(echo $$$$DEPPKG | cut -d " " -f3); \ $(call dep_fetch,$(1)) else - @VS=$(word 1,$(dep_$(1))); \ +ifeq (1,$(words $(dep_$(1)))) + $(dep_verbose) VS=git; \ + REPO=$(dep_$(1)); \ + COMMIT=master; \ + $(call dep_fetch,$(1)) +else +ifeq (2,$(words $(dep_$(1)))) + $(dep_verbose) VS=git; \ + REPO=$(word 1,$(dep_$(1))); \ + COMMIT=$(word 2,$(dep_$(1))); \ + $(call dep_fetch,$(1)) +else + $(dep_verbose) VS=$(word 1,$(dep_$(1))); \ REPO=$(word 2,$(dep_$(1))); \ COMMIT=$(word 3,$(dep_$(1))); \ $(call dep_fetch,$(1)) endif +endif +endif + @if [ -f $(DEPS_DIR)/$(1)/configure.ac ]; then \ + echo " AUTO " $(1); \ + cd $(DEPS_DIR)/$(1) && autoreconf -vif; \ + fi + -@if [ -f $(DEPS_DIR)/$(1)/configure ]; then \ + echo " CONF " $(1); \ + cd $(DEPS_DIR)/$(1) && ./configure; \ + fi +ifeq ($(filter $(1),$(NO_AUTOPATCH)),) + @$(call dep_autopatch,$(1)) +endif endef $(foreach dep,$(DEPS),$(eval $(call dep_target,$(dep)))) @@ -99,7 +303,7 @@ pkg-search: $(PKG_FILE2) "Description:\t" $$6 "\n" }' else pkg-search: - $(error Usage: make pkg-search q=STRING) + $(error Usage: $(MAKE) pkg-search q=STRING) endif ifeq ($(PKG_FILE2),$(CURDIR)/.erlang.mk.packages.v2) diff --git a/core/docs.mk b/core/docs.mk new file mode 100644 index 0000000..e1e2d0e --- /dev/null +++ b/core/docs.mk @@ -0,0 +1,19 @@ +# Copyright (c) 2015, Viktor Söderqvist <[email protected]> +# This file is part of erlang.mk and subject to the terms of the ISC License. + +.PHONY: docs-deps + +# Configuration. + +ALL_DOC_DEPS_DIRS = $(addprefix $(DEPS_DIR)/,$(DOC_DEPS)) + +# Targets. + +$(foreach dep,$(DOC_DEPS),$(eval $(call dep_target,$(dep)))) + +ifneq ($(SKIP_DEPS),) +doc-deps: +else +doc-deps: $(ALL_DOC_DEPS_DIRS) + @for dep in $(ALL_DOC_DEPS_DIRS) ; do $(MAKE) -C $$dep; done +endif diff --git a/core/erlc.mk b/core/erlc.mk index 8d720aa..18e8814 100644 --- a/core/erlc.mk +++ b/core/erlc.mk @@ -1,4 +1,4 @@ -# Copyright (c) 2013-2014, Loïc Hoguin <[email protected]> +# Copyright (c) 2013-2015, Loïc Hoguin <[email protected]> # This file is part of erlang.mk and subject to the terms of the ISC License. .PHONY: clean-app @@ -28,12 +28,21 @@ erlc_verbose = $(erlc_verbose_$(V)) xyrl_verbose_0 = @echo " XYRL " $(filter %.xrl %.yrl,$(?F)); xyrl_verbose = $(xyrl_verbose_$(V)) +asn1_verbose_0 = @echo " ASN1 " $(filter %.asn1,$(?F)); +asn1_verbose = $(asn1_verbose_$(V)) + mib_verbose_0 = @echo " MIB " $(filter %.bin %.mib,$(?F)); mib_verbose = $(mib_verbose_$(V)) -# Core targets. +# Targets. + +ifeq ($(wildcard ebin/test),) +app:: app-build +else +app:: clean app-build +endif -app:: erlc-include ebin/$(PROJECT).app +app-build: erlc-include ebin/$(PROJECT).app $(eval MODULES := $(shell find ebin -type f -name \*.beam \ | sed "s/ebin\//'/;s/\.beam/',/" | sed '$$s/.$$//')) @if [ -z "$$(grep -E '^[^%]*{modules,' src/$(PROJECT).app.src)" ]; then \ @@ -46,6 +55,11 @@ app:: erlc-include ebin/$(PROJECT).app | sed "s/{id,[[:space:]]*\"git\"}/{id, \"$(GITDESCRIBE)\"}/" \ > ebin/$(PROJECT).app +erlc-include: + -@if [ -d ebin/ ]; then \ + find include/ src/ -type f -name \*.hrl -newer ebin -exec touch $(shell find src/ -type f -name "*.erl") \; 2>/dev/null || printf ''; \ + fi + define compile_erl $(erlc_verbose) erlc -v $(ERLC_OPTS) -o ebin/ \ -pa ebin/ -I include/ $(filter-out $(ERLC_EXCLUDE_PATHS),\ @@ -58,6 +72,13 @@ define compile_xyrl @rm ebin/*.erl endef +define compile_asn1 + $(asn1_verbose) erlc -v -I include/ -o ebin/ $(1) + @mv ebin/*.hrl include/ + @mv ebin/*.asn1db include/ + @rm ebin/*.erl +endef + define compile_mib $(mib_verbose) erlc -v $(ERLC_MIB_OPTS) -o priv/mibs/ \ -I priv/mibs/ $(COMPILE_MIB_FIRST_PATHS) $(1) @@ -68,6 +89,12 @@ ifneq ($(wildcard src/),) ebin/$(PROJECT).app:: @mkdir -p ebin/ +ifneq ($(wildcard asn1/),) +ebin/$(PROJECT).app:: $(shell find asn1 -type f -name \*.asn1) + @mkdir -p include + $(if $(strip $?),$(call compile_asn1,$?)) +endif + ifneq ($(wildcard mibs/),) ebin/$(PROJECT).app:: $(shell find mibs -type f -name \*.mib) @mkdir -p priv/mibs/ include @@ -85,13 +112,6 @@ endif clean:: clean-app -# Extra targets. - -erlc-include: - -@if [ -d ebin/ ]; then \ - find include/ src/ -type f -name \*.hrl -newer ebin -exec touch $(shell find src/ -type f -name "*.erl") \; 2>/dev/null || printf ''; \ - fi - clean-app: $(gen_verbose) rm -rf ebin/ priv/mibs/ \ $(addprefix include/,$(addsuffix .hrl,$(notdir $(basename $(wildcard mibs/*.mib))))) diff --git a/core/test.mk b/core/test.mk new file mode 100644 index 0000000..7dd5d61 --- /dev/null +++ b/core/test.mk @@ -0,0 +1,48 @@ +# Copyright (c) 2015, Loïc Hoguin <[email protected]> +# This file is part of erlang.mk and subject to the terms of the ISC License. + +.PHONY: test-deps test-dir test-build clean-test-dir + +# Configuration. + +TEST_DIR ?= $(CURDIR)/test + +ALL_TEST_DEPS_DIRS = $(addprefix $(DEPS_DIR)/,$(TEST_DEPS)) + +TEST_ERLC_OPTS ?= +debug_info +warn_export_vars +warn_shadow_vars +warn_obsolete_guard +TEST_ERLC_OPTS += -DTEST=1 + +# Targets. + +$(foreach dep,$(TEST_DEPS),$(eval $(call dep_target,$(dep)))) + +ifneq ($(SKIP_DEPS),) +test-deps: +else +test-deps: $(ALL_TEST_DEPS_DIRS) + @for dep in $(ALL_TEST_DEPS_DIRS) ; do $(MAKE) -C $$dep; done +endif + +ifneq ($(strip $(TEST_DIR)),) +test-dir: + $(gen_verbose) erlc -v $(TEST_ERLC_OPTS) -I include/ -o $(TEST_DIR) \ + $(wildcard $(TEST_DIR)/*.erl $(TEST_DIR)/*/*.erl) -pa ebin/ +endif + +ifeq ($(wildcard ebin/test),) +test-build:: ERLC_OPTS=$(TEST_ERLC_OPTS) +test-build:: clean deps test-deps + @$(MAKE) --no-print-directory app-build test-dir ERLC_OPTS="$(TEST_ERLC_OPTS)" + $(gen_verbose) touch ebin/test +else +test-build:: ERLC_OPTS=$(TEST_ERLC_OPTS) +test-build:: deps test-deps + @$(MAKE) --no-print-directory app-build test-dir ERLC_OPTS="$(TEST_ERLC_OPTS)" +endif + +clean:: clean-test-dir + +clean-test-dir: +ifneq ($(wildcard $(TEST_DIR)/*.beam),) + $(gen_verbose) rm -f $(TEST_DIR)/*.beam +endif @@ -1,1105 +1,14 @@ -# Copyright (c) 2013-2014, Loïc Hoguin <[email protected]> -# -# Permission to use, copy, modify, and/or distribute this software for any -# purpose with or without fee is hereby granted, provided that the above -# copyright notice and this permission notice appear in all copies. -# -# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - -.PHONY: all deps app rel docs tests clean distclean help erlang-mk - -ERLANG_MK_VERSION = 1.2.0-37-g5fef667-dirty - -# Core configuration. - -PROJECT ?= $(notdir $(CURDIR)) -PROJECT := $(strip $(PROJECT)) - -# Verbosity. - -V ?= 0 - -gen_verbose_0 = @echo " GEN " $@; -gen_verbose = $(gen_verbose_$(V)) - -# Core targets. - -all:: deps app rel - -clean:: - $(gen_verbose) rm -f erl_crash.dump - -distclean:: clean - -help:: - @printf "%s\n" \ - "erlang.mk (version $(ERLANG_MK_VERSION)) is distributed under the terms of the ISC License." \ - "Copyright (c) 2013-2014 Loïc Hoguin <[email protected]>" \ - "" \ - "Usage: [V=1] make [target]" \ - "" \ - "Core targets:" \ - " all Run deps, app and rel targets in that order" \ - " deps Fetch dependencies (if needed) and compile them" \ - " app Compile the project" \ - " rel Build a release for this project, if applicable" \ - " docs Build the documentation for this project" \ - " tests Run the tests for this project" \ - " clean Delete temporary and output files from most targets" \ - " distclean Delete all temporary and output files" \ - " help Display this help and exit" \ - "" \ - "The target clean only removes files that are commonly removed." \ - "Dependencies and releases are left untouched." \ - "" \ - "Setting V=1 when calling make enables verbose mode." - -# Core functions. - -ifeq ($(shell which wget 2>/dev/null | wc -l), 1) -define core_http_get - wget --no-check-certificate -O $(1) $(2)|| rm $(1) -endef -else -define core_http_get - erl -noshell -eval 'ssl:start(), inets:start(), case httpc:request(get, {"$(2)", []}, [{autoredirect, true}], []) of {ok, {{_, 200, _}, _, Body}} -> case file:write_file("$(1)", Body) of ok -> ok; {error, R1} -> halt(R1) end; {error, R2} -> halt(R2) end, halt(0).' -endef -endif - # Automated update. ERLANG_MK_BUILD_CONFIG ?= build.config ERLANG_MK_BUILD_DIR ?= .erlang.mk.build -erlang-mk: +erlang.mk: bootstrap git clone https://github.com/ninenines/erlang.mk $(ERLANG_MK_BUILD_DIR) if [ -f $(ERLANG_MK_BUILD_CONFIG) ]; then cp $(ERLANG_MK_BUILD_CONFIG) $(ERLANG_MK_BUILD_DIR); fi - cd $(ERLANG_MK_BUILD_DIR) && make + cd $(ERLANG_MK_BUILD_DIR) && $(MAKE) cp $(ERLANG_MK_BUILD_DIR)/erlang.mk ./erlang.mk rm -rf $(ERLANG_MK_BUILD_DIR) -# Copyright (c) 2013-2014, Loïc Hoguin <[email protected]> -# This file is part of erlang.mk and subject to the terms of the ISC License. - -.PHONY: distclean-deps distclean-pkg pkg-list pkg-search - -# Configuration. - -DEPS_DIR ?= $(CURDIR)/deps -export DEPS_DIR - -REBAR_DEPS_DIR = $(DEPS_DIR) -export REBAR_DEPS_DIR - -ALL_DEPS_DIRS = $(addprefix $(DEPS_DIR)/,$(DEPS)) - -ifeq ($(filter $(DEPS_DIR),$(subst :, ,$(ERL_LIBS))),) -ifeq ($(ERL_LIBS),) - ERL_LIBS = $(DEPS_DIR) -else - ERL_LIBS := $(ERL_LIBS):$(DEPS_DIR) -endif -endif -export ERL_LIBS - -PKG_FILE2 ?= $(CURDIR)/.erlang.mk.packages.v2 -export PKG_FILE2 - -PKG_FILE_URL ?= https://raw.githubusercontent.com/ninenines/erlang.mk/master/packages.v2.tsv - -# Core targets. - -deps:: $(ALL_DEPS_DIRS) - @for dep in $(ALL_DEPS_DIRS) ; do \ - if [ -f $$dep/GNUmakefile ] || [ -f $$dep/makefile ] || [ -f $$dep/Makefile ] ; then \ - $(MAKE) -C $$dep ; \ - else \ - echo "include $(CURDIR)/erlang.mk" | ERLC_OPTS=+debug_info $(MAKE) -f - -C $$dep ; \ - fi ; \ - done - -distclean:: distclean-deps distclean-pkg - -# Deps related targets. - -define dep_fetch - if [ "$$$$VS" = "git" ]; then \ - git clone -n -- $$$$REPO $(DEPS_DIR)/$(1); \ - cd $(DEPS_DIR)/$(1) && git checkout -q $$$$COMMIT; \ - elif [ "$$$$VS" = "hg" ]; then \ - hg clone -U $$$$REPO $(DEPS_DIR)/$(1); \ - cd $(DEPS_DIR)/$(1) && hg update -q $$$$COMMIT; \ - else \ - echo "Unknown or invalid dependency: $(1). Please consult the erlang.mk README for instructions." >&2; \ - exit 78; \ - fi -endef - -define dep_target -$(DEPS_DIR)/$(1): - @mkdir -p $(DEPS_DIR) -ifeq (,$(dep_$(1))) - @if [ ! -f $(PKG_FILE2) ]; then $(call core_http_get,$(PKG_FILE2),$(PKG_FILE_URL)); fi - @DEPPKG=$$$$(awk 'BEGIN { FS = "\t" }; $$$$1 == "$(1)" { print $$$$2 " " $$$$3 " " $$$$4 }' $(PKG_FILE2);); \ - VS=$$$$(echo $$$$DEPPKG | cut -d " " -f1); \ - REPO=$$$$(echo $$$$DEPPKG | cut -d " " -f2); \ - COMMIT=$$$$(echo $$$$DEPPKG | cut -d " " -f3); \ - $(call dep_fetch,$(1)) -else - @VS=$(word 1,$(dep_$(1))); \ - REPO=$(word 2,$(dep_$(1))); \ - COMMIT=$(word 3,$(dep_$(1))); \ - $(call dep_fetch,$(1)) -endif -endef - -$(foreach dep,$(DEPS),$(eval $(call dep_target,$(dep)))) - -distclean-deps: - $(gen_verbose) rm -rf $(DEPS_DIR) - -# Packages related targets. - -$(PKG_FILE2): - @$(call core_http_get,$(PKG_FILE2),$(PKG_FILE_URL)) - -pkg-list: $(PKG_FILE2) - @cat $(PKG_FILE2) | awk 'BEGIN { FS = "\t" }; { print \ - "Name:\t\t" $$1 "\n" \ - "Repository:\t" $$3 "\n" \ - "Website:\t" $$5 "\n" \ - "Description:\t" $$6 "\n" }' - -ifdef q -pkg-search: $(PKG_FILE2) - @cat $(PKG_FILE2) | grep -i ${q} | awk 'BEGIN { FS = "\t" }; { print \ - "Name:\t\t" $$1 "\n" \ - "Repository:\t" $$3 "\n" \ - "Website:\t" $$5 "\n" \ - "Description:\t" $$6 "\n" }' -else -pkg-search: - $(error Usage: make pkg-search q=STRING) -endif - -ifeq ($(PKG_FILE2),$(CURDIR)/.erlang.mk.packages.v2) -distclean-pkg: - $(gen_verbose) rm -f $(PKG_FILE2) -endif - -help:: - @printf "%s\n" "" \ - "Package-related targets:" \ - " pkg-list List all known packages" \ - " pkg-search q=STRING Search for STRING in the package index" - -# Copyright (c) 2013-2014, Loïc Hoguin <[email protected]> -# This file is part of erlang.mk and subject to the terms of the ISC License. - -.PHONY: clean-app - -# Configuration. - -ERLC_OPTS ?= -Werror +debug_info +warn_export_vars +warn_shadow_vars \ - +warn_obsolete_guard # +bin_opt_info +warn_export_all +warn_missing_spec -COMPILE_FIRST ?= -COMPILE_FIRST_PATHS = $(addprefix src/,$(addsuffix .erl,$(COMPILE_FIRST))) -ERLC_EXCLUDE ?= -ERLC_EXCLUDE_PATHS = $(addprefix src/,$(addsuffix .erl,$(ERLC_EXCLUDE))) - -ERLC_MIB_OPTS ?= -COMPILE_MIB_FIRST ?= -COMPILE_MIB_FIRST_PATHS = $(addprefix mibs/,$(addsuffix .mib,$(COMPILE_MIB_FIRST))) - -# Verbosity. - -appsrc_verbose_0 = @echo " APP " $(PROJECT).app.src; -appsrc_verbose = $(appsrc_verbose_$(V)) - -erlc_verbose_0 = @echo " ERLC " $(filter-out $(patsubst %,%.erl,$(ERLC_EXCLUDE)),\ - $(filter %.erl %.core,$(?F))); -erlc_verbose = $(erlc_verbose_$(V)) - -xyrl_verbose_0 = @echo " XYRL " $(filter %.xrl %.yrl,$(?F)); -xyrl_verbose = $(xyrl_verbose_$(V)) - -mib_verbose_0 = @echo " MIB " $(filter %.bin %.mib,$(?F)); -mib_verbose = $(mib_verbose_$(V)) - -# Core targets. - -app:: erlc-include ebin/$(PROJECT).app - $(eval MODULES := $(shell find ebin -type f -name \*.beam \ - | sed "s/ebin\//'/;s/\.beam/',/" | sed '$$s/.$$//')) - @if [ -z "$$(grep -E '^[^%]*{modules,' src/$(PROJECT).app.src)" ]; then \ - echo "Empty modules entry not found in $(PROJECT).app.src. Please consult the erlang.mk README for instructions." >&2; \ - exit 1; \ - fi - $(eval GITDESCRIBE := $(shell git describe --dirty --abbrev=7 --tags --always --first-parent 2>/dev/null || true)) - $(appsrc_verbose) cat src/$(PROJECT).app.src \ - | sed "s/{modules,[[:space:]]*\[\]}/{modules, \[$(MODULES)\]}/" \ - | sed "s/{id,[[:space:]]*\"git\"}/{id, \"$(GITDESCRIBE)\"}/" \ - > ebin/$(PROJECT).app - -define compile_erl - $(erlc_verbose) erlc -v $(ERLC_OPTS) -o ebin/ \ - -pa ebin/ -I include/ $(filter-out $(ERLC_EXCLUDE_PATHS),\ - $(COMPILE_FIRST_PATHS) $(1)) -endef - -define compile_xyrl - $(xyrl_verbose) erlc -v -o ebin/ $(1) - $(xyrl_verbose) erlc $(ERLC_OPTS) -o ebin/ ebin/*.erl - @rm ebin/*.erl -endef - -define compile_mib - $(mib_verbose) erlc -v $(ERLC_MIB_OPTS) -o priv/mibs/ \ - -I priv/mibs/ $(COMPILE_MIB_FIRST_PATHS) $(1) - $(mib_verbose) erlc -o include/ -- priv/mibs/*.bin -endef - -ifneq ($(wildcard src/),) -ebin/$(PROJECT).app:: - @mkdir -p ebin/ - -ifneq ($(wildcard mibs/),) -ebin/$(PROJECT).app:: $(shell find mibs -type f -name \*.mib) - @mkdir -p priv/mibs/ include - $(if $(strip $?),$(call compile_mib,$?)) -endif - -ebin/$(PROJECT).app:: $(shell find src -type f -name \*.erl) \ - $(shell find src -type f -name \*.core) - $(if $(strip $?),$(call compile_erl,$?)) - -ebin/$(PROJECT).app:: $(shell find src -type f -name \*.xrl) \ - $(shell find src -type f -name \*.yrl) - $(if $(strip $?),$(call compile_xyrl,$?)) -endif - -clean:: clean-app - -# Extra targets. - -erlc-include: - -@if [ -d ebin/ ]; then \ - find include/ src/ -type f -name \*.hrl -newer ebin -exec touch $(shell find src/ -type f -name "*.erl") \; 2>/dev/null || printf ''; \ - fi - -clean-app: - $(gen_verbose) rm -rf ebin/ priv/mibs/ \ - $(addprefix include/,$(addsuffix .hrl,$(notdir $(basename $(wildcard mibs/*.mib))))) - -# Copyright (c) 2014, Loïc Hoguin <[email protected]> -# This file is part of erlang.mk and subject to the terms of the ISC License. - -.PHONY: bootstrap bootstrap-lib bootstrap-rel new list-templates - -# Core targets. - -help:: - @printf "%s\n" "" \ - "Bootstrap targets:" \ - " bootstrap Generate a skeleton of an OTP application" \ - " bootstrap-lib Generate a skeleton of an OTP library" \ - " bootstrap-rel Generate the files needed to build a release" \ - " new t=TPL n=NAME Generate a module NAME based on the template TPL" \ - " list-templates List available templates" - -# Bootstrap templates. - -bs_appsrc = "{application, $(PROJECT), [" \ - " {description, \"\"}," \ - " {vsn, \"0.1.0\"}," \ - " {id, \"git\"}," \ - " {modules, []}," \ - " {registered, []}," \ - " {applications, [" \ - " kernel," \ - " stdlib" \ - " ]}," \ - " {mod, {$(PROJECT)_app, []}}," \ - " {env, []}" \ - "]}." -bs_appsrc_lib = "{application, $(PROJECT), [" \ - " {description, \"\"}," \ - " {vsn, \"0.1.0\"}," \ - " {id, \"git\"}," \ - " {modules, []}," \ - " {registered, []}," \ - " {applications, [" \ - " kernel," \ - " stdlib" \ - " ]}" \ - "]}." -bs_Makefile = "PROJECT = $(PROJECT)" \ - "include erlang.mk" -bs_app = "-module($(PROJECT)_app)." \ - "-behaviour(application)." \ - "" \ - "-export([start/2])." \ - "-export([stop/1])." \ - "" \ - "start(_Type, _Args) ->" \ - " $(PROJECT)_sup:start_link()." \ - "" \ - "stop(_State) ->" \ - " ok." -bs_relx_config = "{release, {$(PROJECT)_release, \"1\"}, [$(PROJECT)]}." \ - "{extended_start_script, true}." \ - "{sys_config, \"rel/sys.config\"}." \ - "{vm_args, \"rel/vm.args\"}." -bs_sys_config = "[" \ - "]." -bs_vm_args = "-name $(PROJECT)@127.0.0.1" \ - "-setcookie $(PROJECT)" \ - "-heart" -# Normal templates. -tpl_supervisor = "-module($(n))." \ - "-behaviour(supervisor)." \ - "" \ - "-export([start_link/0])." \ - "-export([init/1])." \ - "" \ - "start_link() ->" \ - " supervisor:start_link({local, ?MODULE}, ?MODULE, [])." \ - "" \ - "init([]) ->" \ - " Procs = []," \ - " {ok, {{one_for_one, 1, 5}, Procs}}." -tpl_gen_server = "-module($(n))." \ - "-behaviour(gen_server)." \ - "" \ - "%% API." \ - "-export([start_link/0])." \ - "" \ - "%% gen_server." \ - "-export([init/1])." \ - "-export([handle_call/3])." \ - "-export([handle_cast/2])." \ - "-export([handle_info/2])." \ - "-export([terminate/2])." \ - "-export([code_change/3])." \ - "" \ - "-record(state, {" \ - "})." \ - "" \ - "%% API." \ - "" \ - "-spec start_link() -> {ok, pid()}." \ - "start_link() ->" \ - " gen_server:start_link(?MODULE, [], [])." \ - "" \ - "%% gen_server." \ - "" \ - "init([]) ->" \ - " {ok, \#state{}}." \ - "" \ - "handle_call(_Request, _From, State) ->" \ - " {reply, ignored, State}." \ - "" \ - "handle_cast(_Msg, State) ->" \ - " {noreply, State}." \ - "" \ - "handle_info(_Info, State) ->" \ - " {noreply, State}." \ - "" \ - "terminate(_Reason, _State) ->" \ - " ok." \ - "" \ - "code_change(_OldVsn, State, _Extra) ->" \ - " {ok, State}." -tpl_cowboy_http = "-module($(n))." \ - "-behaviour(cowboy_http_handler)." \ - "" \ - "-export([init/3])." \ - "-export([handle/2])." \ - "-export([terminate/3])." \ - "" \ - "-record(state, {" \ - "})." \ - "" \ - "init(_, Req, _Opts) ->" \ - " {ok, Req, \#state{}}." \ - "" \ - "handle(Req, State=\#state{}) ->" \ - " {ok, Req2} = cowboy_req:reply(200, Req)," \ - " {ok, Req2, State}." \ - "" \ - "terminate(_Reason, _Req, _State) ->" \ - " ok." -tpl_cowboy_loop = "-module($(n))." \ - "-behaviour(cowboy_loop_handler)." \ - "" \ - "-export([init/3])." \ - "-export([info/3])." \ - "-export([terminate/3])." \ - "" \ - "-record(state, {" \ - "})." \ - "" \ - "init(_, Req, _Opts) ->" \ - " {loop, Req, \#state{}, 5000, hibernate}." \ - "" \ - "info(_Info, Req, State) ->" \ - " {loop, Req, State, hibernate}." \ - "" \ - "terminate(_Reason, _Req, _State) ->" \ - " ok." -tpl_cowboy_rest = "-module($(n))." \ - "" \ - "-export([init/3])." \ - "-export([content_types_provided/2])." \ - "-export([get_html/2])." \ - "" \ - "init(_, _Req, _Opts) ->" \ - " {upgrade, protocol, cowboy_rest}." \ - "" \ - "content_types_provided(Req, State) ->" \ - " {[{{<<\"text\">>, <<\"html\">>, '*'}, get_html}], Req, State}." \ - "" \ - "get_html(Req, State) ->" \ - " {<<\"<html><body>This is REST!</body></html>\">>, Req, State}." -tpl_cowboy_ws = "-module($(n))." \ - "-behaviour(cowboy_websocket_handler)." \ - "" \ - "-export([init/3])." \ - "-export([websocket_init/3])." \ - "-export([websocket_handle/3])." \ - "-export([websocket_info/3])." \ - "-export([websocket_terminate/3])." \ - "" \ - "-record(state, {" \ - "})." \ - "" \ - "init(_, _, _) ->" \ - " {upgrade, protocol, cowboy_websocket}." \ - "" \ - "websocket_init(_, Req, _Opts) ->" \ - " Req2 = cowboy_req:compact(Req)," \ - " {ok, Req2, \#state{}}." \ - "" \ - "websocket_handle({text, Data}, Req, State) ->" \ - " {reply, {text, Data}, Req, State};" \ - "websocket_handle({binary, Data}, Req, State) ->" \ - " {reply, {binary, Data}, Req, State};" \ - "websocket_handle(_Frame, Req, State) ->" \ - " {ok, Req, State}." \ - "" \ - "websocket_info(_Info, Req, State) ->" \ - " {ok, Req, State}." \ - "" \ - "websocket_terminate(_Reason, _Req, _State) ->" \ - " ok." -tpl_ranch_protocol = "-module($(n))." \ - "-behaviour(ranch_protocol)." \ - "" \ - "-export([start_link/4])." \ - "-export([init/4])." \ - "" \ - "-type opts() :: []." \ - "-export_type([opts/0])." \ - "" \ - "-record(state, {" \ - " socket :: inet:socket()," \ - " transport :: module()" \ - "})." \ - "" \ - "start_link(Ref, Socket, Transport, Opts) ->" \ - " Pid = spawn_link(?MODULE, init, [Ref, Socket, Transport, Opts])," \ - " {ok, Pid}." \ - "" \ - "-spec init(ranch:ref(), inet:socket(), module(), opts()) -> ok." \ - "init(Ref, Socket, Transport, _Opts) ->" \ - " ok = ranch:accept_ack(Ref)," \ - " loop(\#state{socket=Socket, transport=Transport})." \ - "" \ - "loop(State) ->" \ - " loop(State)." - -# Plugin-specific targets. - -bootstrap: -ifneq ($(wildcard src/),) - $(error Error: src/ directory already exists) -endif - @printf "%s\n" $(bs_Makefile) > Makefile - @mkdir src/ - @printf "%s\n" $(bs_appsrc) > src/$(PROJECT).app.src - @printf "%s\n" $(bs_app) > src/$(PROJECT)_app.erl - $(eval n := $(PROJECT)_sup) - @printf "%s\n" $(tpl_supervisor) > src/$(PROJECT)_sup.erl - -bootstrap-lib: -ifneq ($(wildcard src/),) - $(error Error: src/ directory already exists) -endif - @printf "%s\n" $(bs_Makefile) > Makefile - @mkdir src/ - @printf "%s\n" $(bs_appsrc_lib) > src/$(PROJECT).app.src - -bootstrap-rel: -ifneq ($(wildcard relx.config),) - $(error Error: relx.config already exists) -endif -ifneq ($(wildcard rel/),) - $(error Error: rel/ directory already exists) -endif - @printf "%s\n" $(bs_relx_config) > relx.config - @mkdir rel/ - @printf "%s\n" $(bs_sys_config) > rel/sys.config - @printf "%s\n" $(bs_vm_args) > rel/vm.args - -new: -ifeq ($(wildcard src/),) - $(error Error: src/ directory does not exist) -endif -ifndef t - $(error Usage: make new t=TEMPLATE n=NAME) -endif -ifndef tpl_$(t) - $(error Unknown template) -endif -ifndef n - $(error Usage: make new t=TEMPLATE n=NAME) -endif - @printf "%s\n" $(tpl_$(t)) > src/$(n).erl - -list-templates: - @echo Available templates: $(sort $(patsubst tpl_%,%,$(filter tpl_%,$(.VARIABLES)))) - -# Copyright (c) 2014, Loïc Hoguin <[email protected]> -# This file is part of erlang.mk and subject to the terms of the ISC License. - -.PHONY: clean-c_src distclean-c_src-env -# todo - -# Configuration. - -C_SRC_DIR = $(CURDIR)/c_src -C_SRC_ENV ?= $(C_SRC_DIR)/env.mk -C_SRC_OUTPUT ?= $(CURDIR)/priv/$(PROJECT).so - -# System type and C compiler/flags. - -UNAME_SYS := $(shell uname -s) -ifeq ($(UNAME_SYS), Darwin) - CC ?= cc - CFLAGS ?= -O3 -std=c99 -arch x86_64 -finline-functions -Wall -Wmissing-prototypes - CXXFLAGS ?= -O3 -arch x86_64 -finline-functions -Wall - LDFLAGS ?= -arch x86_64 -flat_namespace -undefined suppress -else ifeq ($(UNAME_SYS), FreeBSD) - CC ?= cc - CFLAGS ?= -O3 -std=c99 -finline-functions -Wall -Wmissing-prototypes - CXXFLAGS ?= -O3 -finline-functions -Wall -else ifeq ($(UNAME_SYS), Linux) - CC ?= gcc - CFLAGS ?= -O3 -std=c99 -finline-functions -Wall -Wmissing-prototypes - CXXFLAGS ?= -O3 -finline-functions -Wall -endif - -CFLAGS += -fPIC -I $(ERTS_INCLUDE_DIR) -I $(ERL_INTERFACE_INCLUDE_DIR) -CXXFLAGS += -fPIC -I $(ERTS_INCLUDE_DIR) -I $(ERL_INTERFACE_INCLUDE_DIR) - -LDLIBS += -L $(ERL_INTERFACE_LIB_DIR) -lerl_interface -lei -LDFLAGS += -shared - -# Verbosity. - -c_verbose_0 = @echo " C " $(?F); -c_verbose = $(c_verbose_$(V)) - -cpp_verbose_0 = @echo " CPP " $(?F); -cpp_verbose = $(cpp_verbose_$(V)) - -link_verbose_0 = @echo " LD " $(@F); -link_verbose = $(link_verbose_$(V)) - -# Targets. - -ifeq ($(wildcard $(C_SRC_DIR)),) -else ifneq ($(wildcard $(C_SRC_DIR)/Makefile),) -app:: - $(MAKE) -C $(C_SRC_DIR) - -clean:: - $(MAKE) -C $(C_SRC_DIR) clean - -else -SOURCES := $(shell find $(C_SRC_DIR) -type f \( -name "*.c" -o -name "*.C" -o -name "*.cc" -o -name "*.cpp" \)) -OBJECTS = $(addsuffix .o, $(basename $(SOURCES))) - -COMPILE_C = $(c_verbose) $(CC) $(CFLAGS) $(CPPFLAGS) -c -COMPILE_CPP = $(cpp_verbose) $(CXX) $(CXXFLAGS) $(CPPFLAGS) -c - -app:: $(C_SRC_ENV) $(C_SRC_OUTPUT) - -$(C_SRC_OUTPUT): $(OBJECTS) - @mkdir -p priv/ - $(link_verbose) $(CC) $(OBJECTS) $(LDFLAGS) $(LDLIBS) -o $(C_SRC_OUTPUT) - -%.o: %.c - $(COMPILE_C) $(OUTPUT_OPTION) $< - -%.o: %.cc - $(COMPILE_CPP) $(OUTPUT_OPTION) $< - -%.o: %.C - $(COMPILE_CPP) $(OUTPUT_OPTION) $< - -%.o: %.cpp - $(COMPILE_CPP) $(OUTPUT_OPTION) $< - -$(C_SRC_ENV): - @erl -noshell -noinput -eval "file:write_file(\"$(C_SRC_ENV)\", \ - io_lib:format( \ - \"ERTS_INCLUDE_DIR ?= ~s/erts-~s/include/~n\" \ - \"ERL_INTERFACE_INCLUDE_DIR ?= ~s~n\" \ - \"ERL_INTERFACE_LIB_DIR ?= ~s~n\", \ - [code:root_dir(), erlang:system_info(version), \ - code:lib_dir(erl_interface, include), \ - code:lib_dir(erl_interface, lib)])), \ - erlang:halt()." - -clean:: clean-c_src - -clean-c_src: - $(gen_verbose) rm -f $(C_SRC_OUTPUT) $(OBJECTS) - -distclean:: distclean-c_src-env - -distclean-c_src-env: - $(gen_verbose) rm -f $(C_SRC_ENV) - --include $(C_SRC_ENV) -endif - -# Copyright (c) 2013-2014, Loïc Hoguin <[email protected]> -# This file is part of erlang.mk and subject to the terms of the ISC License. - -.PHONY: build-ct-deps build-ct-suites tests-ct clean-ct distclean-ct - -# Configuration. - -CT_OPTS ?= -ifneq ($(wildcard test/),) - CT_SUITES ?= $(sort $(subst _SUITE.erl,,$(shell find test -type f -name \*_SUITE.erl -exec basename {} \;))) -else - CT_SUITES ?= -endif - -TEST_ERLC_OPTS ?= +debug_info +warn_export_vars +warn_shadow_vars +warn_obsolete_guard -TEST_ERLC_OPTS += -DTEST=1 -DEXTRA=1 +'{parse_transform, eunit_autoexport}' - -# Core targets. - -tests:: tests-ct - -clean:: clean-ct - -distclean:: distclean-ct - -help:: - @printf "%s\n" "" \ - "All your common_test suites have their associated targets." \ - "A suite named http_SUITE can be ran using the ct-http target." - -# Plugin-specific targets. - -ALL_TEST_DEPS_DIRS = $(addprefix $(DEPS_DIR)/,$(TEST_DEPS)) - -CT_RUN = ct_run \ - -no_auto_compile \ - -noshell \ - -pa $(realpath ebin) $(DEPS_DIR)/*/ebin \ - -dir test \ - -logdir logs - -$(foreach dep,$(TEST_DEPS),$(eval $(call dep_target,$(dep)))) - -build-ct-deps: $(ALL_TEST_DEPS_DIRS) - @for dep in $(ALL_TEST_DEPS_DIRS) ; do $(MAKE) -C $$dep; done - -build-ct-suites: build-ct-deps - $(gen_verbose) erlc -v $(TEST_ERLC_OPTS) -I include/ -o test/ \ - $(wildcard test/*.erl test/*/*.erl) -pa ebin/ - -tests-ct: ERLC_OPTS = $(TEST_ERLC_OPTS) -tests-ct: clean deps app build-ct-suites - @if [ -d "test" ] ; \ - then \ - mkdir -p logs/ ; \ - $(CT_RUN) -suite $(addsuffix _SUITE,$(CT_SUITES)) $(CT_OPTS) ; \ - fi - $(gen_verbose) rm -f test/*.beam - -define ct_suite_target -ct-$(1): ERLC_OPTS = $(TEST_ERLC_OPTS) -ct-$(1): clean deps app build-ct-suites - @if [ -d "test" ] ; \ - then \ - mkdir -p logs/ ; \ - $(CT_RUN) -suite $(addsuffix _SUITE,$(1)) $(CT_OPTS) ; \ - fi - $(gen_verbose) rm -f test/*.beam -endef - -$(foreach test,$(CT_SUITES),$(eval $(call ct_suite_target,$(test)))) - -clean-ct: - $(gen_verbose) rm -rf test/*.beam - -distclean-ct: - $(gen_verbose) rm -rf logs/ - -# Copyright (c) 2013-2014, Loïc Hoguin <[email protected]> -# This file is part of erlang.mk and subject to the terms of the ISC License. - -.PHONY: plt distclean-plt dialyze - -# Configuration. - -DIALYZER_PLT ?= $(CURDIR)/.$(PROJECT).plt -export DIALYZER_PLT - -PLT_APPS ?= -DIALYZER_DIRS ?= --src -r src -DIALYZER_OPTS ?= -Werror_handling -Wrace_conditions \ - -Wunmatched_returns # -Wunderspecs - -# Core targets. - -distclean:: distclean-plt - -help:: - @printf "%s\n" "" \ - "Dialyzer targets:" \ - " plt Build a PLT file for this project" \ - " dialyze Analyze the project using Dialyzer" - -# Plugin-specific targets. - -$(DIALYZER_PLT): deps app - @dialyzer --build_plt --apps erts kernel stdlib $(PLT_APPS) $(ALL_DEPS_DIRS) - -plt: $(DIALYZER_PLT) - -distclean-plt: - $(gen_verbose) rm -f $(DIALYZER_PLT) - -ifneq ($(wildcard $(DIALYZER_PLT)),) -dialyze: -else -dialyze: $(DIALYZER_PLT) -endif - @dialyzer --no_native $(DIALYZER_DIRS) $(DIALYZER_OPTS) - -# Copyright (c) 2013-2014, Loïc Hoguin <[email protected]> -# This file is part of erlang.mk and subject to the terms of the ISC License. - -.PHONY: distclean-edoc - -# Configuration. - -EDOC_OPTS ?= - -# Core targets. - -docs:: distclean-edoc - $(gen_verbose) erl -noshell \ - -eval 'edoc:application($(PROJECT), ".", [$(EDOC_OPTS)]), init:stop().' - -distclean:: distclean-edoc - -# Plugin-specific targets. - -distclean-edoc: - $(gen_verbose) rm -f doc/*.css doc/*.html doc/*.png doc/edoc-info - -# Copyright (c) 2014, Juan Facorro <[email protected]> -# This file is part of erlang.mk and subject to the terms of the ISC License. - -.PHONY: elvis distclean-elvis - -# Configuration. - -ELVIS_CONFIG ?= $(CURDIR)/elvis.config - -ELVIS ?= $(CURDIR)/elvis -export ELVIS - -ELVIS_URL ?= https://github.com/inaka/elvis/releases/download/0.2.3/elvis -ELVIS_CONFIG_URL ?= https://github.com/inaka/elvis/releases/download/0.2.3/elvis.config -ELVIS_OPTS ?= - -# Core targets. - -help:: - @printf "%s\n" "" \ - "Elvis targets:" \ - " elvis Run Elvis using the local elvis.config or download the default otherwise" - -ifneq ($(wildcard $(ELVIS_CONFIG)),) -rel:: distclean-elvis -endif - -distclean:: distclean-elvis - -# Plugin-specific targets. - -$(ELVIS): - @$(call core_http_get,$(ELVIS_CONFIG),$(ELVIS_CONFIG_URL)) - @$(call core_http_get,$(ELVIS),$(ELVIS_URL)) - @chmod +x $(ELVIS) - -elvis: $(ELVIS) - @$(ELVIS) rock -c $(ELVIS_CONFIG) $(ELVIS_OPTS) - -distclean-elvis: - $(gen_verbose) rm -rf $(ELVIS) - -# Copyright (c) 2013-2014, Loïc Hoguin <[email protected]> -# This file is part of erlang.mk and subject to the terms of the ISC License. - -# Verbosity. - -dtl_verbose_0 = @echo " DTL " $(filter %.dtl,$(?F)); -dtl_verbose = $(dtl_verbose_$(V)) - -# Core targets. - -define compile_erlydtl - $(dtl_verbose) erl -noshell -pa ebin/ $(DEPS_DIR)/erlydtl/ebin/ -eval ' \ - Compile = fun(F) -> \ - Module = list_to_atom( \ - string:to_lower(filename:basename(F, ".dtl")) ++ "_dtl"), \ - erlydtl:compile(F, Module, [{out_dir, "ebin/"}]) \ - end, \ - _ = [Compile(F) || F <- string:tokens("$(1)", " ")], \ - init:stop()' -endef - -ifneq ($(wildcard src/),) -ebin/$(PROJECT).app:: $(shell find templates -type f -name \*.dtl 2>/dev/null) - $(if $(strip $?),$(call compile_erlydtl,$?)) -endif - -# Copyright (c) 2014 Dave Cottlehuber <[email protected]> -# This file is part of erlang.mk and subject to the terms of the ISC License. - -.PHONY: distclean-escript escript - -# Configuration. - -ESCRIPT_NAME ?= $(PROJECT) -ESCRIPT_COMMENT ?= This is an -*- erlang -*- file - -ESCRIPT_BEAMS ?= "ebin/*", "deps/*/ebin/*" -ESCRIPT_SYS_CONFIG ?= "rel/sys.config" -ESCRIPT_EMU_ARGS ?= -pa . \ - -noshell -noinput \ - -sasl errlog_type error \ - -escript main $(ESCRIPT_NAME) -ESCRIPT_SHEBANG ?= /usr/bin/env escript -ESCRIPT_STATIC ?= "deps/*/priv/**", "priv/**" - -# Core targets. - -distclean:: distclean-escript - -help:: - @printf "%s\n" "" \ - "Escript targets:" \ - " escript Build an executable escript archive" \ - -# Plugin-specific targets. - -# Based on https://github.com/synrc/mad/blob/master/src/mad_bundle.erl -# Copyright (c) 2013 Maxim Sokhatsky, Synrc Research Center -# Modified MIT License, https://github.com/synrc/mad/blob/master/LICENSE : -# Software may only be used for the great good and the true happiness of all -# sentient beings. -define ESCRIPT_RAW -'Read = fun(F) -> {ok, B} = file:read_file(filename:absname(F)), B end,'\ -'Files = fun(L) -> A = lists:concat([filelib:wildcard(X)||X<- L ]),'\ -' [F || F <- A, not filelib:is_dir(F) ] end,'\ -'Squash = fun(L) -> [{filename:basename(F), Read(F) } || F <- L ] end,'\ -'Zip = fun(A, L) -> {ok,{_,Z}} = zip:create(A, L, [{compress,all},memory]), Z end,'\ -'Ez = fun(Escript) ->'\ -' Static = Files([$(ESCRIPT_STATIC)]),'\ -' Beams = Squash(Files([$(ESCRIPT_BEAMS), $(ESCRIPT_SYS_CONFIG)])),'\ -' Archive = Beams ++ [{ "static.gz", Zip("static.gz", Static)}],'\ -' escript:create(Escript, [ $(ESCRIPT_OPTIONS)'\ -' {archive, Archive, [memory]},'\ -' {shebang, "$(ESCRIPT_SHEBANG)"},'\ -' {comment, "$(ESCRIPT_COMMENT)"},'\ -' {emu_args, " $(ESCRIPT_EMU_ARGS)"}'\ -' ]),'\ -' file:change_mode(Escript, 8#755)'\ -'end,'\ -'Ez("$(ESCRIPT_NAME)").' -endef -ESCRIPT_COMMAND = $(subst ' ',,$(ESCRIPT_RAW)) - -escript:: distclean-escript deps app - $(gen_verbose) erl -noshell -eval $(ESCRIPT_COMMAND) -s init stop - -distclean-escript: - $(gen_verbose) rm -f $(ESCRIPT_NAME) - -# Copyright (c) 2014, Enrique Fernandez <[email protected]> -# This file is contributed to erlang.mk and subject to the terms of the ISC License. - -.PHONY: help-eunit build-eunit eunit distclean-eunit - -# Configuration - -EUNIT_ERLC_OPTS ?= +debug_info +warn_export_vars +warn_shadow_vars +warn_obsolete_guard -DTEST=1 -DEXTRA=1 - -EUNIT_DIR ?= -EUNIT_DIRS = $(sort $(EUNIT_DIR) ebin) - -ifeq ($(strip $(EUNIT_DIR)),) -TAGGED_EUNIT_TESTS = {dir,"ebin"} -else -# All modules in EUNIT_DIR -EUNIT_DIR_MODS = $(notdir $(basename $(shell find $(EUNIT_DIR) -type f -name *.beam))) -# All modules in 'ebin' -EUNIT_EBIN_MODS = $(notdir $(basename $(shell find ebin -type f -name *.beam))) -# Only those modules in EUNIT_DIR with no matching module in 'ebin'. -# This is done to avoid some tests being executed twice. -EUNIT_MODS = $(filter-out $(patsubst %,%_tests,$(EUNIT_EBIN_MODS)),$(EUNIT_DIR_MODS)) -TAGGED_EUNIT_TESTS = {dir,"ebin"} $(foreach mod,$(EUNIT_MODS),$(shell echo $(mod) | sed -e 's/\(.*\)/{module,\1}/g')) -endif - -EUNIT_OPTS ?= verbose - -# Utility functions - -define str-join - $(shell echo '$(strip $(1))' | sed -e "s/ /,/g") -endef - -# Core targets. - -help:: help-eunit - -tests:: eunit - -clean:: clean-eunit - -# Plugin-specific targets. - -EUNIT_RUN = erl \ - -no_auto_compile \ - -noshell \ - -pa $(realpath $(EUNIT_DIR)) $(DEPS_DIR)/*/ebin \ - -pz $(realpath ebin) \ - -eval 'case eunit:test([$(call str-join,$(TAGGED_EUNIT_TESTS))], [$(EUNIT_OPTS)]) of ok -> erlang:halt(0); error -> erlang:halt(1) end.' - -help-eunit: - @printf "%s\n" "" \ - "EUnit targets:" \ - " eunit Run all the EUnit tests for this project" - -ifeq ($(strip $(EUNIT_DIR)),) -build-eunit: -else ifeq ($(strip $(EUNIT_DIR)),ebin) -build-eunit: -else -build-eunit: - $(gen_verbose) erlc -v $(EUNIT_ERLC_OPTS) -I include/ -o $(EUNIT_DIR) \ - $(wildcard $(EUNIT_DIR)/*.erl $(EUNIT_DIR)/*/*.erl) -pa ebin/ -endif - -eunit: ERLC_OPTS = $(EUNIT_ERLC_OPTS) -eunit: clean deps app build-eunit - $(gen_verbose) $(EUNIT_RUN) - -clean-eunit: - $(gen_verbose) $(foreach dir,$(EUNIT_DIRS),rm -rf $(dir)/*.beam) - -# Copyright (c) 2013-2014, Loïc Hoguin <[email protected]> -# This file is part of erlang.mk and subject to the terms of the ISC License. - -.PHONY: relx-rel distclean-relx-rel distclean-relx - -# Configuration. - -RELX_CONFIG ?= $(CURDIR)/relx.config - -RELX ?= $(CURDIR)/relx -export RELX - -RELX_URL ?= https://github.com/erlware/relx/releases/download/v1.0.2/relx -RELX_OPTS ?= -RELX_OUTPUT_DIR ?= _rel - -ifeq ($(firstword $(RELX_OPTS)),-o) - RELX_OUTPUT_DIR = $(word 2,$(RELX_OPTS)) -else - RELX_OPTS += -o $(RELX_OUTPUT_DIR) -endif - -# Core targets. - -ifneq ($(wildcard $(RELX_CONFIG)),) -rel:: distclean-relx-rel relx-rel -endif - -distclean:: distclean-relx-rel distclean-relx - -# Plugin-specific targets. - -define relx_fetch - $(call core_http_get,$(RELX),$(RELX_URL)) - chmod +x $(RELX) -endef - -$(RELX): - @$(call relx_fetch) - -relx-rel: $(RELX) - @$(RELX) -c $(RELX_CONFIG) $(RELX_OPTS) - -distclean-relx-rel: - $(gen_verbose) rm -rf $(RELX_OUTPUT_DIR) - -distclean-relx: - $(gen_verbose) rm -rf $(RELX) - -# Copyright (c) 2014, M Robert Martin <[email protected]> -# This file is contributed to erlang.mk and subject to the terms of the ISC License. - -.PHONY: shell - -# Configuration. - -SHELL_PATH ?= -pa $(CURDIR)/ebin $(DEPS_DIR)/*/ebin -SHELL_OPTS ?= - -ALL_SHELL_DEPS_DIRS = $(addprefix $(DEPS_DIR)/,$(SHELL_DEPS)) - -# Core targets - -help:: - @printf "%s\n" "" \ - "Shell targets:" \ - " shell Run an erlang shell with SHELL_OPTS or reasonable default" - -# Plugin-specific targets. - -$(foreach dep,$(SHELL_DEPS),$(eval $(call dep_target,$(dep)))) - -build-shell-deps: $(ALL_SHELL_DEPS_DIRS) - @for dep in $(ALL_SHELL_DEPS_DIRS) ; do $(MAKE) -C $$dep ; done - -shell: build-shell-deps - $(gen_verbose) erl $(SHELL_PATH) $(SHELL_OPTS) +.PHONY: bootstrap +bootstrap: ; diff --git a/packages.v1.tsv b/packages.v1.tsv index 6916e1e..3aa106c 100644 --- a/packages.v1.tsv +++ b/packages.v1.tsv @@ -1,60 +1,141 @@ -apns4erl https://github.com/inaka/apns4erl.git http://inaka.github.com/apns4erl Apple Push Notification Server for Erlang +apns https://github.com/inaka/apns4erl http://inaka.github.com/apns4erl Apple Push Notification Server for Erlang +azdht https://github.com/arcusfelis/azdht https://github.com/arcusfelis/azdht Azureus Distributed Hash Table (DHT) in Erlang +binpp https://github.com/jtendo/binpp https://github.com/jtendo/binpp Erlang Binary Pretty Printer +bitcask https://github.com/basho/bitcask https://github.com/basho/bitcask because you need another a key/value storage engine bullet https://github.com/extend/bullet http://ninenines.eu Simple, reliable, efficient streaming for Cowboy. cake https://github.com/darach/cake-erl https://github.com/darach/cake-erl Really simple terminal colorization -classifier https://github.com/inaka/classifier.git https://github.com/inaka/classifier An Erlang Bayesian Filter and Text Classifier +classifier https://github.com/inaka/classifier https://github.com/inaka/classifier An Erlang Bayesian Filter and Text Classifier +couchbeam https://github.com/benoitc/couchbeam https://github.com/benoitc/couchbeam Apache CouchDB client in Erlang cowboy https://github.com/ninenines/cowboy http://ninenines.eu Small, fast and modular HTTP server. cowlib https://github.com/ninenines/cowlib http://ninenines.eu Support library for manipulating Web protocols. -czmq https://github.com/gar1t/erlang-czmq.git https://github.com/gar1t/erlang-czmq External port bindings for CZMQ. -debbie https://github.com/crownedgrouse/debbie.git https://github.com/crownedgrouse/debbie .DEB Built In Erlang -e2 https://github.com/gar1t/e2.git http://e2project.org Library to simply writing correct OTP applications. -ebitly https://github.com/inaka/ebitly.git http://inaka.github.com/ebitly Bit.ly API wrapper for Erlang -edgar https://github.com/crownedgrouse/edgar.git https://github.com/crownedgrouse/edgar Erlang Does GNU AR -edis https://github.com/inaka/edis.git http://inaka.github.com/edis/ An Erlang implementation of Redis KV Store -eganglia https://github.com/inaka/eganglia.git https://github.com/inaka/eganglia.git Erlang library to interact with Ganglia +damocles https://github.com/lostcolony/damocles https://github.com/lostcolony/damocles Erlang library for generating adversarial network conditions for QAing distributed applications/systems on a single Linux box. +debbie https://github.com/crownedgrouse/debbie https://github.com/crownedgrouse/debbie .DEB Built In Erlang +dispcount https://github.com/ferd/dispcount https://github.com/ferd/dispcount Erlang task dispatcher based on ETS counters. +e2 https://github.com/gar1t/e2 http://e2project.org Library to simply writing correct OTP applications. +edgar https://github.com/crownedgrouse/edgar https://github.com/crownedgrouse/edgar Erlang Does GNU AR +edis https://github.com/inaka/edis http://inaka.github.com/edis/ An Erlang implementation of Redis KV Store +eep https://github.com/virtan/eep https://github.com/virtan/eep Erlang Easy Profiling (eep) application provides a way to analyze application performance and call hierarchy +efene https://github.com/efene/efene https://github.com/efene/efene Alternative syntax for the Erlang Programming Language focusing on simplicity, ease of use and programmer UX +eganglia https://github.com/inaka/eganglia https://github.com/inaka/eganglia Erlang library to interact with Ganglia ehsa https://bitbucket.org/a12n/ehsa https://bitbucket.org/a12n/ehsa Erlang HTTP server basic and digest authentication modules -elvis https://github.com/inaka/elvis.git https://github.com/inaka/elvis.git Erlang Style Reviewer -emysql https://github.com/Eonblast/Emysql.git https://github.com/Eonblast/Emysql Stable, pure Erlang MySQL driver. +ej https://github.com/seth/ej https://github.com/seth/ej Helper module for working with Erlang terms representing JSON +eleveldb https://github.com/basho/eleveldb https://github.com/basho/eleveldb Erlang LevelDB API +elli https://github.com/knutin/elli https://github.com/knutin/elli Simple, robust and performant Erlang web server +elvis https://github.com/inaka/elvis https://github.com/inaka/elvis Erlang Style Reviewer +emysql https://github.com/Eonblast/Emysql https://github.com/Eonblast/Emysql Stable, pure Erlang MySQL driver. +entop https://github.com/mazenharake/entop https://github.com/mazenharake/entop A top-like tool for monitoring an Erlang node eper https://github.com/massemanet/eper https://github.com/massemanet/eper Erlang performance and debugging tools. epgsql https://github.com/epgsql/epgsql https://github.com/epgsql/epgsql Erlang PostgreSQL client library. -eredis https://github.com/wooga/eredis https://github.com/wooga/eredis Non-blocking Redis client with focus on performance and robustness -erldb https://github.com/erldb/erldb.git http://erldb.org ORM (Object-relational mapping) application implemented in Erlang +epocxy https://github.com/duomark/epocxy https://github.com/duomark/epocxy Erlang Patterns of Concurrency +eredis https://github.com/wooga/eredis https://github.com/wooga/eredis Erlang Redis client +erlang_js https://github.com/basho/erlang_js https://github.com/basho/erlang_js A linked-in driver for Erlang to Mozilla's Spidermonkey Javascript runtime. +erlasticsearch https://github.com/dieswaytoofast/erlasticsearch https://github.com/dieswaytoofast/erlasticsearch Erlang thrift interface to elastic_search +erlcloud https://github.com/gleber/erlcloud https://github.com/gleber/erlcloud Cloud Computing library for erlang (Amazon EC2, S3, SQS, SimpleDB, Mechanical Turk, ELB) +erlcron https://github.com/erlware/erlcron https://github.com/erlware/erlcron Erlang cronish system +erldb https://github.com/erldb/erldb http://erldb.org ORM (Object-relational mapping) application implemented in Erlang +erldns https://github.com/aetrion/erl-dns https://github.com/aetrion/erl-dns DNS server, in erlang. +erlog https://github.com/rvirding/erlog https://github.com/rvirding/erlog Prolog interpreter in and for Erlang +erlport https://github.com/hdima/erlport https://github.com/hdima/erlport ErlPort - connect Erlang to other languages +erlsom https://github.com/willemdj/erlsom https://github.com/willemdj/erlsom XML parser for Erlang +erlubi https://github.com/krestenkrab/erlubi https://github.com/krestenkrab/erlubi Ubigraph Erlang Client (and Process Visualizer) +erlware_commons https://github.com/erlware/erlware_commons https://github.com/erlware/erlware_commons Erlware Commons is an Erlware project focused on all aspects of reusable Erlang components. erlydtl https://github.com/erlydtl/erlydtl https://github.com/erlydtl/erlydtl Django Template Language for Erlang. erwa https://github.com/bwegh/erwa https://github.com/bwegh/erwa A WAMP router and client written in Erlang. +exmpp https://github.com/processone/exmpp https://github.com/processone/exmpp Erlang XMPP library +exometer https://github.com/Feuerlabs/exometer https://github.com/Feuerlabs/exometer Basic measurement objects and probe behavior exs1024 https://github.com/jj1bdx/exs1024 https://github.com/jj1bdx/exs1024 Xorshift1024star pseudo random number generator for Erlang. exs64 https://github.com/jj1bdx/exs64 https://github.com/jj1bdx/exs64 Xorshift64star pseudo random number generator for Erlang. -exsplus https://github.com/jj1bdx/exsplus https://github.com/jj1bdx/exsplus Xorshift128plus pseudo random number generator for Erlang. +exsplus116 https://github.com/jj1bdx/exsplus116 https://github.com/jj1bdx/exsplus116 Xorshift116plus for Erlang +exsplus128 https://github.com/jj1bdx/exsplus128 https://github.com/jj1bdx/exsplus128 Xorshift128plus pseudo random number generator for Erlang. +fast_disk_log https://github.com/lpgauth/fast_disk_log https://github.com/lpgauth/fast_disk_log Pool-based asynchronous Erlang disk logger feeder https://github.com/michaelnisi/feeder https://github.com/michaelnisi/feeder Stream parse RSS and Atom formatted XML feeds. -getopt https://github.com/jcomellas/getopt.git https://github.com/jcomellas/getopt Module to parse command line arguments using the GNU getopt syntax -gproc https://github.com/uwiger/gproc.git https://github.com/uwiger/gproc Extended process registry for Erlang -gun https://github.com/extend/gun http//ninenines.eu Asynchronous SPDY, HTTP and Websocket client written in Erlang. +folsom https://github.com/boundary/folsom https://github.com/boundary/folsom Expose Erlang Events and Metrics +fuse https://github.com/jlouis/fuse https://github.com/jlouis/fuse A Circuit Breaker for Erlang +geas https://github.com/crownedgrouse/geas https://github.com/crownedgrouse/geas Guess Erlang Application Scattering +gen_nb_server https://github.com/kevsmith/gen_nb_server https://github.com/kevsmith/gen_nb_server OTP behavior for writing non-blocking servers +gen_smtp https://github.com/Vagabond/gen_smtp https://github.com/Vagabond/gen_smtp A generic Erlang SMTP server and client that can be extended via callback modules +getopt https://github.com/jcomellas/getopt https://github.com/jcomellas/getopt Module to parse command line arguments using the GNU getopt syntax +gproc https://github.com/uwiger/gproc https://github.com/uwiger/gproc Extended process registry for Erlang +gun https://github.com/ninenines/gun http//ninenines.eu Asynchronous SPDY, HTTP and Websocket client written in Erlang. +hackney https://github.com/benoitc/hackney https://github.com/benoitc/hackney simple HTTP client in Erlang hanoidb https://github.com/krestenkrab/hanoidb https://github.com/krestenkrab/hanoidb Erlang LSM BTree Storage ibrowse https://github.com/cmullaparthi/ibrowse https://github.com/cmullaparthi/ibrowse Erlang HTTP client -itweet https://github.com/inaka/itweet.git http://inaka.github.com/itweet/ Twitter Stream API on ibrowse +ierlang https://github.com/robbielynch/ierlang https://github.com/robbielynch/ierlang An Erlang language kernel for IPython. +itweet https://github.com/inaka/itweet http://inaka.github.com/itweet/ Twitter Stream API on ibrowse +jesse https://github.com/klarna/jesse https://github.com/klarna/jesse jesse (JSon Schema Erlang) is an implementation of a json schema validator for Erlang. jiffy https://github.com/davisp/jiffy https://github.com/davisp/jiffy JSON NIFs for Erlang. jiffy_v https://github.com/shizzard/jiffy-v https://github.com/shizzard/jiffy-v JSON validation utility +jobs https://github.com/esl/jobs https://github.com/esl/jobs a Job scheduler for load regulation +joxa https://github.com/joxa/joxa https://github.com/joxa/joxa A Modern Lisp for the Erlang VM +json https://github.com/talentdeficit/json https://github.com/talentdeficit/json a high level json library for erlang (17.0+) jsx https://github.com/talentdeficit/jsx https://github.com/talentdeficit/jsx An Erlang application for consuming, producing and manipulating JSON. katja https://github.com/nifoc/katja https://github.com/nifoc/katja A simple Riemann client written in Erlang. +kjell https://github.com/karlll/kjell https://github.com/karlll/kjell Erlang Shell +kraken https://github.com/Asana/kraken https://github.com/Asana/kraken Distributed Pubsub Server for Realtime Apps lager https://github.com/basho/lager https://github.com/basho/lager A logging framework for Erlang/OTP. -lasse https://github.com/inaka/lasse.git https://github.com/inaka/lasse.git SSE handler for Cowboy -leptus https://github.com/s1n4/leptus https://github.com/s1n4/leptus Erlang REST framework +lasse https://github.com/inaka/lasse https://github.com/inaka/lasse SSE handler for Cowboy +lfe https://github.com/rvirding/lfe https://github.com/rvirding/lfe Lisp Flavoured Erlang (LFE) +ling https://github.com/cloudozer/ling https://github.com/cloudozer/ling Erlang on Xen live https://github.com/ninenines/live http://ninenines.eu Automated module and configuration reloader. -mekao https://github.com/ddosia/mekao.git https://github.com/ddosia/mekao SQL constructor -modlib https://github.com/gar1t/modlib.git https://github.com/gar1t/modlib Web framework based on Erlang's inets httpd +locks https://github.com/uwiger/locks https://github.com/uwiger/locks A scalable, deadlock-resolving resource locker +log4erl https://github.com/ahmednawras/log4erl https://github.com/ahmednawras/log4erl A logger for erlang in the spirit of Log4J. +luerl https://github.com/rvirding/luerl https://github.com/rvirding/luerl Lua in Erlang +mad https://github.com/synrc/mad https://github.com/synrc/mad Small and Fast Rebar Replacement +meck https://github.com/eproxus/meck https://github.com/eproxus/meck A mocking library for Erlang +mekao https://github.com/ddosia/mekao https://github.com/ddosia/mekao SQL constructor +mochiweb https://github.com/mochi/mochiweb https://github.com/mochi/mochiweb MochiWeb is an Erlang library for building lightweight HTTP servers. +modlib https://github.com/gar1t/modlib https://github.com/gar1t/modlib Web framework based on Erlang's inets httpd +mongodb https://github.com/comtihon/mongodb-erlang https://github.com/comtihon/mongodb-erlang MongoDB driver for Erlang +msgpack https://github.com/msgpack/msgpack-erlang https://github.com/msgpack/msgpack-erlang MessagePack (de)serializer implementation for Erlang +mustache https://github.com/mojombo/mustache.erl https://github.com/mojombo/mustache.erl Mustache template engine for Erlang. +mysql https://github.com/dizzyd/erlang-mysql-driver https://github.com/dizzyd/erlang-mysql-driver Erlang MySQL Driver (from code.google.com) +n2o https://github.com/5HT/n2o https://github.com/5HT/n2o WebSocket Application Server +nat_upnp https://github.com/benoitc/nat_upnp https://github.com/benoitc/nat_upnp Erlang library to map your internal port to an external using UNP IGD neo4j https://github.com/dmitriid/neo4j-erlang https://github.com/dmitriid/neo4j-erlang Erlang client library for Neo4J. +neotoma https://github.com/seancribbs/neotoma https://github.com/seancribbs/neotoma Erlang library and packrat parser-generator for parsing expression grammars. +nodefinder https://github.com/erlanger/nodefinder https://github.com/erlanger/nodefinder automatic node discovery via UDP multicast +oauth2 https://github.com/kivra/oauth2 https://github.com/kivra/oauth2 Erlang Oauth2 implementation +oauth https://github.com/tim/erlang-oauth https://github.com/tim/erlang-oauth An Erlang OAuth 1.0 implementation +openpoker https://github.com/hpyhacking/openpoker https://github.com/hpyhacking/openpoker Genesis Texas hold'em Game Server pegjs https://github.com/dmitriid/pegjs https://github.com/dmitriid/pegjs An implementation of PEG.js grammar for Erlang. +pobox https://github.com/ferd/pobox https://github.com/ferd/pobox External buffer processes to protect against mailbox overflow in Erlang +poolboy https://github.com/devinus/poolboy https://github.com/devinus/poolboy A hunky Erlang worker pool factory +pooler https://github.com/seth/pooler https://github.com/seth/pooler An OTP Process Pool Application +procket https://github.com/msantos/procket http://blog.listincomprehension.com/search/label/procket Erlang interface to low level socket operations proper https://github.com/manopapad/proper http://proper.softlab.ntua.gr PropEr: a QuickCheck-inspired property-based testing tool for Erlang. -psycho https://github.com/gar1t/psycho.git https://github.com/gar1t/psycho HTTP server that provides a WSGI-like interface for applications and middleware. -ptrackerl https://github.com/inaka/ptrackerl.git https://github.com/inaka/ptrackerl.git Pivotal Tracker API Client written in Erlang -pusherman https://github.com/inaka/pusherman.git https://github.com/inaka/pusherman.git queuing system for push notifications +protobuffs https://github.com/basho/erlang_protobuffs https://github.com/basho/erlang_protobuffs An implementation of Google's Protocol Buffers for Erlang, based on ngerakines/erlang_protobuffs. +ptrackerl https://github.com/inaka/ptrackerl https://github.com/inaka/ptrackerl Pivotal Tracker API Client written in Erlang +push_service https://github.com/hairyhum/push_service https://github.com/hairyhum/push_service Push service +qdate https://github.com/choptastic/qdate https://github.com/choptastic/qdate Date, time, and timezone parsing, formatting, and conversion for Erlang. +rack https://github.com/erlyvideo/rack https://github.com/erlyvideo/rack Rack handler for erlang ranch https://github.com/ninenines/ranch http://ninenines.eu Socket acceptor pool for TCP protocols. +rec2json https://github.com/lordnull/rec2json https://github.com/lordnull/rec2json Compile erlang record definitions into modules to convert them to/from json easily. +recon https://github.com/ferd/recon https://github.com/ferd/recon Collection of functions and scripts to debug Erlang in production. +record_info https://github.com/bipthelin/erlang-record_info https://github.com/bipthelin/erlang-record_info Convert between record and proplist +relx https://github.com/erlware/relx https://github.com/erlware/relx Sane, simple release creation for Erlang resource_discovery https://github.com/erlware/resource_discovery http://erlware.org/ An application used to dynamically discover resources present in an Erlang node cluster. -sfmt-erlang https://github.com/jj1bdx/sfmt-erlang https://github.com/jj1bdx/sfmt-erlang SFMT pseudo random number generator for Erlang. +riak_dt https://github.com/basho/riak_dt https://github.com/basho/riak_dt Convergent replicated datatypes in Erlang +rlimit https://github.com/jlouis/rlimit https://github.com/jlouis/rlimit Magnus Klaar's rate limiter code from etorrent +safetyvalve https://github.com/jlouis/safetyvalve https://github.com/jlouis/safetyvalve A safety valve for your erlang node +sfmt https://github.com/jj1bdx/sfmt-erlang https://github.com/jj1bdx/sfmt-erlang SFMT pseudo random number generator for Erlang. sheriff https://github.com/extend/sheriff http://ninenines.eu Parse transform for type based validation. -shotgun https://github.com/inaka/shotgun.git https://github.com/inaka/shotgun.git better than just a gun -sumo_db https://github.com/inaka/sumo_db.git https://github.com/inaka/sumo_db.git Erlang Persistency Framework -swab https://github.com/crownedgrouse/swab.git https://github.com/crownedgrouse/swab General purpose buffer handling module -sync https://github.com/rustyio/sync.git https://github.com/rustyio/sync On-the-fly recompiling and reloading in Erlang. +shotgun https://github.com/inaka/shotgun https://github.com/inaka/shotgun better than just a gun +sqerl https://github.com/hairyhum/sqerl https://github.com/hairyhum/sqerl An Erlang-flavoured SQL DSL +statebox https://github.com/mochi/statebox https://github.com/mochi/statebox Erlang state monad with merge/conflict-resolution capabilities. Useful for Riak. +swab https://github.com/crownedgrouse/swab https://github.com/crownedgrouse/swab General purpose buffer handling module +switchboard https://github.com/thusfresh/switchboard https://github.com/thusfresh/switchboard A framework for processing email using worker plugins. +sync https://github.com/rustyio/sync https://github.com/rustyio/sync On-the-fly recompiling and reloading in Erlang. tddreloader https://github.com/version2beta/tddreloader https://github.com/version2beta/tddreloader Shell utility for recompiling, reloading, and testing code as it changes -tinymt-erlang https://github.com/jj1bdx/tinymt-erlang https://github.com/jj1bdx/tinymt-erlang TinyMT pseudo random number generator for Erlang. +tinymt https://github.com/jj1bdx/tinymt-erlang https://github.com/jj1bdx/tinymt-erlang TinyMT pseudo random number generator for Erlang. +triq https://github.com/krestenkrab/triq https://github.com/krestenkrab/triq Trifork QuickCheck +tsung https://github.com/processone/tsung https://github.com/processone/tsung Tsung is a high-performance benchmark framework for various protocols including HTTP, XMPP, LDAP, etc. +twitter_erlang https://github.com/ngerakines/erlang_twitter https://github.com/ngerakines/erlang_twitter An Erlang twitter client unicorn https://github.com/shizzard/unicorn https://github.com/shizzard/unicorn Generic configuration server +uuid https://github.com/okeuday/uuid https://github.com/okeuday/uuid Erlang UUID Implementation +ux https://github.com/erlang-unicode/ux https://github.com/erlang-unicode/ux Unicode eXtention for Erlang (Strings, Collation) +webmachine https://github.com/basho/webmachine https://github.com/basho/webmachine A REST-based system for building web applications. +worker_pool https://github.com/inaka/worker_pool https://github.com/inaka/worker_pool a simple erlang worker pool +xref_runner https://github.com/inaka/xref_runner https://github.com/inaka/xref_runner Erlang Xref Runner (inspired in rebar xref) +yamler https://github.com/goertzenator/yamler https://github.com/goertzenator/yamler libyaml-based yaml loader for Erlang +yaws https://github.com/klacke/yaws http://yaws.hyber.org Yaws webserver zeta https://github.com/s1n4/zeta https://github.com/s1n4/zeta HTTP access log parser in Erlang diff --git a/packages.v1.txt b/packages.v1.txt index 6916e1e..3aa106c 100644 --- a/packages.v1.txt +++ b/packages.v1.txt @@ -1,60 +1,141 @@ -apns4erl https://github.com/inaka/apns4erl.git http://inaka.github.com/apns4erl Apple Push Notification Server for Erlang +apns https://github.com/inaka/apns4erl http://inaka.github.com/apns4erl Apple Push Notification Server for Erlang +azdht https://github.com/arcusfelis/azdht https://github.com/arcusfelis/azdht Azureus Distributed Hash Table (DHT) in Erlang +binpp https://github.com/jtendo/binpp https://github.com/jtendo/binpp Erlang Binary Pretty Printer +bitcask https://github.com/basho/bitcask https://github.com/basho/bitcask because you need another a key/value storage engine bullet https://github.com/extend/bullet http://ninenines.eu Simple, reliable, efficient streaming for Cowboy. cake https://github.com/darach/cake-erl https://github.com/darach/cake-erl Really simple terminal colorization -classifier https://github.com/inaka/classifier.git https://github.com/inaka/classifier An Erlang Bayesian Filter and Text Classifier +classifier https://github.com/inaka/classifier https://github.com/inaka/classifier An Erlang Bayesian Filter and Text Classifier +couchbeam https://github.com/benoitc/couchbeam https://github.com/benoitc/couchbeam Apache CouchDB client in Erlang cowboy https://github.com/ninenines/cowboy http://ninenines.eu Small, fast and modular HTTP server. cowlib https://github.com/ninenines/cowlib http://ninenines.eu Support library for manipulating Web protocols. -czmq https://github.com/gar1t/erlang-czmq.git https://github.com/gar1t/erlang-czmq External port bindings for CZMQ. -debbie https://github.com/crownedgrouse/debbie.git https://github.com/crownedgrouse/debbie .DEB Built In Erlang -e2 https://github.com/gar1t/e2.git http://e2project.org Library to simply writing correct OTP applications. -ebitly https://github.com/inaka/ebitly.git http://inaka.github.com/ebitly Bit.ly API wrapper for Erlang -edgar https://github.com/crownedgrouse/edgar.git https://github.com/crownedgrouse/edgar Erlang Does GNU AR -edis https://github.com/inaka/edis.git http://inaka.github.com/edis/ An Erlang implementation of Redis KV Store -eganglia https://github.com/inaka/eganglia.git https://github.com/inaka/eganglia.git Erlang library to interact with Ganglia +damocles https://github.com/lostcolony/damocles https://github.com/lostcolony/damocles Erlang library for generating adversarial network conditions for QAing distributed applications/systems on a single Linux box. +debbie https://github.com/crownedgrouse/debbie https://github.com/crownedgrouse/debbie .DEB Built In Erlang +dispcount https://github.com/ferd/dispcount https://github.com/ferd/dispcount Erlang task dispatcher based on ETS counters. +e2 https://github.com/gar1t/e2 http://e2project.org Library to simply writing correct OTP applications. +edgar https://github.com/crownedgrouse/edgar https://github.com/crownedgrouse/edgar Erlang Does GNU AR +edis https://github.com/inaka/edis http://inaka.github.com/edis/ An Erlang implementation of Redis KV Store +eep https://github.com/virtan/eep https://github.com/virtan/eep Erlang Easy Profiling (eep) application provides a way to analyze application performance and call hierarchy +efene https://github.com/efene/efene https://github.com/efene/efene Alternative syntax for the Erlang Programming Language focusing on simplicity, ease of use and programmer UX +eganglia https://github.com/inaka/eganglia https://github.com/inaka/eganglia Erlang library to interact with Ganglia ehsa https://bitbucket.org/a12n/ehsa https://bitbucket.org/a12n/ehsa Erlang HTTP server basic and digest authentication modules -elvis https://github.com/inaka/elvis.git https://github.com/inaka/elvis.git Erlang Style Reviewer -emysql https://github.com/Eonblast/Emysql.git https://github.com/Eonblast/Emysql Stable, pure Erlang MySQL driver. +ej https://github.com/seth/ej https://github.com/seth/ej Helper module for working with Erlang terms representing JSON +eleveldb https://github.com/basho/eleveldb https://github.com/basho/eleveldb Erlang LevelDB API +elli https://github.com/knutin/elli https://github.com/knutin/elli Simple, robust and performant Erlang web server +elvis https://github.com/inaka/elvis https://github.com/inaka/elvis Erlang Style Reviewer +emysql https://github.com/Eonblast/Emysql https://github.com/Eonblast/Emysql Stable, pure Erlang MySQL driver. +entop https://github.com/mazenharake/entop https://github.com/mazenharake/entop A top-like tool for monitoring an Erlang node eper https://github.com/massemanet/eper https://github.com/massemanet/eper Erlang performance and debugging tools. epgsql https://github.com/epgsql/epgsql https://github.com/epgsql/epgsql Erlang PostgreSQL client library. -eredis https://github.com/wooga/eredis https://github.com/wooga/eredis Non-blocking Redis client with focus on performance and robustness -erldb https://github.com/erldb/erldb.git http://erldb.org ORM (Object-relational mapping) application implemented in Erlang +epocxy https://github.com/duomark/epocxy https://github.com/duomark/epocxy Erlang Patterns of Concurrency +eredis https://github.com/wooga/eredis https://github.com/wooga/eredis Erlang Redis client +erlang_js https://github.com/basho/erlang_js https://github.com/basho/erlang_js A linked-in driver for Erlang to Mozilla's Spidermonkey Javascript runtime. +erlasticsearch https://github.com/dieswaytoofast/erlasticsearch https://github.com/dieswaytoofast/erlasticsearch Erlang thrift interface to elastic_search +erlcloud https://github.com/gleber/erlcloud https://github.com/gleber/erlcloud Cloud Computing library for erlang (Amazon EC2, S3, SQS, SimpleDB, Mechanical Turk, ELB) +erlcron https://github.com/erlware/erlcron https://github.com/erlware/erlcron Erlang cronish system +erldb https://github.com/erldb/erldb http://erldb.org ORM (Object-relational mapping) application implemented in Erlang +erldns https://github.com/aetrion/erl-dns https://github.com/aetrion/erl-dns DNS server, in erlang. +erlog https://github.com/rvirding/erlog https://github.com/rvirding/erlog Prolog interpreter in and for Erlang +erlport https://github.com/hdima/erlport https://github.com/hdima/erlport ErlPort - connect Erlang to other languages +erlsom https://github.com/willemdj/erlsom https://github.com/willemdj/erlsom XML parser for Erlang +erlubi https://github.com/krestenkrab/erlubi https://github.com/krestenkrab/erlubi Ubigraph Erlang Client (and Process Visualizer) +erlware_commons https://github.com/erlware/erlware_commons https://github.com/erlware/erlware_commons Erlware Commons is an Erlware project focused on all aspects of reusable Erlang components. erlydtl https://github.com/erlydtl/erlydtl https://github.com/erlydtl/erlydtl Django Template Language for Erlang. erwa https://github.com/bwegh/erwa https://github.com/bwegh/erwa A WAMP router and client written in Erlang. +exmpp https://github.com/processone/exmpp https://github.com/processone/exmpp Erlang XMPP library +exometer https://github.com/Feuerlabs/exometer https://github.com/Feuerlabs/exometer Basic measurement objects and probe behavior exs1024 https://github.com/jj1bdx/exs1024 https://github.com/jj1bdx/exs1024 Xorshift1024star pseudo random number generator for Erlang. exs64 https://github.com/jj1bdx/exs64 https://github.com/jj1bdx/exs64 Xorshift64star pseudo random number generator for Erlang. -exsplus https://github.com/jj1bdx/exsplus https://github.com/jj1bdx/exsplus Xorshift128plus pseudo random number generator for Erlang. +exsplus116 https://github.com/jj1bdx/exsplus116 https://github.com/jj1bdx/exsplus116 Xorshift116plus for Erlang +exsplus128 https://github.com/jj1bdx/exsplus128 https://github.com/jj1bdx/exsplus128 Xorshift128plus pseudo random number generator for Erlang. +fast_disk_log https://github.com/lpgauth/fast_disk_log https://github.com/lpgauth/fast_disk_log Pool-based asynchronous Erlang disk logger feeder https://github.com/michaelnisi/feeder https://github.com/michaelnisi/feeder Stream parse RSS and Atom formatted XML feeds. -getopt https://github.com/jcomellas/getopt.git https://github.com/jcomellas/getopt Module to parse command line arguments using the GNU getopt syntax -gproc https://github.com/uwiger/gproc.git https://github.com/uwiger/gproc Extended process registry for Erlang -gun https://github.com/extend/gun http//ninenines.eu Asynchronous SPDY, HTTP and Websocket client written in Erlang. +folsom https://github.com/boundary/folsom https://github.com/boundary/folsom Expose Erlang Events and Metrics +fuse https://github.com/jlouis/fuse https://github.com/jlouis/fuse A Circuit Breaker for Erlang +geas https://github.com/crownedgrouse/geas https://github.com/crownedgrouse/geas Guess Erlang Application Scattering +gen_nb_server https://github.com/kevsmith/gen_nb_server https://github.com/kevsmith/gen_nb_server OTP behavior for writing non-blocking servers +gen_smtp https://github.com/Vagabond/gen_smtp https://github.com/Vagabond/gen_smtp A generic Erlang SMTP server and client that can be extended via callback modules +getopt https://github.com/jcomellas/getopt https://github.com/jcomellas/getopt Module to parse command line arguments using the GNU getopt syntax +gproc https://github.com/uwiger/gproc https://github.com/uwiger/gproc Extended process registry for Erlang +gun https://github.com/ninenines/gun http//ninenines.eu Asynchronous SPDY, HTTP and Websocket client written in Erlang. +hackney https://github.com/benoitc/hackney https://github.com/benoitc/hackney simple HTTP client in Erlang hanoidb https://github.com/krestenkrab/hanoidb https://github.com/krestenkrab/hanoidb Erlang LSM BTree Storage ibrowse https://github.com/cmullaparthi/ibrowse https://github.com/cmullaparthi/ibrowse Erlang HTTP client -itweet https://github.com/inaka/itweet.git http://inaka.github.com/itweet/ Twitter Stream API on ibrowse +ierlang https://github.com/robbielynch/ierlang https://github.com/robbielynch/ierlang An Erlang language kernel for IPython. +itweet https://github.com/inaka/itweet http://inaka.github.com/itweet/ Twitter Stream API on ibrowse +jesse https://github.com/klarna/jesse https://github.com/klarna/jesse jesse (JSon Schema Erlang) is an implementation of a json schema validator for Erlang. jiffy https://github.com/davisp/jiffy https://github.com/davisp/jiffy JSON NIFs for Erlang. jiffy_v https://github.com/shizzard/jiffy-v https://github.com/shizzard/jiffy-v JSON validation utility +jobs https://github.com/esl/jobs https://github.com/esl/jobs a Job scheduler for load regulation +joxa https://github.com/joxa/joxa https://github.com/joxa/joxa A Modern Lisp for the Erlang VM +json https://github.com/talentdeficit/json https://github.com/talentdeficit/json a high level json library for erlang (17.0+) jsx https://github.com/talentdeficit/jsx https://github.com/talentdeficit/jsx An Erlang application for consuming, producing and manipulating JSON. katja https://github.com/nifoc/katja https://github.com/nifoc/katja A simple Riemann client written in Erlang. +kjell https://github.com/karlll/kjell https://github.com/karlll/kjell Erlang Shell +kraken https://github.com/Asana/kraken https://github.com/Asana/kraken Distributed Pubsub Server for Realtime Apps lager https://github.com/basho/lager https://github.com/basho/lager A logging framework for Erlang/OTP. -lasse https://github.com/inaka/lasse.git https://github.com/inaka/lasse.git SSE handler for Cowboy -leptus https://github.com/s1n4/leptus https://github.com/s1n4/leptus Erlang REST framework +lasse https://github.com/inaka/lasse https://github.com/inaka/lasse SSE handler for Cowboy +lfe https://github.com/rvirding/lfe https://github.com/rvirding/lfe Lisp Flavoured Erlang (LFE) +ling https://github.com/cloudozer/ling https://github.com/cloudozer/ling Erlang on Xen live https://github.com/ninenines/live http://ninenines.eu Automated module and configuration reloader. -mekao https://github.com/ddosia/mekao.git https://github.com/ddosia/mekao SQL constructor -modlib https://github.com/gar1t/modlib.git https://github.com/gar1t/modlib Web framework based on Erlang's inets httpd +locks https://github.com/uwiger/locks https://github.com/uwiger/locks A scalable, deadlock-resolving resource locker +log4erl https://github.com/ahmednawras/log4erl https://github.com/ahmednawras/log4erl A logger for erlang in the spirit of Log4J. +luerl https://github.com/rvirding/luerl https://github.com/rvirding/luerl Lua in Erlang +mad https://github.com/synrc/mad https://github.com/synrc/mad Small and Fast Rebar Replacement +meck https://github.com/eproxus/meck https://github.com/eproxus/meck A mocking library for Erlang +mekao https://github.com/ddosia/mekao https://github.com/ddosia/mekao SQL constructor +mochiweb https://github.com/mochi/mochiweb https://github.com/mochi/mochiweb MochiWeb is an Erlang library for building lightweight HTTP servers. +modlib https://github.com/gar1t/modlib https://github.com/gar1t/modlib Web framework based on Erlang's inets httpd +mongodb https://github.com/comtihon/mongodb-erlang https://github.com/comtihon/mongodb-erlang MongoDB driver for Erlang +msgpack https://github.com/msgpack/msgpack-erlang https://github.com/msgpack/msgpack-erlang MessagePack (de)serializer implementation for Erlang +mustache https://github.com/mojombo/mustache.erl https://github.com/mojombo/mustache.erl Mustache template engine for Erlang. +mysql https://github.com/dizzyd/erlang-mysql-driver https://github.com/dizzyd/erlang-mysql-driver Erlang MySQL Driver (from code.google.com) +n2o https://github.com/5HT/n2o https://github.com/5HT/n2o WebSocket Application Server +nat_upnp https://github.com/benoitc/nat_upnp https://github.com/benoitc/nat_upnp Erlang library to map your internal port to an external using UNP IGD neo4j https://github.com/dmitriid/neo4j-erlang https://github.com/dmitriid/neo4j-erlang Erlang client library for Neo4J. +neotoma https://github.com/seancribbs/neotoma https://github.com/seancribbs/neotoma Erlang library and packrat parser-generator for parsing expression grammars. +nodefinder https://github.com/erlanger/nodefinder https://github.com/erlanger/nodefinder automatic node discovery via UDP multicast +oauth2 https://github.com/kivra/oauth2 https://github.com/kivra/oauth2 Erlang Oauth2 implementation +oauth https://github.com/tim/erlang-oauth https://github.com/tim/erlang-oauth An Erlang OAuth 1.0 implementation +openpoker https://github.com/hpyhacking/openpoker https://github.com/hpyhacking/openpoker Genesis Texas hold'em Game Server pegjs https://github.com/dmitriid/pegjs https://github.com/dmitriid/pegjs An implementation of PEG.js grammar for Erlang. +pobox https://github.com/ferd/pobox https://github.com/ferd/pobox External buffer processes to protect against mailbox overflow in Erlang +poolboy https://github.com/devinus/poolboy https://github.com/devinus/poolboy A hunky Erlang worker pool factory +pooler https://github.com/seth/pooler https://github.com/seth/pooler An OTP Process Pool Application +procket https://github.com/msantos/procket http://blog.listincomprehension.com/search/label/procket Erlang interface to low level socket operations proper https://github.com/manopapad/proper http://proper.softlab.ntua.gr PropEr: a QuickCheck-inspired property-based testing tool for Erlang. -psycho https://github.com/gar1t/psycho.git https://github.com/gar1t/psycho HTTP server that provides a WSGI-like interface for applications and middleware. -ptrackerl https://github.com/inaka/ptrackerl.git https://github.com/inaka/ptrackerl.git Pivotal Tracker API Client written in Erlang -pusherman https://github.com/inaka/pusherman.git https://github.com/inaka/pusherman.git queuing system for push notifications +protobuffs https://github.com/basho/erlang_protobuffs https://github.com/basho/erlang_protobuffs An implementation of Google's Protocol Buffers for Erlang, based on ngerakines/erlang_protobuffs. +ptrackerl https://github.com/inaka/ptrackerl https://github.com/inaka/ptrackerl Pivotal Tracker API Client written in Erlang +push_service https://github.com/hairyhum/push_service https://github.com/hairyhum/push_service Push service +qdate https://github.com/choptastic/qdate https://github.com/choptastic/qdate Date, time, and timezone parsing, formatting, and conversion for Erlang. +rack https://github.com/erlyvideo/rack https://github.com/erlyvideo/rack Rack handler for erlang ranch https://github.com/ninenines/ranch http://ninenines.eu Socket acceptor pool for TCP protocols. +rec2json https://github.com/lordnull/rec2json https://github.com/lordnull/rec2json Compile erlang record definitions into modules to convert them to/from json easily. +recon https://github.com/ferd/recon https://github.com/ferd/recon Collection of functions and scripts to debug Erlang in production. +record_info https://github.com/bipthelin/erlang-record_info https://github.com/bipthelin/erlang-record_info Convert between record and proplist +relx https://github.com/erlware/relx https://github.com/erlware/relx Sane, simple release creation for Erlang resource_discovery https://github.com/erlware/resource_discovery http://erlware.org/ An application used to dynamically discover resources present in an Erlang node cluster. -sfmt-erlang https://github.com/jj1bdx/sfmt-erlang https://github.com/jj1bdx/sfmt-erlang SFMT pseudo random number generator for Erlang. +riak_dt https://github.com/basho/riak_dt https://github.com/basho/riak_dt Convergent replicated datatypes in Erlang +rlimit https://github.com/jlouis/rlimit https://github.com/jlouis/rlimit Magnus Klaar's rate limiter code from etorrent +safetyvalve https://github.com/jlouis/safetyvalve https://github.com/jlouis/safetyvalve A safety valve for your erlang node +sfmt https://github.com/jj1bdx/sfmt-erlang https://github.com/jj1bdx/sfmt-erlang SFMT pseudo random number generator for Erlang. sheriff https://github.com/extend/sheriff http://ninenines.eu Parse transform for type based validation. -shotgun https://github.com/inaka/shotgun.git https://github.com/inaka/shotgun.git better than just a gun -sumo_db https://github.com/inaka/sumo_db.git https://github.com/inaka/sumo_db.git Erlang Persistency Framework -swab https://github.com/crownedgrouse/swab.git https://github.com/crownedgrouse/swab General purpose buffer handling module -sync https://github.com/rustyio/sync.git https://github.com/rustyio/sync On-the-fly recompiling and reloading in Erlang. +shotgun https://github.com/inaka/shotgun https://github.com/inaka/shotgun better than just a gun +sqerl https://github.com/hairyhum/sqerl https://github.com/hairyhum/sqerl An Erlang-flavoured SQL DSL +statebox https://github.com/mochi/statebox https://github.com/mochi/statebox Erlang state monad with merge/conflict-resolution capabilities. Useful for Riak. +swab https://github.com/crownedgrouse/swab https://github.com/crownedgrouse/swab General purpose buffer handling module +switchboard https://github.com/thusfresh/switchboard https://github.com/thusfresh/switchboard A framework for processing email using worker plugins. +sync https://github.com/rustyio/sync https://github.com/rustyio/sync On-the-fly recompiling and reloading in Erlang. tddreloader https://github.com/version2beta/tddreloader https://github.com/version2beta/tddreloader Shell utility for recompiling, reloading, and testing code as it changes -tinymt-erlang https://github.com/jj1bdx/tinymt-erlang https://github.com/jj1bdx/tinymt-erlang TinyMT pseudo random number generator for Erlang. +tinymt https://github.com/jj1bdx/tinymt-erlang https://github.com/jj1bdx/tinymt-erlang TinyMT pseudo random number generator for Erlang. +triq https://github.com/krestenkrab/triq https://github.com/krestenkrab/triq Trifork QuickCheck +tsung https://github.com/processone/tsung https://github.com/processone/tsung Tsung is a high-performance benchmark framework for various protocols including HTTP, XMPP, LDAP, etc. +twitter_erlang https://github.com/ngerakines/erlang_twitter https://github.com/ngerakines/erlang_twitter An Erlang twitter client unicorn https://github.com/shizzard/unicorn https://github.com/shizzard/unicorn Generic configuration server +uuid https://github.com/okeuday/uuid https://github.com/okeuday/uuid Erlang UUID Implementation +ux https://github.com/erlang-unicode/ux https://github.com/erlang-unicode/ux Unicode eXtention for Erlang (Strings, Collation) +webmachine https://github.com/basho/webmachine https://github.com/basho/webmachine A REST-based system for building web applications. +worker_pool https://github.com/inaka/worker_pool https://github.com/inaka/worker_pool a simple erlang worker pool +xref_runner https://github.com/inaka/xref_runner https://github.com/inaka/xref_runner Erlang Xref Runner (inspired in rebar xref) +yamler https://github.com/goertzenator/yamler https://github.com/goertzenator/yamler libyaml-based yaml loader for Erlang +yaws https://github.com/klacke/yaws http://yaws.hyber.org Yaws webserver zeta https://github.com/s1n4/zeta https://github.com/s1n4/zeta HTTP access log parser in Erlang diff --git a/packages.v2.tsv b/packages.v2.tsv index 9cbb697..a05ead5 100644 --- a/packages.v2.tsv +++ b/packages.v2.tsv @@ -1,60 +1,141 @@ -apns4erl git https://github.com/inaka/apns4erl.git 1.0 http://inaka.github.com/apns4erl Apple Push Notification Server for Erlang +apns git https://github.com/inaka/apns4erl 1.0.4 http://inaka.github.com/apns4erl Apple Push Notification Server for Erlang +azdht git https://github.com/arcusfelis/azdht master https://github.com/arcusfelis/azdht Azureus Distributed Hash Table (DHT) in Erlang +binpp git https://github.com/jtendo/binpp master https://github.com/jtendo/binpp Erlang Binary Pretty Printer +bitcask git https://github.com/basho/bitcask master https://github.com/basho/bitcask because you need another a key/value storage engine bullet git https://github.com/extend/bullet master http://ninenines.eu Simple, reliable, efficient streaming for Cowboy. cake git https://github.com/darach/cake-erl v0.1.2 https://github.com/darach/cake-erl Really simple terminal colorization -classifier git https://github.com/inaka/classifier.git 1 https://github.com/inaka/classifier An Erlang Bayesian Filter and Text Classifier +classifier git https://github.com/inaka/classifier master https://github.com/inaka/classifier An Erlang Bayesian Filter and Text Classifier +couchbeam git https://github.com/benoitc/couchbeam master https://github.com/benoitc/couchbeam Apache CouchDB client in Erlang cowboy git https://github.com/ninenines/cowboy 1.0.1 http://ninenines.eu Small, fast and modular HTTP server. cowlib git https://github.com/ninenines/cowlib 1.0.1 http://ninenines.eu Support library for manipulating Web protocols. -czmq git https://github.com/gar1t/erlang-czmq.git master https://github.com/gar1t/erlang-czmq External port bindings for CZMQ. -debbie git https://github.com/crownedgrouse/debbie.git master https://github.com/crownedgrouse/debbie .DEB Built In Erlang -e2 git https://github.com/gar1t/e2.git master http://e2project.org Library to simply writing correct OTP applications. -ebitly git https://github.com/inaka/ebitly.git 0.0.1 http://inaka.github.com/ebitly Bit.ly API wrapper for Erlang -edgar git https://github.com/crownedgrouse/edgar.git master https://github.com/crownedgrouse/edgar Erlang Does GNU AR -edis git https://github.com/inaka/edis.git 0.2.0 http://inaka.github.com/edis/ An Erlang implementation of Redis KV Store -eganglia git https://github.com/inaka/eganglia.git 0.9.1 https://github.com/inaka/eganglia.git Erlang library to interact with Ganglia +damocles git https://github.com/lostcolony/damocles master https://github.com/lostcolony/damocles Erlang library for generating adversarial network conditions for QAing distributed applications/systems on a single Linux box. +debbie git https://github.com/crownedgrouse/debbie master https://github.com/crownedgrouse/debbie .DEB Built In Erlang +dispcount git https://github.com/ferd/dispcount master https://github.com/ferd/dispcount Erlang task dispatcher based on ETS counters. +e2 git https://github.com/gar1t/e2 master http://e2project.org Library to simply writing correct OTP applications. +edgar git https://github.com/crownedgrouse/edgar master https://github.com/crownedgrouse/edgar Erlang Does GNU AR +edis git https://github.com/inaka/edis master http://inaka.github.com/edis/ An Erlang implementation of Redis KV Store +eep git https://github.com/virtan/eep master https://github.com/virtan/eep Erlang Easy Profiling (eep) application provides a way to analyze application performance and call hierarchy +efene git https://github.com/efene/efene master https://github.com/efene/efene Alternative syntax for the Erlang Programming Language focusing on simplicity, ease of use and programmer UX +eganglia git https://github.com/inaka/eganglia v0.9.1 https://github.com/inaka/eganglia Erlang library to interact with Ganglia ehsa hg https://bitbucket.org/a12n/ehsa 2.0.4 https://bitbucket.org/a12n/ehsa Erlang HTTP server basic and digest authentication modules -elvis git https://github.com/inaka/elvis.git 0.1.0-alpha https://github.com/inaka/elvis.git Erlang Style Reviewer -emysql git https://github.com/Eonblast/Emysql.git master https://github.com/Eonblast/Emysql Stable, pure Erlang MySQL driver. +ej git https://github.com/seth/ej master https://github.com/seth/ej Helper module for working with Erlang terms representing JSON +eleveldb git https://github.com/basho/eleveldb master https://github.com/basho/eleveldb Erlang LevelDB API +elli git https://github.com/knutin/elli master https://github.com/knutin/elli Simple, robust and performant Erlang web server +elvis git https://github.com/inaka/elvis 0.2.4 https://github.com/inaka/elvis Erlang Style Reviewer +emysql git https://github.com/Eonblast/Emysql master https://github.com/Eonblast/Emysql Stable, pure Erlang MySQL driver. +entop git https://github.com/mazenharake/entop master https://github.com/mazenharake/entop A top-like tool for monitoring an Erlang node eper git https://github.com/massemanet/eper master https://github.com/massemanet/eper Erlang performance and debugging tools. epgsql git https://github.com/epgsql/epgsql master https://github.com/epgsql/epgsql Erlang PostgreSQL client library. -eredis git https://github.com/wooga/eredis master https://github.com/wooga/eredis Non-blocking Redis client with focus on performance and robustness -erldb git https://github.com/erldb/erldb.git master http://erldb.org ORM (Object-relational mapping) application implemented in Erlang +epocxy git https://github.com/duomark/epocxy master https://github.com/duomark/epocxy Erlang Patterns of Concurrency +eredis git https://github.com/wooga/eredis master https://github.com/wooga/eredis Erlang Redis client +erlang_js git https://github.com/basho/erlang_js master https://github.com/basho/erlang_js A linked-in driver for Erlang to Mozilla's Spidermonkey Javascript runtime. +erlasticsearch git https://github.com/dieswaytoofast/erlasticsearch master https://github.com/dieswaytoofast/erlasticsearch Erlang thrift interface to elastic_search +erlcloud git https://github.com/gleber/erlcloud master https://github.com/gleber/erlcloud Cloud Computing library for erlang (Amazon EC2, S3, SQS, SimpleDB, Mechanical Turk, ELB) +erlcron git https://github.com/erlware/erlcron master https://github.com/erlware/erlcron Erlang cronish system +erldb git https://github.com/erldb/erldb master http://erldb.org ORM (Object-relational mapping) application implemented in Erlang +erldns git https://github.com/aetrion/erl-dns master https://github.com/aetrion/erl-dns DNS server, in erlang. +erlog git https://github.com/rvirding/erlog master https://github.com/rvirding/erlog Prolog interpreter in and for Erlang +erlport git https://github.com/hdima/erlport master https://github.com/hdima/erlport ErlPort - connect Erlang to other languages +erlsom git https://github.com/willemdj/erlsom master https://github.com/willemdj/erlsom XML parser for Erlang +erlubi git https://github.com/krestenkrab/erlubi master https://github.com/krestenkrab/erlubi Ubigraph Erlang Client (and Process Visualizer) +erlware_commons git https://github.com/erlware/erlware_commons master https://github.com/erlware/erlware_commons Erlware Commons is an Erlware project focused on all aspects of reusable Erlang components. erlydtl git https://github.com/erlydtl/erlydtl master https://github.com/erlydtl/erlydtl Django Template Language for Erlang. -erwa git https://github.com/bwegh/erwa master https://github.com/bwegh/erwa A WAMP router and client written in Erlang. +erwa git https://github.com/bwegh/erwa 0.1.1 https://github.com/bwegh/erwa A WAMP router and client written in Erlang. +exmpp git https://github.com/processone/exmpp master https://github.com/processone/exmpp Erlang XMPP library +exometer git https://github.com/Feuerlabs/exometer 1.2 https://github.com/Feuerlabs/exometer Basic measurement objects and probe behavior exs1024 git https://github.com/jj1bdx/exs1024 master https://github.com/jj1bdx/exs1024 Xorshift1024star pseudo random number generator for Erlang. exs64 git https://github.com/jj1bdx/exs64 master https://github.com/jj1bdx/exs64 Xorshift64star pseudo random number generator for Erlang. -exsplus git https://github.com/jj1bdx/exsplus master https://github.com/jj1bdx/exsplus Xorshift128plus pseudo random number generator for Erlang. -feeder git https://github.com/michaelnisi/feeder 1.4.2 https://github.com/michaelnisi/feeder Stream parse RSS and Atom formatted XML feeds. -getopt git https://github.com/jcomellas/getopt.git master https://github.com/jcomellas/getopt Module to parse command line arguments using the GNU getopt syntax -gproc git https://github.com/uwiger/gproc.git master https://github.com/uwiger/gproc Extended process registry for Erlang -gun git https://github.com/extend/gun master http//ninenines.eu Asynchronous SPDY, HTTP and Websocket client written in Erlang. +exsplus116 git https://github.com/jj1bdx/exsplus116 master https://github.com/jj1bdx/exsplus116 Xorshift116plus for Erlang +exsplus128 git https://github.com/jj1bdx/exsplus128 master https://github.com/jj1bdx/exsplus128 Xorshift128plus pseudo random number generator for Erlang. +fast_disk_log git https://github.com/lpgauth/fast_disk_log master https://github.com/lpgauth/fast_disk_log Pool-based asynchronous Erlang disk logger +feeder git https://github.com/michaelnisi/feeder v1.4.6 https://github.com/michaelnisi/feeder Stream parse RSS and Atom formatted XML feeds. +folsom git https://github.com/boundary/folsom master https://github.com/boundary/folsom Expose Erlang Events and Metrics +fuse git https://github.com/jlouis/fuse master https://github.com/jlouis/fuse A Circuit Breaker for Erlang +geas git https://github.com/crownedgrouse/geas master https://github.com/crownedgrouse/geas Guess Erlang Application Scattering +gen_nb_server git https://github.com/kevsmith/gen_nb_server master https://github.com/kevsmith/gen_nb_server OTP behavior for writing non-blocking servers +gen_smtp git https://github.com/Vagabond/gen_smtp master https://github.com/Vagabond/gen_smtp A generic Erlang SMTP server and client that can be extended via callback modules +getopt git https://github.com/jcomellas/getopt master https://github.com/jcomellas/getopt Module to parse command line arguments using the GNU getopt syntax +gproc git https://github.com/uwiger/gproc master https://github.com/uwiger/gproc Extended process registry for Erlang +gun git https://github.com/ninenines/gun master http//ninenines.eu Asynchronous SPDY, HTTP and Websocket client written in Erlang. +hackney git https://github.com/benoitc/hackney master https://github.com/benoitc/hackney simple HTTP client in Erlang hanoidb git https://github.com/krestenkrab/hanoidb master https://github.com/krestenkrab/hanoidb Erlang LSM BTree Storage ibrowse git https://github.com/cmullaparthi/ibrowse v4.1.1 https://github.com/cmullaparthi/ibrowse Erlang HTTP client -itweet git https://github.com/inaka/itweet.git 3.0 http://inaka.github.com/itweet/ Twitter Stream API on ibrowse +ierlang git https://github.com/robbielynch/ierlang master https://github.com/robbielynch/ierlang An Erlang language kernel for IPython. +itweet git https://github.com/inaka/itweet v2.0 http://inaka.github.com/itweet/ Twitter Stream API on ibrowse +jesse git https://github.com/klarna/jesse master https://github.com/klarna/jesse jesse (JSon Schema Erlang) is an implementation of a json schema validator for Erlang. jiffy git https://github.com/davisp/jiffy master https://github.com/davisp/jiffy JSON NIFs for Erlang. jiffy_v git https://github.com/shizzard/jiffy-v 0.3.3 https://github.com/shizzard/jiffy-v JSON validation utility +jobs git https://github.com/esl/jobs 0.3 https://github.com/esl/jobs a Job scheduler for load regulation +joxa git https://github.com/joxa/joxa master https://github.com/joxa/joxa A Modern Lisp for the Erlang VM +json git https://github.com/talentdeficit/json master https://github.com/talentdeficit/json a high level json library for erlang (17.0+) jsx git https://github.com/talentdeficit/jsx master https://github.com/talentdeficit/jsx An Erlang application for consuming, producing and manipulating JSON. katja git https://github.com/nifoc/katja master https://github.com/nifoc/katja A simple Riemann client written in Erlang. +kjell git https://github.com/karlll/kjell master https://github.com/karlll/kjell Erlang Shell +kraken git https://github.com/Asana/kraken master https://github.com/Asana/kraken Distributed Pubsub Server for Realtime Apps lager git https://github.com/basho/lager master https://github.com/basho/lager A logging framework for Erlang/OTP. -lasse git https://github.com/inaka/lasse.git 0.1.0 https://github.com/inaka/lasse.git SSE handler for Cowboy -leptus git https://github.com/s1n4/leptus https://github.com/s1n4/leptus Erlang REST framework +lasse git https://github.com/inaka/lasse 0.1.0 https://github.com/inaka/lasse SSE handler for Cowboy +lfe git https://github.com/rvirding/lfe master https://github.com/rvirding/lfe Lisp Flavoured Erlang (LFE) +ling git https://github.com/cloudozer/ling master https://github.com/cloudozer/ling Erlang on Xen live git https://github.com/ninenines/live master http://ninenines.eu Automated module and configuration reloader. -mekao git https://github.com/ddosia/mekao.git master https://github.com/ddosia/mekao SQL constructor -modlib git https://github.com/gar1t/modlib.git master https://github.com/gar1t/modlib Web framework based on Erlang's inets httpd +locks git https://github.com/uwiger/locks master https://github.com/uwiger/locks A scalable, deadlock-resolving resource locker +log4erl git https://github.com/ahmednawras/log4erl master https://github.com/ahmednawras/log4erl A logger for erlang in the spirit of Log4J. +luerl git https://github.com/rvirding/luerl master https://github.com/rvirding/luerl Lua in Erlang +mad git https://github.com/synrc/mad master https://github.com/synrc/mad Small and Fast Rebar Replacement +meck git https://github.com/eproxus/meck master https://github.com/eproxus/meck A mocking library for Erlang +mekao git https://github.com/ddosia/mekao master https://github.com/ddosia/mekao SQL constructor +mochiweb git https://github.com/mochi/mochiweb master https://github.com/mochi/mochiweb MochiWeb is an Erlang library for building lightweight HTTP servers. +modlib git https://github.com/gar1t/modlib master https://github.com/gar1t/modlib Web framework based on Erlang's inets httpd +mongodb git https://github.com/comtihon/mongodb-erlang master https://github.com/comtihon/mongodb-erlang MongoDB driver for Erlang +msgpack git https://github.com/msgpack/msgpack-erlang master https://github.com/msgpack/msgpack-erlang MessagePack (de)serializer implementation for Erlang +mustache git https://github.com/mojombo/mustache.erl master https://github.com/mojombo/mustache.erl Mustache template engine for Erlang. +mysql git https://github.com/dizzyd/erlang-mysql-driver master https://github.com/dizzyd/erlang-mysql-driver Erlang MySQL Driver (from code.google.com) +n2o git https://github.com/5HT/n2o master https://github.com/5HT/n2o WebSocket Application Server +nat_upnp git https://github.com/benoitc/nat_upnp master https://github.com/benoitc/nat_upnp Erlang library to map your internal port to an external using UNP IGD neo4j git https://github.com/dmitriid/neo4j-erlang master https://github.com/dmitriid/neo4j-erlang Erlang client library for Neo4J. +neotoma git https://github.com/seancribbs/neotoma master https://github.com/seancribbs/neotoma Erlang library and packrat parser-generator for parsing expression grammars. +nodefinder git https://github.com/erlanger/nodefinder 0.2.3 https://github.com/erlanger/nodefinder automatic node discovery via UDP multicast +oauth2 git https://github.com/kivra/oauth2 master https://github.com/kivra/oauth2 Erlang Oauth2 implementation +oauth git https://github.com/tim/erlang-oauth master https://github.com/tim/erlang-oauth An Erlang OAuth 1.0 implementation +openpoker git https://github.com/hpyhacking/openpoker master https://github.com/hpyhacking/openpoker Genesis Texas hold'em Game Server pegjs git https://github.com/dmitriid/pegjs 0.3 https://github.com/dmitriid/pegjs An implementation of PEG.js grammar for Erlang. +pobox git https://github.com/ferd/pobox master https://github.com/ferd/pobox External buffer processes to protect against mailbox overflow in Erlang +poolboy git https://github.com/devinus/poolboy master https://github.com/devinus/poolboy A hunky Erlang worker pool factory +pooler git https://github.com/seth/pooler master https://github.com/seth/pooler An OTP Process Pool Application +procket git https://github.com/msantos/procket master http://blog.listincomprehension.com/search/label/procket Erlang interface to low level socket operations proper git https://github.com/manopapad/proper master http://proper.softlab.ntua.gr PropEr: a QuickCheck-inspired property-based testing tool for Erlang. -psycho git https://github.com/gar1t/psycho.git master https://github.com/gar1t/psycho HTTP server that provides a WSGI-like interface for applications and middleware. -ptrackerl git https://github.com/inaka/ptrackerl.git 0.2 https://github.com/inaka/ptrackerl.git Pivotal Tracker API Client written in Erlang -pusherman git https://github.com/inaka/pusherman.git 1 https://github.com/inaka/pusherman.git queuing system for push notifications +protobuffs git https://github.com/basho/erlang_protobuffs master https://github.com/basho/erlang_protobuffs An implementation of Google's Protocol Buffers for Erlang, based on ngerakines/erlang_protobuffs. +ptrackerl git https://github.com/inaka/ptrackerl master https://github.com/inaka/ptrackerl Pivotal Tracker API Client written in Erlang +push_service git https://github.com/hairyhum/push_service master https://github.com/hairyhum/push_service Push service +qdate git https://github.com/choptastic/qdate 0.4.0 https://github.com/choptastic/qdate Date, time, and timezone parsing, formatting, and conversion for Erlang. +rack git https://github.com/erlyvideo/rack master https://github.com/erlyvideo/rack Rack handler for erlang ranch git https://github.com/ninenines/ranch 1.1.0 http://ninenines.eu Socket acceptor pool for TCP protocols. +rec2json git https://github.com/lordnull/rec2json master https://github.com/lordnull/rec2json Compile erlang record definitions into modules to convert them to/from json easily. +recon git https://github.com/ferd/recon 2.2.1 https://github.com/ferd/recon Collection of functions and scripts to debug Erlang in production. +record_info git https://github.com/bipthelin/erlang-record_info master https://github.com/bipthelin/erlang-record_info Convert between record and proplist +relx git https://github.com/erlware/relx master https://github.com/erlware/relx Sane, simple release creation for Erlang resource_discovery git https://github.com/erlware/resource_discovery master http://erlware.org/ An application used to dynamically discover resources present in an Erlang node cluster. -sfmt-erlang git https://github.com/jj1bdx/sfmt-erlang master https://github.com/jj1bdx/sfmt-erlang SFMT pseudo random number generator for Erlang. +riak_dt git https://github.com/basho/riak_dt master https://github.com/basho/riak_dt Convergent replicated datatypes in Erlang +rlimit git https://github.com/jlouis/rlimit master https://github.com/jlouis/rlimit Magnus Klaar's rate limiter code from etorrent +safetyvalve git https://github.com/jlouis/safetyvalve master https://github.com/jlouis/safetyvalve A safety valve for your erlang node +sfmt git https://github.com/jj1bdx/sfmt-erlang master https://github.com/jj1bdx/sfmt-erlang SFMT pseudo random number generator for Erlang. sheriff git https://github.com/extend/sheriff master http://ninenines.eu Parse transform for type based validation. -shotgun git https://github.com/inaka/shotgun.git 0.1 https://github.com/inaka/shotgun.git better than just a gun -sumo_db git https://github.com/inaka/sumo_db.git 1 https://github.com/inaka/sumo_db.git Erlang Persistency Framework -swab git https://github.com/crownedgrouse/swab.git master https://github.com/crownedgrouse/swab General purpose buffer handling module -sync git https://github.com/rustyio/sync.git master https://github.com/rustyio/sync On-the-fly recompiling and reloading in Erlang. +shotgun git https://github.com/inaka/shotgun 0.1.0 https://github.com/inaka/shotgun better than just a gun +sqerl git https://github.com/hairyhum/sqerl master https://github.com/hairyhum/sqerl An Erlang-flavoured SQL DSL +statebox git https://github.com/mochi/statebox master https://github.com/mochi/statebox Erlang state monad with merge/conflict-resolution capabilities. Useful for Riak. +swab git https://github.com/crownedgrouse/swab master https://github.com/crownedgrouse/swab General purpose buffer handling module +switchboard git https://github.com/thusfresh/switchboard master https://github.com/thusfresh/switchboard A framework for processing email using worker plugins. +sync git https://github.com/rustyio/sync master https://github.com/rustyio/sync On-the-fly recompiling and reloading in Erlang. tddreloader git https://github.com/version2beta/tddreloader master https://github.com/version2beta/tddreloader Shell utility for recompiling, reloading, and testing code as it changes -tinymt-erlang git https://github.com/jj1bdx/tinymt-erlang master https://github.com/jj1bdx/tinymt-erlang TinyMT pseudo random number generator for Erlang. +tinymt git https://github.com/jj1bdx/tinymt-erlang master https://github.com/jj1bdx/tinymt-erlang TinyMT pseudo random number generator for Erlang. +triq git https://github.com/krestenkrab/triq master https://github.com/krestenkrab/triq Trifork QuickCheck +tsung git https://github.com/processone/tsung master https://github.com/processone/tsung Tsung is a high-performance benchmark framework for various protocols including HTTP, XMPP, LDAP, etc. +twitter_erlang git https://github.com/ngerakines/erlang_twitter master https://github.com/ngerakines/erlang_twitter An Erlang twitter client unicorn git https://github.com/shizzard/unicorn 0.3.0 https://github.com/shizzard/unicorn Generic configuration server +uuid git https://github.com/okeuday/uuid v1.4.0 https://github.com/okeuday/uuid Erlang UUID Implementation +ux git https://github.com/erlang-unicode/ux master https://github.com/erlang-unicode/ux Unicode eXtention for Erlang (Strings, Collation) +webmachine git https://github.com/basho/webmachine master https://github.com/basho/webmachine A REST-based system for building web applications. +worker_pool git https://github.com/inaka/worker_pool 1.0.2 https://github.com/inaka/worker_pool a simple erlang worker pool +xref_runner git https://github.com/inaka/xref_runner 0.2.0 https://github.com/inaka/xref_runner Erlang Xref Runner (inspired in rebar xref) +yamler git https://github.com/goertzenator/yamler master https://github.com/goertzenator/yamler libyaml-based yaml loader for Erlang +yaws git https://github.com/klacke/yaws master http://yaws.hyber.org Yaws webserver zeta git https://github.com/s1n4/zeta https://github.com/s1n4/zeta HTTP access log parser in Erlang diff --git a/plugins/asciidoc.mk b/plugins/asciidoc.mk new file mode 100644 index 0000000..baf4d3b --- /dev/null +++ b/plugins/asciidoc.mk @@ -0,0 +1,46 @@ +# Copyright (c) 2015, Loïc Hoguin <[email protected]> +# This file is part of erlang.mk and subject to the terms of the ISC License. + +.PHONY: asciidoc asciidoc-guide asciidoc-manual install-asciidoc distclean-asciidoc + +MAN_INSTALL_PATH ?= /usr/local/share/man +MAN_SECTIONS ?= 3 7 + +docs:: asciidoc + +asciidoc: distclean-asciidoc doc-deps asciidoc-guide asciidoc-manual + +ifeq ($(wildcard doc/src/guide/book.asciidoc),) +asciidoc-guide: +else +asciidoc-guide: + a2x -v -f pdf doc/src/guide/book.asciidoc && mv doc/src/guide/book.pdf doc/guide.pdf + a2x -v -f chunked doc/src/guide/book.asciidoc && mv doc/src/guide/book.chunked/ doc/html/ +endif + +ifeq ($(wildcard doc/src/manual/*.asciidoc),) +asciidoc-manual: +else +asciidoc-manual: + for f in doc/src/manual/*.asciidoc ; do \ + a2x -v -f manpage $$f ; \ + done + for s in $(MAN_SECTIONS); do \ + mkdir -p doc/man$$s/ ; \ + mv doc/src/manual/*.$$s doc/man$$s/ ; \ + gzip doc/man$$s/*.$$s ; \ + done + +install-docs:: install-asciidoc + +install-asciidoc: asciidoc-manual + for s in $(MAN_SECTIONS); do \ + mkdir -p $(MAN_INSTALL_PATH)/man$$s/ ; \ + install -g 0 -o 0 -m 0644 doc/man$$s/*.gz $(MAN_INSTALL_PATH)/man$$s/ ; \ + done +endif + +distclean:: distclean-asciidoc + +distclean-asciidoc: + $(gen_verbose) rm -rf doc/html/ doc/guide.pdf doc/man3/ doc/man7/ diff --git a/plugins/bootstrap.mk b/plugins/bootstrap.mk index 9397253..6637520 100644 --- a/plugins/bootstrap.mk +++ b/plugins/bootstrap.mk @@ -1,4 +1,4 @@ -# Copyright (c) 2014, Loïc Hoguin <[email protected]> +# Copyright (c) 2014-2015, Loïc Hoguin <[email protected]> # This file is part of erlang.mk and subject to the terms of the ISC License. .PHONY: bootstrap bootstrap-lib bootstrap-rel new list-templates @@ -16,235 +16,337 @@ help:: # Bootstrap templates. -bs_appsrc = "{application, $(PROJECT), [" \ - " {description, \"\"}," \ - " {vsn, \"0.1.0\"}," \ - " {id, \"git\"}," \ - " {modules, []}," \ - " {registered, []}," \ - " {applications, [" \ - " kernel," \ - " stdlib" \ - " ]}," \ - " {mod, {$(PROJECT)_app, []}}," \ - " {env, []}" \ - "]}." -bs_appsrc_lib = "{application, $(PROJECT), [" \ - " {description, \"\"}," \ - " {vsn, \"0.1.0\"}," \ - " {id, \"git\"}," \ - " {modules, []}," \ - " {registered, []}," \ - " {applications, [" \ - " kernel," \ - " stdlib" \ - " ]}" \ - "]}." -bs_Makefile = "PROJECT = $(PROJECT)" \ - "include erlang.mk" -bs_app = "-module($(PROJECT)_app)." \ - "-behaviour(application)." \ - "" \ - "-export([start/2])." \ - "-export([stop/1])." \ - "" \ - "start(_Type, _Args) ->" \ - " $(PROJECT)_sup:start_link()." \ - "" \ - "stop(_State) ->" \ - " ok." -bs_relx_config = "{release, {$(PROJECT)_release, \"1\"}, [$(PROJECT)]}." \ - "{extended_start_script, true}." \ - "{sys_config, \"rel/sys.config\"}." \ - "{vm_args, \"rel/vm.args\"}." -bs_sys_config = "[" \ - "]." -bs_vm_args = "-name $(PROJECT)@127.0.0.1" \ - "-setcookie $(PROJECT)" \ - "-heart" +define bs_appsrc +{application, $(PROJECT), [ + {description, ""}, + {vsn, "0.1.0"}, + {id, "git"}, + {modules, []}, + {registered, []}, + {applications, [ + kernel, + stdlib + ]}, + {mod, {$(PROJECT)_app, []}}, + {env, []} +]}. +endef + +define bs_appsrc_lib +{application, $(PROJECT), [ + {description, ""}, + {vsn, "0.1.0"}, + {id, "git"}, + {modules, []}, + {registered, []}, + {applications, [ + kernel, + stdlib + ]} +]}. +endef + +define bs_Makefile +PROJECT = $(PROJECT) +include erlang.mk +endef + +define bs_app +-module($(PROJECT)_app). +-behaviour(application). + +-export([start/2]). +-export([stop/1]). + +start(_Type, _Args) -> + $(PROJECT)_sup:start_link(). + +stop(_State) -> + ok. +endef + +define bs_relx_config +{release, {$(PROJECT)_release, "1"}, [$(PROJECT)]}. +{extended_start_script, true}. +{sys_config, "rel/sys.config"}. +{vm_args, "rel/vm.args"}. +endef + +define bs_sys_config +[ +]. +endef + +define bs_vm_args +-name $(PROJECT)@127.0.0.1 +-setcookie $(PROJECT) +-heart +endef + # Normal templates. -tpl_supervisor = "-module($(n))." \ - "-behaviour(supervisor)." \ - "" \ - "-export([start_link/0])." \ - "-export([init/1])." \ - "" \ - "start_link() ->" \ - " supervisor:start_link({local, ?MODULE}, ?MODULE, [])." \ - "" \ - "init([]) ->" \ - " Procs = []," \ - " {ok, {{one_for_one, 1, 5}, Procs}}." -tpl_gen_server = "-module($(n))." \ - "-behaviour(gen_server)." \ - "" \ - "%% API." \ - "-export([start_link/0])." \ - "" \ - "%% gen_server." \ - "-export([init/1])." \ - "-export([handle_call/3])." \ - "-export([handle_cast/2])." \ - "-export([handle_info/2])." \ - "-export([terminate/2])." \ - "-export([code_change/3])." \ - "" \ - "-record(state, {" \ - "})." \ - "" \ - "%% API." \ - "" \ - "-spec start_link() -> {ok, pid()}." \ - "start_link() ->" \ - " gen_server:start_link(?MODULE, [], [])." \ - "" \ - "%% gen_server." \ - "" \ - "init([]) ->" \ - " {ok, \#state{}}." \ - "" \ - "handle_call(_Request, _From, State) ->" \ - " {reply, ignored, State}." \ - "" \ - "handle_cast(_Msg, State) ->" \ - " {noreply, State}." \ - "" \ - "handle_info(_Info, State) ->" \ - " {noreply, State}." \ - "" \ - "terminate(_Reason, _State) ->" \ - " ok." \ - "" \ - "code_change(_OldVsn, State, _Extra) ->" \ - " {ok, State}." -tpl_cowboy_http = "-module($(n))." \ - "-behaviour(cowboy_http_handler)." \ - "" \ - "-export([init/3])." \ - "-export([handle/2])." \ - "-export([terminate/3])." \ - "" \ - "-record(state, {" \ - "})." \ - "" \ - "init(_, Req, _Opts) ->" \ - " {ok, Req, \#state{}}." \ - "" \ - "handle(Req, State=\#state{}) ->" \ - " {ok, Req2} = cowboy_req:reply(200, Req)," \ - " {ok, Req2, State}." \ - "" \ - "terminate(_Reason, _Req, _State) ->" \ - " ok." -tpl_cowboy_loop = "-module($(n))." \ - "-behaviour(cowboy_loop_handler)." \ - "" \ - "-export([init/3])." \ - "-export([info/3])." \ - "-export([terminate/3])." \ - "" \ - "-record(state, {" \ - "})." \ - "" \ - "init(_, Req, _Opts) ->" \ - " {loop, Req, \#state{}, 5000, hibernate}." \ - "" \ - "info(_Info, Req, State) ->" \ - " {loop, Req, State, hibernate}." \ - "" \ - "terminate(_Reason, _Req, _State) ->" \ - " ok." -tpl_cowboy_rest = "-module($(n))." \ - "" \ - "-export([init/3])." \ - "-export([content_types_provided/2])." \ - "-export([get_html/2])." \ - "" \ - "init(_, _Req, _Opts) ->" \ - " {upgrade, protocol, cowboy_rest}." \ - "" \ - "content_types_provided(Req, State) ->" \ - " {[{{<<\"text\">>, <<\"html\">>, '*'}, get_html}], Req, State}." \ - "" \ - "get_html(Req, State) ->" \ - " {<<\"<html><body>This is REST!</body></html>\">>, Req, State}." -tpl_cowboy_ws = "-module($(n))." \ - "-behaviour(cowboy_websocket_handler)." \ - "" \ - "-export([init/3])." \ - "-export([websocket_init/3])." \ - "-export([websocket_handle/3])." \ - "-export([websocket_info/3])." \ - "-export([websocket_terminate/3])." \ - "" \ - "-record(state, {" \ - "})." \ - "" \ - "init(_, _, _) ->" \ - " {upgrade, protocol, cowboy_websocket}." \ - "" \ - "websocket_init(_, Req, _Opts) ->" \ - " Req2 = cowboy_req:compact(Req)," \ - " {ok, Req2, \#state{}}." \ - "" \ - "websocket_handle({text, Data}, Req, State) ->" \ - " {reply, {text, Data}, Req, State};" \ - "websocket_handle({binary, Data}, Req, State) ->" \ - " {reply, {binary, Data}, Req, State};" \ - "websocket_handle(_Frame, Req, State) ->" \ - " {ok, Req, State}." \ - "" \ - "websocket_info(_Info, Req, State) ->" \ - " {ok, Req, State}." \ - "" \ - "websocket_terminate(_Reason, _Req, _State) ->" \ - " ok." -tpl_ranch_protocol = "-module($(n))." \ - "-behaviour(ranch_protocol)." \ - "" \ - "-export([start_link/4])." \ - "-export([init/4])." \ - "" \ - "-type opts() :: []." \ - "-export_type([opts/0])." \ - "" \ - "-record(state, {" \ - " socket :: inet:socket()," \ - " transport :: module()" \ - "})." \ - "" \ - "start_link(Ref, Socket, Transport, Opts) ->" \ - " Pid = spawn_link(?MODULE, init, [Ref, Socket, Transport, Opts])," \ - " {ok, Pid}." \ - "" \ - "-spec init(ranch:ref(), inet:socket(), module(), opts()) -> ok." \ - "init(Ref, Socket, Transport, _Opts) ->" \ - " ok = ranch:accept_ack(Ref)," \ - " loop(\#state{socket=Socket, transport=Transport})." \ - "" \ - "loop(State) ->" \ - " loop(State)." + +define tpl_supervisor +-module($(n)). +-behaviour(supervisor). + +-export([start_link/0]). +-export([init/1]). + +start_link() -> + supervisor:start_link({local, ?MODULE}, ?MODULE, []). + +init([]) -> + Procs = [], + {ok, {{one_for_one, 1, 5}, Procs}}. +endef + +define tpl_gen_server +-module($(n)). +-behaviour(gen_server). + +%% API. +-export([start_link/0]). + +%% gen_server. +-export([init/1]). +-export([handle_call/3]). +-export([handle_cast/2]). +-export([handle_info/2]). +-export([terminate/2]). +-export([code_change/3]). + +-record(state, { +}). + +%% API. + +-spec start_link() -> {ok, pid()}. +start_link() -> + gen_server:start_link(?MODULE, [], []). + +%% gen_server. + +init([]) -> + {ok, #state{}}. + +handle_call(_Request, _From, State) -> + {reply, ignored, State}. + +handle_cast(_Msg, State) -> + {noreply, State}. + +handle_info(_Info, State) -> + {noreply, State}. + +terminate(_Reason, _State) -> + ok. + +code_change(_OldVsn, State, _Extra) -> + {ok, State}. +endef + +define tpl_cowboy_http +-module($(n)). +-behaviour(cowboy_http_handler). + +-export([init/3]). +-export([handle/2]). +-export([terminate/3]). + +-record(state, { +}). + +init(_, Req, _Opts) -> + {ok, Req, #state{}}. + +handle(Req, State=#state{}) -> + {ok, Req2} = cowboy_req:reply(200, Req), + {ok, Req2, State}. + +terminate(_Reason, _Req, _State) -> + ok. +endef + +define tpl_gen_fsm +-module($(n)). +-behaviour(gen_fsm). + +%% API. +-export([start_link/0]). + +%% gen_fsm. +-export([init/1]). +-export([state_name/2]). +-export([handle_event/3]). +-export([state_name/3]). +-export([handle_sync_event/4]). +-export([handle_info/3]). +-export([terminate/3]). +-export([code_change/4]). + +-record(state, { +}). + +%% API. + +-spec start_link() -> {ok, pid()}. +start_link() -> + gen_fsm:start_link(?MODULE, [], []). + +%% gen_fsm. + +init([]) -> + {ok, state_name, #state{}}. + +state_name(_Event, StateData) -> + {next_state, state_name, StateData}. + +handle_event(_Event, StateName, StateData) -> + {next_state, StateName, StateData}. + +state_name(_Event, _From, StateData) -> + {reply, ignored, state_name, StateData}. + +handle_sync_event(_Event, _From, StateName, StateData) -> + {reply, ignored, StateName, StateData}. + +handle_info(_Info, StateName, StateData) -> + {next_state, StateName, StateData}. + +terminate(_Reason, _StateName, _StateData) -> + ok. + +code_change(_OldVsn, StateName, StateData, _Extra) -> + {ok, StateName, StateData}. +endef + +define tpl_cowboy_loop +-module($(n)). +-behaviour(cowboy_loop_handler). + +-export([init/3]). +-export([info/3]). +-export([terminate/3]). + +-record(state, { +}). + +init(_, Req, _Opts) -> + {loop, Req, #state{}, 5000, hibernate}. + +info(_Info, Req, State) -> + {loop, Req, State, hibernate}. + +terminate(_Reason, _Req, _State) -> + ok. +endef + +define tpl_cowboy_rest +-module($(n)). + +-export([init/3]). +-export([content_types_provided/2]). +-export([get_html/2]). + +init(_, _Req, _Opts) -> + {upgrade, protocol, cowboy_rest}. + +content_types_provided(Req, State) -> + {[{{<<"text">>, <<"html">>, '*'}, get_html}], Req, State}. + +get_html(Req, State) -> + {<<"<html><body>This is REST!</body></html>">>, Req, State}. +endef + +define tpl_cowboy_ws +-module($(n)). +-behaviour(cowboy_websocket_handler). + +-export([init/3]). +-export([websocket_init/3]). +-export([websocket_handle/3]). +-export([websocket_info/3]). +-export([websocket_terminate/3]). + +-record(state, { +}). + +init(_, _, _) -> + {upgrade, protocol, cowboy_websocket}. + +websocket_init(_, Req, _Opts) -> + Req2 = cowboy_req:compact(Req), + {ok, Req2, #state{}}. + +websocket_handle({text, Data}, Req, State) -> + {reply, {text, Data}, Req, State}; +websocket_handle({binary, Data}, Req, State) -> + {reply, {binary, Data}, Req, State}; +websocket_handle(_Frame, Req, State) -> + {ok, Req, State}. + +websocket_info(_Info, Req, State) -> + {ok, Req, State}. + +websocket_terminate(_Reason, _Req, _State) -> + ok. +endef + +define tpl_ranch_protocol +-module($(n)). +-behaviour(ranch_protocol). + +-export([start_link/4]). +-export([init/4]). + +-type opts() :: []. +-export_type([opts/0]). + +-record(state, { + socket :: inet:socket(), + transport :: module() +}). + +start_link(Ref, Socket, Transport, Opts) -> + Pid = spawn_link(?MODULE, init, [Ref, Socket, Transport, Opts]), + {ok, Pid}. + +-spec init(ranch:ref(), inet:socket(), module(), opts()) -> ok. +init(Ref, Socket, Transport, _Opts) -> + ok = ranch:accept_ack(Ref), + loop(#state{socket=Socket, transport=Transport}). + +loop(State) -> + loop(State). +endef # Plugin-specific targets. +define render_template + @echo "$${$(1)}" > $(2) +endef + +$(foreach template,$(filter bs_%,$(.VARIABLES)),$(eval export $(template))) +$(foreach template,$(filter tpl_%,$(.VARIABLES)),$(eval export $(template))) + bootstrap: ifneq ($(wildcard src/),) $(error Error: src/ directory already exists) endif - @printf "%s\n" $(bs_Makefile) > Makefile + $(call render_template,bs_Makefile,Makefile) @mkdir src/ - @printf "%s\n" $(bs_appsrc) > src/$(PROJECT).app.src - @printf "%s\n" $(bs_app) > src/$(PROJECT)_app.erl + $(call render_template,bs_appsrc,src/$(PROJECT).app.src) + $(call render_template,bs_app,src/$(PROJECT)_app.erl) $(eval n := $(PROJECT)_sup) - @printf "%s\n" $(tpl_supervisor) > src/$(PROJECT)_sup.erl + $(call render_template,tpl_supervisor,src/$(PROJECT)_sup.erl) bootstrap-lib: ifneq ($(wildcard src/),) $(error Error: src/ directory already exists) endif - @printf "%s\n" $(bs_Makefile) > Makefile + $(call render_template,bs_Makefile,Makefile) @mkdir src/ - @printf "%s\n" $(bs_appsrc_lib) > src/$(PROJECT).app.src + $(call render_template,bs_appsrc_lib,src/$(PROJECT).app.src) bootstrap-rel: ifneq ($(wildcard relx.config),) @@ -253,25 +355,25 @@ endif ifneq ($(wildcard rel/),) $(error Error: rel/ directory already exists) endif - @printf "%s\n" $(bs_relx_config) > relx.config + $(call render_template,bs_relx_config,relx.config) @mkdir rel/ - @printf "%s\n" $(bs_sys_config) > rel/sys.config - @printf "%s\n" $(bs_vm_args) > rel/vm.args + $(call render_template,bs_sys_config,rel/sys.config) + $(call render_template,bs_vm_args,rel/vm.args) new: ifeq ($(wildcard src/),) $(error Error: src/ directory does not exist) endif ifndef t - $(error Usage: make new t=TEMPLATE n=NAME) + $(error Usage: $(MAKE) new t=TEMPLATE n=NAME) endif ifndef tpl_$(t) $(error Unknown template) endif ifndef n - $(error Usage: make new t=TEMPLATE n=NAME) + $(error Usage: $(MAKE) new t=TEMPLATE n=NAME) endif - @printf "%s\n" $(tpl_$(t)) > src/$(n).erl + $(call render_template,tpl_$(t),src/$(n).erl) list-templates: @echo Available templates: $(sort $(patsubst tpl_%,%,$(filter tpl_%,$(.VARIABLES)))) diff --git a/plugins/c_src.mk b/plugins/c_src.mk index 7c1fd2e..bdec23b 100644 --- a/plugins/c_src.mk +++ b/plugins/c_src.mk @@ -1,8 +1,7 @@ -# Copyright (c) 2014, Loïc Hoguin <[email protected]> +# Copyright (c) 2014-2015, Loïc Hoguin <[email protected]> # This file is part of erlang.mk and subject to the terms of the ISC License. .PHONY: clean-c_src distclean-c_src-env -# todo # Configuration. @@ -49,14 +48,25 @@ link_verbose = $(link_verbose_$(V)) ifeq ($(wildcard $(C_SRC_DIR)),) else ifneq ($(wildcard $(C_SRC_DIR)/Makefile),) -app:: - $(MAKE) -C $(C_SRC_DIR) +app:: app-c_src + +test-build:: app-c_src + +app-c_src: + $(MAKE) -C $(C_SRC_DIR) \ + CFLAGS="$(CFLAGS)" \ + CXXFLAGS="$(CXXFLAGS)" \ + LDLIBS="$(LDLIBS)" \ + LDFLAGS="$(LDFLAGS)" clean:: $(MAKE) -C $(C_SRC_DIR) clean else + +ifeq ($(SOURCES),) SOURCES := $(shell find $(C_SRC_DIR) -type f \( -name "*.c" -o -name "*.C" -o -name "*.cc" -o -name "*.cpp" \)) +endif OBJECTS = $(addsuffix .o, $(basename $(SOURCES))) COMPILE_C = $(c_verbose) $(CC) $(CFLAGS) $(CPPFLAGS) -c @@ -64,6 +74,8 @@ COMPILE_CPP = $(cpp_verbose) $(CXX) $(CXXFLAGS) $(CPPFLAGS) -c app:: $(C_SRC_ENV) $(C_SRC_OUTPUT) +test-build:: $(C_SRC_ENV) $(C_SRC_OUTPUT) + $(C_SRC_OUTPUT): $(OBJECTS) @mkdir -p priv/ $(link_verbose) $(CC) $(OBJECTS) $(LDFLAGS) $(LDLIBS) -o $(C_SRC_OUTPUT) @@ -80,8 +92,16 @@ $(C_SRC_OUTPUT): $(OBJECTS) %.o: %.cpp $(COMPILE_CPP) $(OUTPUT_OPTION) $< +clean:: clean-c_src + +clean-c_src: + $(gen_verbose) rm -f $(C_SRC_OUTPUT) $(OBJECTS) + +endif + +ifneq ($(wildcard $(C_SRC_DIR)),) $(C_SRC_ENV): - @erl -noshell -noinput -eval "file:write_file(\"$(C_SRC_ENV)\", \ + @$(ERL) -eval "file:write_file(\"$(C_SRC_ENV)\", \ io_lib:format( \ \"ERTS_INCLUDE_DIR ?= ~s/erts-~s/include/~n\" \ \"ERL_INTERFACE_INCLUDE_DIR ?= ~s~n\" \ @@ -89,12 +109,7 @@ $(C_SRC_ENV): [code:root_dir(), erlang:system_info(version), \ code:lib_dir(erl_interface, include), \ code:lib_dir(erl_interface, lib)])), \ - erlang:halt()." - -clean:: clean-c_src - -clean-c_src: - $(gen_verbose) rm -f $(C_SRC_OUTPUT) $(OBJECTS) + halt()." distclean:: distclean-c_src-env diff --git a/plugins/ci.mk b/plugins/ci.mk new file mode 100644 index 0000000..4f338b3 --- /dev/null +++ b/plugins/ci.mk @@ -0,0 +1,65 @@ +# Copyright (c) 2015, Loïc Hoguin <[email protected]> +# This file is part of erlang.mk and subject to the terms of the ISC License. + +.PHONY: ci ci-setup distclean-kerl + +KERL ?= $(CURDIR)/kerl +export KERL + +KERL_URL ?= https://raw.githubusercontent.com/yrashk/kerl/master/kerl + +OTP_GIT ?= https://github.com/erlang/otp + +CI_INSTALL_DIR ?= $(HOME)/erlang +CI_OTP ?= + +ifeq ($(strip $(CI_OTP)),) +ci:: +else +ci:: $(KERL) $(addprefix ci-,$(CI_OTP)) + +ci-setup:: + +ci_verbose_0 = @echo " CI " $(1); +ci_verbose = $(ci_verbose_$(V)) + +define ci_target +ci-$(1): $(CI_INSTALL_DIR)/$(1) + -$(ci_verbose) \ + PATH="$(CI_INSTALL_DIR)/$(1)/bin:$(PATH)" \ + CI_OTP_RELEASE="$(1)" \ + CT_OPTS="-label $(1)" \ + $(MAKE) clean ci-setup tests +endef + +$(foreach otp,$(CI_OTP),$(eval $(call ci_target,$(otp)))) + +define ci_otp_target +$(CI_INSTALL_DIR)/$(1): + $(KERL) build git $(OTP_GIT) $(1) $(1) + $(KERL) install $(1) $(CI_INSTALL_DIR)/$(1) +endef + +$(foreach otp,$(CI_OTP),$(eval $(call ci_otp_target,$(otp)))) + +define kerl_fetch + $(call core_http_get,$(KERL),$(KERL_URL)) + chmod +x $(KERL) +endef + +$(KERL): + @$(call kerl_fetch) + +help:: + @printf "%s\n" "" \ + "Continuous Integration targets:" \ + " ci Run '$(MAKE) tests' on all configured Erlang versions." \ + "" \ + "The CI_OTP variable must be defined with the Erlang versions" \ + "that must be tested. For example: CI_OTP = OTP-17.3.4 OTP-17.5.3" + +distclean:: distclean-kerl + +distclean-kerl: + $(gen_verbose) rm -rf $(KERL) +endif diff --git a/plugins/cover.mk b/plugins/cover.mk new file mode 100644 index 0000000..bd94051 --- /dev/null +++ b/plugins/cover.mk @@ -0,0 +1,139 @@ +# Copyright 2015, Viktor Söderqvist <[email protected]> +# This file is part of erlang.mk and subject to the terms of the ISC License. + +COVER_REPORT_DIR = cover + +# utility variables for representing special symbols +empty := +space := $(empty) $(empty) +comma := , + +# Hook in coverage to eunit + +ifdef COVER +ifdef EUNIT_RUN +EUNIT_RUN_BEFORE += -eval \ + 'case cover:compile_beam_directory("ebin") of \ + {error, _} -> halt(1); \ + _ -> ok \ + end.' +EUNIT_RUN_AFTER += -eval 'cover:export("eunit.coverdata").' +endif +endif + +# Hook in coverage to ct + +ifdef COVER +ifdef CT_RUN + +# All modules in 'ebin' +COVER_MODS = $(notdir $(basename $(shell echo ebin/*.beam))) + +test-build:: $(TEST_DIR)/ct.cover.spec + +$(TEST_DIR)/ct.cover.spec: + @echo Cover mods: $(COVER_MODS) + $(gen_verbose) printf "%s\n" \ + '{incl_mods,[$(subst $(space),$(comma),$(COVER_MODS))]}.' \ + '{export,"$(CURDIR)/ct.coverdata"}.' > $@ + +CT_RUN += -cover $(TEST_DIR)/ct.cover.spec +endif +endif + +# Core targets + +ifdef COVER +ifneq ($(COVER_REPORT_DIR),) +tests:: + @$(MAKE) --no-print-directory cover-report +endif +endif + +clean:: coverdata-clean + +ifneq ($(COVER_REPORT_DIR),) +distclean:: cover-report-clean +endif + +help:: + @printf "%s\n" "" \ + "Cover targets:" \ + " cover-report Generate a HTML coverage report from previously collected" \ + " cover data." \ + " all.coverdata Merge {eunit,ct}.coverdata into one coverdata file." \ + "" \ + "If COVER=1 is set, coverage data is generated by the targets eunit and ct. The" \ + "target tests additionally generates a HTML coverage report from the combined" \ + "coverdata files from each of these testing tools. HTML reports can be disabled" \ + "by setting COVER_REPORT_DIR to empty." + +# Plugin specific targets + +COVERDATA = $(filter-out all.coverdata,$(wildcard *.coverdata)) + +.PHONY: coverdata-clean +coverdata-clean: + $(gen_verbose) rm -f *.coverdata ct.cover.spec + +# Merge all coverdata files into one. +all.coverdata: $(COVERDATA) + $(gen_verbose) $(ERL) -eval ' \ + $(foreach f,$(COVERDATA),cover:import("$(f)") == ok orelse halt(1),) \ + cover:export("$@"), halt(0).' + +# These are only defined if COVER_REPORT_DIR is non-empty. Set COVER_REPORT_DIR to +# empty if you want the coverdata files but not the HTML report. +ifneq ($(COVER_REPORT_DIR),) + +.PHONY: cover-report-clean cover-report + +cover-report-clean: + $(gen_verbose) rm -rf $(COVER_REPORT_DIR) + +ifeq ($(COVERDATA),) +cover-report: +else + +# Modules which include eunit.hrl always contain one line without coverage +# because eunit defines test/0 which is never called. We compensate for this. +EUNIT_HRL_MODS = $(subst $(space),$(comma),$(shell \ + grep -e '^\s*-include.*include/eunit\.hrl"' src/*.erl \ + | sed "s/^src\/\(.*\)\.erl:.*/'\1'/" | uniq)) + +define cover_report.erl + $(foreach f,$(COVERDATA),cover:import("$(f)") == ok orelse halt(1),) + Ms = cover:imported_modules(), + [cover:analyse_to_file(M, "$(COVER_REPORT_DIR)/" ++ atom_to_list(M) + ++ ".COVER.html", [html]) || M <- Ms], + Report = [begin {ok, R} = cover:analyse(M, module), R end || M <- Ms], + EunitHrlMods = [$(EUNIT_HRL_MODS)], + Report1 = [{M, {Y, case lists:member(M, EunitHrlMods) of + true -> N - 1; false -> N end}} || {M, {Y, N}} <- Report], + TotalY = lists:sum([Y || {_, {Y, _}} <- Report1]), + TotalN = lists:sum([N || {_, {_, N}} <- Report1]), + TotalPerc = round(100 * TotalY / (TotalY + TotalN)), + {ok, F} = file:open("$(COVER_REPORT_DIR)/index.html", [write]), + io:format(F, "<!DOCTYPE html><html>~n" + "<head><meta charset=\"UTF-8\">~n" + "<title>Coverage report</title></head>~n" + "<body>~n", []), + io:format(F, "<h1>Coverage</h1>~n<p>Total: ~p%</p>~n", [TotalPerc]), + io:format(F, "<table><tr><th>Module</th><th>Coverage</th></tr>~n", []), + [io:format(F, "<tr><td><a href=\"~p.COVER.html\">~p</a></td>" + "<td>~p%</td></tr>~n", + [M, M, round(100 * Y / (Y + N))]) || {M, {Y, N}} <- Report1], + How = "$(subst $(space),$(comma)$(space),$(basename $(COVERDATA)))", + Date = "$(shell date -u "+%Y-%m-%dT%H:%M:%SZ")", + io:format(F, "</table>~n" + "<p>Generated using ~s and erlang.mk on ~s.</p>~n" + "</body></html>", [How, Date]), + halt(). +endef + +cover-report: + $(gen_verbose) mkdir -p $(COVER_REPORT_DIR) + $(gen_verbose) $(call erlang,$(cover_report.erl)) + +endif +endif # ifneq ($(COVER_REPORT_DIR),) diff --git a/plugins/ct.mk b/plugins/ct.mk index 4453b70..eba0e52 100644 --- a/plugins/ct.mk +++ b/plugins/ct.mk @@ -1,77 +1,55 @@ -# Copyright (c) 2013-2014, Loïc Hoguin <[email protected]> +# Copyright (c) 2013-2015, Loïc Hoguin <[email protected]> # This file is part of erlang.mk and subject to the terms of the ISC License. -.PHONY: build-ct-deps build-ct-suites tests-ct clean-ct distclean-ct +.PHONY: ct distclean-ct # Configuration. CT_OPTS ?= -ifneq ($(wildcard test/),) - CT_SUITES ?= $(sort $(subst _SUITE.erl,,$(shell find test -type f -name \*_SUITE.erl -exec basename {} \;))) +ifneq ($(wildcard $(TEST_DIR)),) + CT_SUITES ?= $(sort $(subst _SUITE.erl,,$(shell find $(TEST_DIR) -type f -name \*_SUITE.erl -exec basename {} \;))) else CT_SUITES ?= endif -TEST_ERLC_OPTS ?= +debug_info +warn_export_vars +warn_shadow_vars +warn_obsolete_guard -TEST_ERLC_OPTS += -DTEST=1 -DEXTRA=1 +'{parse_transform, eunit_autoexport}' - # Core targets. -tests:: tests-ct - -clean:: clean-ct +tests:: ct distclean:: distclean-ct help:: @printf "%s\n" "" \ + "Common_test targets:" \ + " ct Run all the common_test suites for this project" \ + "" \ "All your common_test suites have their associated targets." \ "A suite named http_SUITE can be ran using the ct-http target." # Plugin-specific targets. -ALL_TEST_DEPS_DIRS = $(addprefix $(DEPS_DIR)/,$(TEST_DEPS)) - CT_RUN = ct_run \ -no_auto_compile \ - -noshell \ - -pa $(realpath ebin) $(DEPS_DIR)/*/ebin \ - -dir test \ - -logdir logs - -$(foreach dep,$(TEST_DEPS),$(eval $(call dep_target,$(dep)))) - -build-ct-deps: $(ALL_TEST_DEPS_DIRS) - @for dep in $(ALL_TEST_DEPS_DIRS) ; do $(MAKE) -C $$dep; done + -noinput \ + -pa $(CURDIR)/ebin $(DEPS_DIR)/*/ebin $(TEST_DIR) \ + -dir $(TEST_DIR) \ + -logdir $(CURDIR)/logs -build-ct-suites: build-ct-deps - $(gen_verbose) erlc -v $(TEST_ERLC_OPTS) -I include/ -o test/ \ - $(wildcard test/*.erl test/*/*.erl) -pa ebin/ - -tests-ct: ERLC_OPTS = $(TEST_ERLC_OPTS) -tests-ct: clean deps app build-ct-suites - @if [ -d "test" ] ; \ - then \ - mkdir -p logs/ ; \ - $(CT_RUN) -suite $(addsuffix _SUITE,$(CT_SUITES)) $(CT_OPTS) ; \ - fi - $(gen_verbose) rm -f test/*.beam +ifeq ($(CT_SUITES),) +ct: +else +ct: test-build + @mkdir -p $(CURDIR)/logs/ + $(gen_verbose) $(CT_RUN) -suite $(addsuffix _SUITE,$(CT_SUITES)) $(CT_OPTS) +endif define ct_suite_target -ct-$(1): ERLC_OPTS = $(TEST_ERLC_OPTS) -ct-$(1): clean deps app build-ct-suites - @if [ -d "test" ] ; \ - then \ - mkdir -p logs/ ; \ - $(CT_RUN) -suite $(addsuffix _SUITE,$(1)) $(CT_OPTS) ; \ - fi - $(gen_verbose) rm -f test/*.beam +ct-$(1): test-build + @mkdir -p $(CURDIR)/logs/ + $(gen_verbose) $(CT_RUN) -suite $(addsuffix _SUITE,$(1)) $(CT_OPTS) endef $(foreach test,$(CT_SUITES),$(eval $(call ct_suite_target,$(test)))) -clean-ct: - $(gen_verbose) rm -rf test/*.beam - distclean-ct: - $(gen_verbose) rm -rf logs/ + $(gen_verbose) rm -rf $(CURDIR)/logs/ diff --git a/plugins/dialyzer.mk b/plugins/dialyzer.mk index 3482c1b..23d16ee 100644 --- a/plugins/dialyzer.mk +++ b/plugins/dialyzer.mk @@ -1,4 +1,4 @@ -# Copyright (c) 2013-2014, Loïc Hoguin <[email protected]> +# Copyright (c) 2013-2015, Loïc Hoguin <[email protected]> # This file is part of erlang.mk and subject to the terms of the ISC License. .PHONY: plt distclean-plt dialyze @@ -15,6 +15,8 @@ DIALYZER_OPTS ?= -Werror_handling -Wrace_conditions \ # Core targets. +check:: dialyze + distclean:: distclean-plt help:: diff --git a/plugins/edoc.mk b/plugins/edoc.mk index 5249d08..6f0a82d 100644 --- a/plugins/edoc.mk +++ b/plugins/edoc.mk @@ -1,7 +1,7 @@ -# Copyright (c) 2013-2014, Loïc Hoguin <[email protected]> +# Copyright (c) 2013-2015, Loïc Hoguin <[email protected]> # This file is part of erlang.mk and subject to the terms of the ISC License. -.PHONY: distclean-edoc +.PHONY: distclean-edoc edoc # Configuration. @@ -9,13 +9,14 @@ EDOC_OPTS ?= # Core targets. -docs:: distclean-edoc - $(gen_verbose) erl -noshell \ - -eval 'edoc:application($(PROJECT), ".", [$(EDOC_OPTS)]), init:stop().' +docs:: distclean-edoc edoc distclean:: distclean-edoc # Plugin-specific targets. +edoc: doc-deps + $(gen_verbose) $(ERL) -eval 'edoc:application($(PROJECT), ".", [$(EDOC_OPTS)]), halt().' + distclean-edoc: $(gen_verbose) rm -f doc/*.css doc/*.html doc/*.png doc/edoc-info diff --git a/plugins/elvis.mk b/plugins/elvis.mk index f3e75a8..580e2f5 100644 --- a/plugins/elvis.mk +++ b/plugins/elvis.mk @@ -21,20 +21,18 @@ help:: "Elvis targets:" \ " elvis Run Elvis using the local elvis.config or download the default otherwise" -ifneq ($(wildcard $(ELVIS_CONFIG)),) -rel:: distclean-elvis -endif - distclean:: distclean-elvis # Plugin-specific targets. $(ELVIS): - @$(call core_http_get,$(ELVIS_CONFIG),$(ELVIS_CONFIG_URL)) @$(call core_http_get,$(ELVIS),$(ELVIS_URL)) @chmod +x $(ELVIS) -elvis: $(ELVIS) +$(ELVIS_CONFIG): + @$(call core_http_get,$(ELVIS_CONFIG),$(ELVIS_CONFIG_URL)) + +elvis: $(ELVIS) $(ELVIS_CONFIG) @$(ELVIS) rock -c $(ELVIS_CONFIG) $(ELVIS_OPTS) distclean-elvis: diff --git a/plugins/erlydtl.mk b/plugins/erlydtl.mk index e288072..d65231d 100644 --- a/plugins/erlydtl.mk +++ b/plugins/erlydtl.mk @@ -1,6 +1,10 @@ -# Copyright (c) 2013-2014, Loïc Hoguin <[email protected]> +# Copyright (c) 2013-2015, Loïc Hoguin <[email protected]> # This file is part of erlang.mk and subject to the terms of the ISC License. +# Configuration. + +DTL_FULL_PATH ?= 0 + # Verbosity. dtl_verbose_0 = @echo " DTL " $(filter %.dtl,$(?F)); @@ -9,14 +13,16 @@ dtl_verbose = $(dtl_verbose_$(V)) # Core targets. define compile_erlydtl - $(dtl_verbose) erl -noshell -pa ebin/ $(DEPS_DIR)/erlydtl/ebin/ -eval ' \ + $(dtl_verbose) $(ERL) -pa ebin/ $(DEPS_DIR)/erlydtl/ebin/ -eval ' \ Compile = fun(F) -> \ - Module = list_to_atom( \ - string:to_lower(filename:basename(F, ".dtl")) ++ "_dtl"), \ - erlydtl:compile(F, Module, [{out_dir, "ebin/"}]) \ + S = fun (1) -> re:replace(filename:rootname(string:sub_string(F, 11), ".dtl"), "/", "_", [{return, list}, global]); \ + (0) -> filename:basename(F, ".dtl") \ + end, \ + Module = list_to_atom(string:to_lower(S($(DTL_FULL_PATH))) ++ "_dtl"), \ + {ok, _} = erlydtl:compile(F, Module, [{out_dir, "ebin/"}, return_errors, {doc_root, "templates"}]) \ end, \ _ = [Compile(F) || F <- string:tokens("$(1)", " ")], \ - init:stop()' + halt().' endef ifneq ($(wildcard src/),) diff --git a/plugins/escript.mk b/plugins/escript.mk index 5a6a0dd..534db61 100644 --- a/plugins/escript.mk +++ b/plugins/escript.mk @@ -11,7 +11,6 @@ ESCRIPT_COMMENT ?= This is an -*- erlang -*- file ESCRIPT_BEAMS ?= "ebin/*", "deps/*/ebin/*" ESCRIPT_SYS_CONFIG ?= "rel/sys.config" ESCRIPT_EMU_ARGS ?= -pa . \ - -noshell -noinput \ -sasl errlog_type error \ -escript main $(ESCRIPT_NAME) ESCRIPT_SHEBANG ?= /usr/bin/env escript @@ -33,6 +32,7 @@ help:: # Modified MIT License, https://github.com/synrc/mad/blob/master/LICENSE : # Software may only be used for the great good and the true happiness of all # sentient beings. + define ESCRIPT_RAW 'Read = fun(F) -> {ok, B} = file:read_file(filename:absname(F)), B end,'\ 'Files = fun(L) -> A = lists:concat([filelib:wildcard(X)||X<- L ]),'\ @@ -51,12 +51,14 @@ define ESCRIPT_RAW ' ]),'\ ' file:change_mode(Escript, 8#755)'\ 'end,'\ -'Ez("$(ESCRIPT_NAME)").' +'Ez("$(ESCRIPT_NAME)"),'\ +'halt().' endef + ESCRIPT_COMMAND = $(subst ' ',,$(ESCRIPT_RAW)) escript:: distclean-escript deps app - $(gen_verbose) erl -noshell -eval $(ESCRIPT_COMMAND) -s init stop + $(gen_verbose) $(ERL) -eval $(ESCRIPT_COMMAND) distclean-escript: $(gen_verbose) rm -f $(ESCRIPT_NAME) diff --git a/plugins/eunit.mk b/plugins/eunit.mk index 75aab0c..b9f2856 100644 --- a/plugins/eunit.mk +++ b/plugins/eunit.mk @@ -1,29 +1,26 @@ # Copyright (c) 2014, Enrique Fernandez <[email protected]> +# Copyright (c) 2015, Loïc Hoguin <[email protected]> # This file is contributed to erlang.mk and subject to the terms of the ISC License. -.PHONY: help-eunit build-eunit eunit distclean-eunit +.PHONY: eunit # Configuration -EUNIT_ERLC_OPTS ?= +debug_info +warn_export_vars +warn_shadow_vars +warn_obsolete_guard -DTEST=1 -DEXTRA=1 - -EUNIT_DIR ?= -EUNIT_DIRS = $(sort $(EUNIT_DIR) ebin) - -ifeq ($(strip $(EUNIT_DIR)),) -TAGGED_EUNIT_TESTS = {dir,"ebin"} +# All modules in TEST_DIR +ifeq ($(strip $(TEST_DIR)),) +TEST_DIR_MODS = else -# All modules in EUNIT_DIR -EUNIT_DIR_MODS = $(notdir $(basename $(shell find $(EUNIT_DIR) -type f -name *.beam))) +TEST_DIR_MODS = $(notdir $(basename $(shell find $(TEST_DIR) -type f -name *.beam))) +endif + # All modules in 'ebin' EUNIT_EBIN_MODS = $(notdir $(basename $(shell find ebin -type f -name *.beam))) -# Only those modules in EUNIT_DIR with no matching module in 'ebin'. +# Only those modules in TEST_DIR with no matching module in 'ebin'. # This is done to avoid some tests being executed twice. -EUNIT_MODS = $(filter-out $(patsubst %,%_tests,$(EUNIT_EBIN_MODS)),$(EUNIT_DIR_MODS)) -TAGGED_EUNIT_TESTS = {dir,"ebin"} $(foreach mod,$(EUNIT_MODS),$(shell echo $(mod) | sed -e 's/\(.*\)/{module,\1}/g')) -endif +EUNIT_MODS = $(filter-out $(patsubst %,%_tests,$(EUNIT_EBIN_MODS)),$(TEST_DIR_MODS)) +TAGGED_EUNIT_TESTS = $(foreach mod,$(EUNIT_EBIN_MODS) $(EUNIT_MODS),{module,$(mod)}) -EUNIT_OPTS ?= verbose +EUNIT_OPTS ?= # Utility functions @@ -33,39 +30,25 @@ endef # Core targets. -help:: help-eunit - tests:: eunit -clean:: clean-eunit - -# Plugin-specific targets. - -EUNIT_RUN = erl \ - -no_auto_compile \ - -noshell \ - -pa $(realpath $(EUNIT_DIR)) $(DEPS_DIR)/*/ebin \ - -pz $(realpath ebin) \ - -eval 'case eunit:test([$(call str-join,$(TAGGED_EUNIT_TESTS))], [$(EUNIT_OPTS)]) of ok -> erlang:halt(0); error -> erlang:halt(1) end.' - -help-eunit: +help:: @printf "%s\n" "" \ "EUnit targets:" \ " eunit Run all the EUnit tests for this project" -ifeq ($(strip $(EUNIT_DIR)),) -build-eunit: -else ifeq ($(strip $(EUNIT_DIR)),ebin) -build-eunit: -else -build-eunit: - $(gen_verbose) erlc -v $(EUNIT_ERLC_OPTS) -I include/ -o $(EUNIT_DIR) \ - $(wildcard $(EUNIT_DIR)/*.erl $(EUNIT_DIR)/*/*.erl) -pa ebin/ -endif +# Plugin-specific targets. -eunit: ERLC_OPTS = $(EUNIT_ERLC_OPTS) -eunit: clean deps app build-eunit +EUNIT_RUN_BEFORE ?= +EUNIT_RUN_AFTER ?= +EUNIT_RUN = $(ERL) \ + -pa $(TEST_DIR) $(DEPS_DIR)/*/ebin \ + -pz ebin \ + $(EUNIT_RUN_BEFORE) \ + -eval 'case eunit:test([$(call str-join,$(TAGGED_EUNIT_TESTS))],\ + [$(EUNIT_OPTS)]) of ok -> ok; error -> halt(1) end.' \ + $(EUNIT_RUN_AFTER) \ + -eval 'halt(0).' + +eunit: test-build $(gen_verbose) $(EUNIT_RUN) - -clean-eunit: - $(gen_verbose) $(foreach dir,$(EUNIT_DIRS),rm -rf $(dir)/*.beam) diff --git a/plugins/relx.mk b/plugins/relx.mk index ee226d3..e38c9d0 100644 --- a/plugins/relx.mk +++ b/plugins/relx.mk @@ -1,7 +1,7 @@ -# Copyright (c) 2013-2014, Loïc Hoguin <[email protected]> +# Copyright (c) 2013-2015, Loïc Hoguin <[email protected]> # This file is part of erlang.mk and subject to the terms of the ISC License. -.PHONY: relx-rel distclean-relx-rel distclean-relx +.PHONY: relx-rel distclean-relx-rel distclean-relx run # Configuration. @@ -10,7 +10,7 @@ RELX_CONFIG ?= $(CURDIR)/relx.config RELX ?= $(CURDIR)/relx export RELX -RELX_URL ?= https://github.com/erlware/relx/releases/download/v1.0.2/relx +RELX_URL ?= https://github.com/erlware/relx/releases/download/v2.0.0/relx RELX_OPTS ?= RELX_OUTPUT_DIR ?= _rel @@ -22,9 +22,11 @@ endif # Core targets. +ifeq ($(IS_DEP),) ifneq ($(wildcard $(RELX_CONFIG)),) rel:: distclean-relx-rel relx-rel endif +endif distclean:: distclean-relx-rel distclean-relx @@ -46,3 +48,28 @@ distclean-relx-rel: distclean-relx: $(gen_verbose) rm -rf $(RELX) + +# Run target. + +ifeq ($(wildcard $(RELX_CONFIG)),) +run: +else + +define get_relx_release.erl + {ok, Config} = file:consult("$(RELX_CONFIG)"), + {release, {Name, _}, _} = lists:keyfind(release, 1, Config), + io:format("~s", [Name]), + halt(0). +endef + +RELX_RELEASE = `$(call erlang,$(get_relx_release.erl))` + +run: all + @$(RELX_OUTPUT_DIR)/$(RELX_RELEASE)/bin/$(RELX_RELEASE) console + +help:: + @printf "%s\n" "" \ + "Relx targets:" \ + " run Compile the project, build the release and run it" + +endif diff --git a/plugins/shell.mk b/plugins/shell.mk index 4e7e97e..6636b92 100644 --- a/plugins/shell.mk +++ b/plugins/shell.mk @@ -15,7 +15,7 @@ ALL_SHELL_DEPS_DIRS = $(addprefix $(DEPS_DIR)/,$(SHELL_DEPS)) help:: @printf "%s\n" "" \ "Shell targets:" \ - " shell Run an erlang shell with SHELL_OPTS or reasonable default" + " shell Run an erlang shell with SHELL_OPTS or reasonable default" # Plugin-specific targets. diff --git a/plugins/triq.mk b/plugins/triq.mk new file mode 100644 index 0000000..f487f8c --- /dev/null +++ b/plugins/triq.mk @@ -0,0 +1,43 @@ +# Copyright (c) 2015, Loïc Hoguin <[email protected]> +# This file is part of erlang.mk and subject to the terms of the ISC License. + +ifneq ($(wildcard $(DEPS_DIR)/triq),) +.PHONY: triq + +# Targets. + +tests:: triq + +define triq_check.erl + code:add_pathsa(["$(CURDIR)/ebin", "$(DEPS_DIR)/*/ebin"]), + try + case $(1) of + all -> [true] =:= lists:usort([triq:check(M) || M <- [$(MODULES)]]); + module -> triq:check($(2)); + function -> triq:check($(2)) + end + of + true -> halt(0); + _ -> halt(1) + catch error:undef -> + io:format("Undefined property or module~n"), + halt(0) + end. +endef + +ifdef t +ifeq (,$(findstring :,$(t))) +triq: test-build + @$(call erlang,$(call triq_check.erl,module,$(t))) +else +triq: test-build + @echo Testing $(t)/0 + @$(call erlang,$(call triq_check.erl,function,$(t)())) +endif +else +triq: test-build + $(eval MODULES := $(shell find ebin -type f -name \*.beam \ + | sed "s/ebin\//'/;s/\.beam/',/" | sed '$$s/.$$//')) + $(gen_verbose) $(call erlang,$(call triq_check.erl,all,undefined)) +endif +endif diff --git a/plugins/xref.mk b/plugins/xref.mk new file mode 100644 index 0000000..b6e4d92 --- /dev/null +++ b/plugins/xref.mk @@ -0,0 +1,38 @@ +# Copyright (c) 2015, Euen Lopez <[email protected]> +# This file is part of erlang.mk and subject to the terms of the ISC License. + +.PHONY: xref distclean-xref + +# Configuration. + +ifeq ($(XREF_CONFIG),) + XREF_ARGS := +else + XREF_ARGS := -c $(XREF_CONFIG) +endif + +XREFR ?= $(CURDIR)/xrefr +export XREFR + +XREFR_URL ?= https://github.com/inaka/xref_runner/releases/download/0.2.0/xrefr + +# Core targets. + +help:: + @printf "%s\n" "" \ + "Xref targets:" \ + " xref Run Xrefr using $XREF_CONFIG as config file if defined" + +distclean:: distclean-xref + +# Plugin-specific targets. + +$(XREFR): + @$(call core_http_get,$(XREFR),$(XREFR_URL)) + @chmod +x $(XREFR) + +xref: deps app $(XREFR) + $(gen_verbose) $(XREFR) $(XREFR_ARGS) + +distclean-xref: + $(gen_verbose) rm -rf $(XREFR) diff --git a/test/Makefile b/test/Makefile new file mode 100644 index 0000000..a77b307 --- /dev/null +++ b/test/Makefile @@ -0,0 +1,256 @@ +# Copyright (c) 2014, Viktor Söderqvist <[email protected]> +# This file is part of erlang.mk and subject to the terms of the ISC License. + +# Tests for erlang.mk targets. If any test fails or if you run a target other +# than 'all', you must probably do 'make clean' before you can test again. + +# Verbosity. + +V ?= 0 + +# t = Verbosity control for tests +# v = Verbosity control for erlang.mk +# i = Command to display (or suppress) info messages +ifeq ($V,0) + # Show info messages only + t = @ + v = V=0 >/dev/null 2>&1 + i = @echo +else ifeq ($V,1) + # Show test commands + t = + v = V=0 >/dev/null 2>&1 + i = @echo == +else ifeq ($V,2) + # Show briefly what erlang.mk is doing + t = @echo " TEST " $@; + v = V=0 + i = @echo == +else + # Show all commands with maximum verbosity + t = + v = V=1 + i = @echo == +endif + +.PHONY: all clean app ct eunit tests-cover docs + +.NOTPARALLEL: + +all: clean app ct eunit tests-cover docs pkgs + $i '+---------------------+' + $i '| All tests passed. |' + $i '+---------------------+' + +clean: + $t rm -rf app1 + +app: app1 + $i "app: Testing the 'app' target." + $t $(MAKE) -C app1 app $v + $i "Checking the modules line in the generated .app file." + $t [ `grep -E "{modules, *\['m'\]}" app1/ebin/app1.app | wc -l` == 1 ] + $t [ -e app1/ebin/m.beam ] + $i "Checking that '$(MAKE) clean-app' deletes ebin." + $t $(MAKE) -C app1 clean-app $v + $t [ ! -e app1/ebin ] + $i "Checking that '$(MAKE) app' returns non-zero on compile errors." + $t printf "%s\n" \ + "-module(syntax_error)." \ + "foo lorem_ipsum dolor sit amet." \ + > app1/src/syntax_error.erl + $t if $(MAKE) -C app1 app $v ; then false ; fi + $t rm app1/src/syntax_error.erl + $i "Test 'app' passed." + +ct: app1 + $i "ct: Testing ct and related targets." + $i "Setting up test suite." + $t mkdir -p app1/test + $t printf "%s\n" \ + "-module(m_SUITE)." \ + "-export([all/0, testcase1/1])." \ + "all() -> [testcase1]." \ + "testcase1(_) -> 2 = m:succ(1)." \ + > app1/test/m_SUITE.erl + $t $(MAKE) -C app1 ct $v + $i "Checking files created by '$(MAKE) ct'." + $t [ -e app1/test/m_SUITE.beam ] + $t [ -e app1/ebin/m.beam ] + $t [ -e app1/logs ] + $i "Checking that '$(MAKE) clean' does not delete logs." + $t $(MAKE) -C app1 clean $v + $t [ -e app1/logs ] + $i "Testing target 'ct-mysuite' where mysuite_SUITE is a test suite." + $t $(MAKE) -C app1 ct-m $v + $i "Checking that '$(MAKE) ct' returns non-zero for a failing suite." + $t printf "%s\n" \ + "-module(failing_SUITE)." \ + "-export([all/0, testcase1/1])." \ + "all() -> [testcase1]." \ + "testcase1(_) -> 42 = m:succ(1)." \ + > app1/test/failing_SUITE.erl + $t if $(MAKE) -C app1 ct-failing $v ; then false ; fi + $i "Checking that '$(MAKE) distclean-ct' deletes logs." + $t $(MAKE) -C app1 distclean-ct $v + $t [ ! -e app1/logs ] + $t [ -e app1/ebin/m.beam ] + $i "Cleaning up test data." + $t rm -rf app1/test + $i "Test 'ct' passed." + +eunit: app1 + $i "eunit: Testing the 'eunit' target." + $i "Running eunit test case inside module src/t.erl" + $t $(call create-module-t) + $t $(MAKE) -C app1 eunit $v + $i "Checking that the eunit test in module t." + $t echo t | cmp app1/test-eunit.log - + $t rm app1/test-eunit.log + $i "Running eunit tests in a separate directory." + $t mkdir -p app1/eunit + $t printf '%s\n' \ + '-module(t_tests).' \ + '-include_lib("eunit/include/eunit.hrl").' \ + 'succ_test() ->' \ + ' ?assertEqual(2, t:succ(1)),' \ + ' os:cmd("echo t_tests >> test-eunit.log").' \ + > app1/eunit/t_tests.erl + $t printf '%s\n' \ + '-module(x_tests).' \ + '-include_lib("eunit/include/eunit.hrl").' \ + 'succ_test() ->' \ + ' ?assertEqual(2, t:succ(1)),' \ + ' os:cmd("echo x_tests >> test-eunit.log").' \ + > app1/eunit/x_tests.erl + $t $(MAKE) -C app1 eunit TEST_DIR=eunit $v + $i "Checking that '$(MAKE) eunit' didn't run the tests in t_tests twice, etc." + $t printf "%s\n" t t_tests x_tests | cmp app1/test-eunit.log - + $t rm app1/test-eunit.log + $i "Checking that '$(MAKE) eunit' returns non-zero for a failing test." + $t rm -f app1/eunit/* + $t printf "%s\n" \ + "-module(t_tests)." \ + '-include_lib("eunit/include/eunit.hrl").' \ + "succ_test() ->" \ + " ?assertEqual(42, t:succ(1))." \ + > app1/eunit/t_tests.erl + $t if $(MAKE) -C app1 eunit TEST_DIR=eunit $v ; then false ; fi + $t rm -rf app1/eunit app1/src/t.erl app1/test-eunit.log + $i "Test 'eunit' passed." + +# TODO: do coverage for 'tests' instead of 'eunit ct' when triq is fixed +tests-cover: app1 + $i "tests-cover: Testing 'eunit' and 'ct' with COVER=1" + $i "Setting up eunit and ct suites." + $t $(call create-module-t) + $t mkdir -p app1/test + $t printf "%s\n" \ + "-module(m_SUITE)." \ + "-export([all/0, testcase1/1])." \ + "all() -> [testcase1]." \ + "testcase1(_) -> 2 = m:succ(1)." \ + > app1/test/m_SUITE.erl + $i "Running tests with coverage analysis." + $t $(MAKE) -C app1 eunit ct COVER=1 $v + $t [ -e app1/test-eunit.log ] + $t [ -e app1/eunit.coverdata ] + $t [ -e app1/ct.coverdata ] + $i "Generating coverage report." + $t $(MAKE) -C app1 cover-report COVER=1 $v + $t [ -e app1/cover/m.COVER.html ] + $t [ -e app1/cover/t.COVER.html ] + $t [ -e app1/cover/index.html ] + $i "Checking combined coverage from eunit and ct." + $t [ `grep 'Total: 100%' app1/cover/index.html | wc -l` -eq 1 ] + $i "Checking that cover-report-clean removes cover report." + $t $(MAKE) -C app1 cover-report-clean $v + $t [ ! -e app1/cover ] + $i "Checking that coverdata-clean removes cover data." + $t $(MAKE) -C app1 coverdata-clean $v + $t [ ! -e app1/eunit.coverdata ] + @# clean up + $t rm -rf app1/src/t.erl app1/test app1/test-eunit.log + $t $(MAKE) -C app1 clean $v + $i "Test 'tests-cover' passed." + +docs: app1 + $i "docs: Testing EDoc including DOC_DEPS." + $t printf "%s\n" \ + "PROJECT = app1" \ + "DOC_DEPS = edown" \ + "dep_edown = git https://github.com/uwiger/edown.git 0.5" \ + "EDOC_OPTS = {doclet, edown_doclet}" \ + "include erlang.mk" \ + "distclean:: distclean-doc-md" \ + "distclean-doc-md:" \ + " rm -rf doc/*.md" \ + > app1/Makefile-doc + $i "Downloading doc deps (edown) and building docs." + $t $(MAKE) -C app1 -f Makefile-doc docs $v + $i "Checking that '$(MAKE) docs' using edown generated a markdown file." + $t [ -e app1/doc/m.md ] + $i "Checking that '$(MAKE) distclean' deletes all generated doc files." + $t $(MAKE) -C app1 -f Makefile-doc distclean $v + $t [ "`ls app1/doc/`" == "" ] + $i "Cleaning up test data." + $t rm app1/Makefile-doc + $i "Test 'docs' passed." + +define app1_setup + $i "Setting up app." + $t mkdir -p app1 + $t cd .. && $(MAKE) + $t cp ../erlang.mk app1/ + $t $(MAKE) -C app1 -f erlang.mk bootstrap-lib + $t printf "%s\n" \ + "-module(m)." \ + "-export([succ/1])." \ + "succ(N) -> N + 1." \ + > app1/src/m.erl +endef + +define pkg_test_target +pkg-$(1)-clean: + $t rm -rf app1 + +pkg-$(1)-app1: + $(call app1_setup) + +# Running 'make' twice to make sure it recompiles fine. +pkg-$(1): pkg-$(1)-clean pkg-$(1)-app1 + $i + $i " pkgs: Checking that '$(1)' builds correctly" + $i + $t printf "%s\n" \ + "PROJECT = app1" \ + "DEPS = $(1)" \ + "include erlang.mk" \ + > app1/Makefile + cp ../packages.v2.tsv app1/.erlang.mk.packages.v2 + $t $(MAKE) -C app1 + $t $(MAKE) -C app1 +endef + +$(foreach pkg,$(shell awk '{print $$1}' ../packages.v2.tsv),$(eval $(call pkg_test_target,$(pkg)))) + +pkgs: $(foreach pkg,$(shell awk '{print $$1}' ../packages.v2.tsv),pkg-$(pkg)) + +# Test application used for testing. +app1: + $(call app1_setup) + +# Extra module in app1 used for testing eunit +define create-module-t +printf '%s\n' \ + '-module(t).' \ + '-export([succ/1]).' \ + 'succ(N) -> N + 1.' \ + '-ifdef(TEST).' \ + '-include_lib("eunit/include/eunit.hrl").' \ + 'succ_test() ->' \ + ' ?assertEqual(2, succ(1)),' \ + ' os:cmd("echo t >> test-eunit.log").' \ + '-endif.' \ + > app1/src/t.erl +endef |