aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/erlydtl.mk
diff options
context:
space:
mode:
authorLoïc Hoguin <[email protected]>2014-05-28 22:07:54 +0200
committerLoïc Hoguin <[email protected]>2014-05-28 22:17:51 +0200
commit58b99e7f457bc056e91d2d1721cbb65fcd517afe (patch)
tree16f20657dcb4f1713ff3bfc02de875b85e7875c4 /plugins/erlydtl.mk
parentb47d3f4c3e097aa28a08f72931d2ce8c50039681 (diff)
downloaderlang.mk-58b99e7f457bc056e91d2d1721cbb65fcd517afe.tar.gz
erlang.mk-58b99e7f457bc056e91d2d1721cbb65fcd517afe.tar.bz2
erlang.mk-58b99e7f457bc056e91d2d1721cbb65fcd517afe.zip
Cut erlang.mk into many small components
* The build.config says what gets into the generated erlang.mk. * The default erlang.mk in the repository hasn't changed yet. * Clean targets were separated into "clean" and "distclean". * The "help" target was added to display some help message. I probably broke a couple things...
Diffstat (limited to 'plugins/erlydtl.mk')
-rw-r--r--plugins/erlydtl.mk25
1 files changed, 25 insertions, 0 deletions
diff --git a/plugins/erlydtl.mk b/plugins/erlydtl.mk
new file mode 100644
index 0000000..e288072
--- /dev/null
+++ b/plugins/erlydtl.mk
@@ -0,0 +1,25 @@
+# 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