aboutsummaryrefslogtreecommitdiffstats
path: root/core/erlc.mk
diff options
context:
space:
mode:
authorLoïc Hoguin <[email protected]>2014-11-19 12:07:02 +0200
committerLoïc Hoguin <[email protected]>2014-11-19 12:11:03 +0200
commit6178156e4e551a7fc4b531f636eb5b0b8605028b (patch)
treed9b55b38e34ae68c9e23a7e6c8fb092fd89d2de7 /core/erlc.mk
parente44a4131d5034569a83dc225d05c9913d02011ce (diff)
parenta2af777b6bd0937171acfcd5b7eba2410fa3f8d2 (diff)
downloaderlang.mk-6178156e4e551a7fc4b531f636eb5b0b8605028b.tar.gz
erlang.mk-6178156e4e551a7fc4b531f636eb5b0b8605028b.tar.bz2
erlang.mk-6178156e4e551a7fc4b531f636eb5b0b8605028b.zip
Merge branch 'compile-mibs' of git://github.com/danielwhite/erlang.mk
Fixed a small whitespace issue in the silent output.
Diffstat (limited to 'core/erlc.mk')
-rw-r--r--core/erlc.mk20
1 files changed, 19 insertions, 1 deletions
diff --git a/core/erlc.mk b/core/erlc.mk
index c13c714..5c38fc9 100644
--- a/core/erlc.mk
+++ b/core/erlc.mk
@@ -12,6 +12,10 @@ 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;
@@ -24,6 +28,9 @@ 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
@@ -51,10 +58,20 @@ 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/
+ebin/$(PROJECT).app:: $(shell find mibs -type f -name \*.mib)
+ @mkdir -p priv/mibs/ include
+ $(if $(strip $?),$(call compile_mib,$?))
+
ebin/$(PROJECT).app:: $(shell find src -type f -name \*.erl) \
$(shell find src -type f -name \*.core)
$(if $(strip $?),$(call compile_erl,$?))
@@ -74,4 +91,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)))))