diff options
-rw-r--r-- | README.md | 5 | ||||
-rw-r--r-- | core/erlc.mk | 30 | ||||
-rw-r--r-- | erlang.mk | 30 | ||||
-rw-r--r-- | packages.v1.tsv | 1 | ||||
-rw-r--r-- | packages.v1.txt | 1 | ||||
-rw-r--r-- | packages.v2.tsv | 1 |
6 files changed, 62 insertions, 6 deletions
@@ -215,6 +215,11 @@ variable. It takes the arguments that will then be passed to You can specify a list of modules to be compiled first using the `COMPILE_FIRST` variable. +You can also use the `ERLC_EXCLUDE` variable to prevent some +modules from being compiled by the core compiler. Note that +`ERLC_EXCLUDE` is a list of module names (i.e., no file extension +is required). + If `{id, "git"},` is found in your project's `.app.src`, the extended output of `git describe ...` will replace it. This can be retrieved at runtime via `application:get_key/2`. diff --git a/core/erlc.mk b/core/erlc.mk index a7f73f8..cbb7471 100644 --- a/core/erlc.mk +++ b/core/erlc.mk @@ -9,18 +9,28 @@ ERLC_OPTS ?= -Werror +debug_info +warn_export_all +warn_export_vars \ +warn_shadow_vars +warn_obsolete_guard # +bin_opt_info +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 %.erl %.core,$(?F)); +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 @@ -38,7 +48,8 @@ app:: erlc-include ebin/$(PROJECT).app define compile_erl $(erlc_verbose) erlc -v $(ERLC_OPTS) -o ebin/ \ - -pa ebin/ -I include/ $(COMPILE_FIRST_PATHS) $(1) + -pa ebin/ -I include/ $(filter-out $(ERLC_EXCLUDE_PATHS),\ + $(COMPILE_FIRST_PATHS) $(1)) endef define compile_xyrl @@ -47,10 +58,22 @@ define compile_xyrl @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,$?)) @@ -70,4 +93,5 @@ erlc-include: fi clean-app: - $(gen_verbose) rm -rf ebin/ + $(gen_verbose) rm -rf ebin/ priv/mibs/ + $(gen_verbose) rm -f $(addprefix include/,$(addsuffix .hrl,$(notdir $(basename $(wildcard mibs/*.mib))))) @@ -210,18 +210,28 @@ ERLC_OPTS ?= -Werror +debug_info +warn_export_all +warn_export_vars \ +warn_shadow_vars +warn_obsolete_guard # +bin_opt_info +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 %.erl %.core,$(?F)); +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 @@ -239,7 +249,8 @@ app:: erlc-include ebin/$(PROJECT).app define compile_erl $(erlc_verbose) erlc -v $(ERLC_OPTS) -o ebin/ \ - -pa ebin/ -I include/ $(COMPILE_FIRST_PATHS) $(1) + -pa ebin/ -I include/ $(filter-out $(ERLC_EXCLUDE_PATHS),\ + $(COMPILE_FIRST_PATHS) $(1)) endef define compile_xyrl @@ -248,10 +259,22 @@ define compile_xyrl @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,$?)) @@ -271,7 +294,8 @@ erlc-include: fi clean-app: - $(gen_verbose) rm -rf ebin/ + $(gen_verbose) rm -rf ebin/ priv/mibs/ + $(gen_verbose) rm -f $(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. diff --git a/packages.v1.tsv b/packages.v1.tsv index 2e2e2e6..dbc2972 100644 --- a/packages.v1.tsv +++ b/packages.v1.tsv @@ -26,6 +26,7 @@ exsplus https://github.com/jj1bdx/exsplus https://github.com/jj1bdx/exsplus Xors 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. +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 jiffy https://github.com/davisp/jiffy https://github.com/davisp/jiffy JSON NIFs for Erlang. diff --git a/packages.v1.txt b/packages.v1.txt index 2e2e2e6..dbc2972 100644 --- a/packages.v1.txt +++ b/packages.v1.txt @@ -26,6 +26,7 @@ exsplus https://github.com/jj1bdx/exsplus https://github.com/jj1bdx/exsplus Xors 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. +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 jiffy https://github.com/davisp/jiffy https://github.com/davisp/jiffy JSON NIFs for Erlang. diff --git a/packages.v2.tsv b/packages.v2.tsv index 6fadc33..9120563 100644 --- a/packages.v2.tsv +++ b/packages.v2.tsv @@ -26,6 +26,7 @@ exsplus git https://github.com/jj1bdx/exsplus master https://github.com/jj1bdx/e 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. +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 jiffy git https://github.com/davisp/jiffy master https://github.com/davisp/jiffy JSON NIFs for Erlang. |