|
16 | 16 |
|
17 | 17 | ERLANG_MK_FILENAME := $(realpath $(lastword $(MAKEFILE_LIST))) |
18 | 18 |
|
19 | | -ERLANG_MK_VERSION = 2.0.0-pre.2-16-ga6d6bfe-dirty |
| 19 | +ERLANG_MK_VERSION = 2.0.0-pre.2-16-gb52203c-dirty |
20 | 20 |
|
21 | 21 | # Core configuration. |
22 | 22 |
|
@@ -4656,6 +4656,67 @@ $(foreach p,$(DEP_PLUGINS),\ |
4656 | 4656 | $(call core_dep_plugin,$p,$(firstword $(subst /, ,$p))),\ |
4657 | 4657 | $(call core_dep_plugin,$p/plugins.mk,$p)))) |
4658 | 4658 |
|
| 4659 | +# Copyright (c) 2013-2015, Loïc Hoguin <essen@ninenines.eu> |
| 4660 | +# This file is part of erlang.mk and subject to the terms of the ISC License. |
| 4661 | + |
| 4662 | +# Configuration. |
| 4663 | + |
| 4664 | +DTL_FULL_PATH ?= |
| 4665 | +DTL_PATH ?= templates/ |
| 4666 | +DTL_SUFFIX ?= _dtl |
| 4667 | + |
| 4668 | +# Verbosity. |
| 4669 | + |
| 4670 | +dtl_verbose_0 = @echo " DTL " $(filter %.dtl,$(?F)); |
| 4671 | +dtl_verbose = $(dtl_verbose_$(V)) |
| 4672 | + |
| 4673 | +# Core targets. |
| 4674 | + |
| 4675 | +define erlydtl_compile.erl |
| 4676 | + [begin |
| 4677 | + Module0 = case "$(strip $(DTL_FULL_PATH))" of |
| 4678 | + "" -> |
| 4679 | + filename:basename(F, ".dtl"); |
| 4680 | + _ -> |
| 4681 | + "$(DTL_PATH)" ++ F2 = filename:rootname(F, ".dtl"), |
| 4682 | + re:replace(F2, "/", "_", [{return, list}, global]) |
| 4683 | + end, |
| 4684 | + Module = list_to_atom(string:to_lower(Module0) ++ "$(DTL_SUFFIX)"), |
| 4685 | + case erlydtl:compile(F, Module, [{out_dir, "ebin/"}, return_errors, {doc_root, "templates"}]) of |
| 4686 | + ok -> ok; |
| 4687 | + {ok, _} -> ok |
| 4688 | + end |
| 4689 | + end || F <- string:tokens("$(1)", " ")], |
| 4690 | + halt(). |
| 4691 | +endef |
| 4692 | + |
| 4693 | +ifneq ($(wildcard src/),) |
| 4694 | + |
| 4695 | +DTL_FILES = $(sort $(call core_find,$(DTL_PATH),*.dtl)) |
| 4696 | + |
| 4697 | +ifdef DTL_FULL_PATH |
| 4698 | +BEAM_FILES += $(addprefix ebin/,$(patsubst %.dtl,%_dtl.beam,$(subst /,_,$(DTL_FILES:$(DTL_PATH)%=%)))) |
| 4699 | +else |
| 4700 | +BEAM_FILES += $(addprefix ebin/,$(patsubst %.dtl,%_dtl.beam,$(notdir $(DTL_FILES)))) |
| 4701 | +endif |
| 4702 | + |
| 4703 | +ifneq ($(words $(DTL_FILES)),0) |
| 4704 | +# Rebuild everything when the Makefile changes. |
| 4705 | +$(ERLANG_MK_TMP)/last-makefile-change-erlydtl: $(MAKEFILE_LIST) |
| 4706 | + @mkdir -p $(ERLANG_MK_TMP) |
| 4707 | + @if test -f $@; then \ |
| 4708 | + touch $(DTL_FILES); \ |
| 4709 | + fi |
| 4710 | + @touch $@ |
| 4711 | + |
| 4712 | +ebin/$(PROJECT).app:: $(ERLANG_MK_TMP)/last-makefile-change-erlydtl |
| 4713 | +endif |
| 4714 | + |
| 4715 | +ebin/$(PROJECT).app:: $(DTL_FILES) |
| 4716 | + $(if $(strip $?),\ |
| 4717 | + $(dtl_verbose) $(call erlang,$(call erlydtl_compile.erl,$?,-pa ebin/ $(DEPS_DIR)/erlydtl/ebin/))) |
| 4718 | +endif |
| 4719 | + |
4659 | 4720 | # Copyright (c) 2015, Loïc Hoguin <essen@ninenines.eu> |
4660 | 4721 | # This file is part of erlang.mk and subject to the terms of the ISC License. |
4661 | 4722 |
|
@@ -5988,67 +6049,6 @@ elvis: $(ELVIS) $(ELVIS_CONFIG) |
5988 | 6049 | distclean-elvis: |
5989 | 6050 | $(gen_verbose) rm -rf $(ELVIS) |
5990 | 6051 |
|
5991 | | -# Copyright (c) 2013-2015, Loïc Hoguin <essen@ninenines.eu> |
5992 | | -# This file is part of erlang.mk and subject to the terms of the ISC License. |
5993 | | - |
5994 | | -# Configuration. |
5995 | | - |
5996 | | -DTL_FULL_PATH ?= |
5997 | | -DTL_PATH ?= templates/ |
5998 | | -DTL_SUFFIX ?= _dtl |
5999 | | - |
6000 | | -# Verbosity. |
6001 | | - |
6002 | | -dtl_verbose_0 = @echo " DTL " $(filter %.dtl,$(?F)); |
6003 | | -dtl_verbose = $(dtl_verbose_$(V)) |
6004 | | - |
6005 | | -# Core targets. |
6006 | | - |
6007 | | -define erlydtl_compile.erl |
6008 | | - [begin |
6009 | | - Module0 = case "$(strip $(DTL_FULL_PATH))" of |
6010 | | - "" -> |
6011 | | - filename:basename(F, ".dtl"); |
6012 | | - _ -> |
6013 | | - "$(DTL_PATH)" ++ F2 = filename:rootname(F, ".dtl"), |
6014 | | - re:replace(F2, "/", "_", [{return, list}, global]) |
6015 | | - end, |
6016 | | - Module = list_to_atom(string:to_lower(Module0) ++ "$(DTL_SUFFIX)"), |
6017 | | - case erlydtl:compile(F, Module, [{out_dir, "ebin/"}, return_errors, {doc_root, "templates"}]) of |
6018 | | - ok -> ok; |
6019 | | - {ok, _} -> ok |
6020 | | - end |
6021 | | - end || F <- string:tokens("$(1)", " ")], |
6022 | | - halt(). |
6023 | | -endef |
6024 | | - |
6025 | | -ifneq ($(wildcard src/),) |
6026 | | - |
6027 | | -DTL_FILES = $(sort $(call core_find,$(DTL_PATH),*.dtl)) |
6028 | | - |
6029 | | -ifdef DTL_FULL_PATH |
6030 | | -BEAM_FILES += $(addprefix ebin/,$(patsubst %.dtl,%_dtl.beam,$(subst /,_,$(DTL_FILES:$(DTL_PATH)%=%)))) |
6031 | | -else |
6032 | | -BEAM_FILES += $(addprefix ebin/,$(patsubst %.dtl,%_dtl.beam,$(notdir $(DTL_FILES)))) |
6033 | | -endif |
6034 | | - |
6035 | | -ifneq ($(words $(DTL_FILES)),0) |
6036 | | -# Rebuild everything when the Makefile changes. |
6037 | | -$(ERLANG_MK_TMP)/last-makefile-change-erlydtl: $(MAKEFILE_LIST) |
6038 | | - @mkdir -p $(ERLANG_MK_TMP) |
6039 | | - @if test -f $@; then \ |
6040 | | - touch $(DTL_FILES); \ |
6041 | | - fi |
6042 | | - @touch $@ |
6043 | | - |
6044 | | -ebin/$(PROJECT).app:: $(ERLANG_MK_TMP)/last-makefile-change-erlydtl |
6045 | | -endif |
6046 | | - |
6047 | | -ebin/$(PROJECT).app:: $(DTL_FILES) |
6048 | | - $(if $(strip $?),\ |
6049 | | - $(dtl_verbose) $(call erlang,$(call erlydtl_compile.erl,$?,-pa ebin/ $(DEPS_DIR)/erlydtl/ebin/))) |
6050 | | -endif |
6051 | | - |
6052 | 6052 | # Copyright (c) 2014 Dave Cottlehuber <dch@skunkwerks.at> |
6053 | 6053 | # This file is part of erlang.mk and subject to the terms of the ISC License. |
6054 | 6054 |
|
@@ -6491,7 +6491,7 @@ $(ERLANG_MK_RECURSIVE_SHELL_DEPS_LIST): |
6491 | 6491 | $(verbose) :> $@ |
6492 | 6492 | else |
6493 | 6493 | LIST_DIRS = $(ALL_DEPS_DIRS) |
6494 | | -LIST_DEPS = $(DEPS) |
| 6494 | +LIST_DEPS = $(BUILD_DEPS) $(DEPS) |
6495 | 6495 |
|
6496 | 6496 | $(ERLANG_MK_RECURSIVE_DEPS_LIST): fetch-deps |
6497 | 6497 |
|
|
0 commit comments