Skip to content
This repository has been archived by the owner on Nov 17, 2020. It is now read-only.

Commit

Permalink
Update erlang.mk
Browse files Browse the repository at this point in the history
  • Loading branch information
dumbbell committed Nov 25, 2015
1 parent 9cda64b commit 4766a71
Showing 1 changed file with 101 additions and 97 deletions.
198 changes: 101 additions & 97 deletions erlang.mk
Expand Up @@ -16,7 +16,7 @@

ERLANG_MK_FILENAME := $(realpath $(lastword $(MAKEFILE_LIST)))

ERLANG_MK_VERSION = 1.2.0-849-g29268fc
ERLANG_MK_VERSION = 2.0.0-pre.2-16-ga6d6bfe

# Core configuration.

Expand Down Expand Up @@ -78,8 +78,6 @@ endif

# Core targets.

.NOTPARALLEL:

all:: deps app rel

# Noop to avoid a Make warning when there's nothing to do.
Expand Down Expand Up @@ -2039,14 +2037,6 @@ pkg_iso8601_fetch = git
pkg_iso8601_repo = https://github.com/seansawyer/erlang_iso8601
pkg_iso8601_commit = master

PACKAGES += itweet
pkg_itweet_name = itweet
pkg_itweet_description = Twitter Stream API on ibrowse
pkg_itweet_homepage = http://inaka.github.com/itweet/
pkg_itweet_fetch = git
pkg_itweet_repo = https://github.com/inaka/itweet
pkg_itweet_commit = v2.0

PACKAGES += jamdb_sybase
pkg_jamdb_sybase_name = jamdb_sybase
pkg_jamdb_sybase_description = Erlang driver for SAP Sybase ASE
Expand Down Expand Up @@ -2703,6 +2693,14 @@ pkg_nkpacket_fetch = git
pkg_nkpacket_repo = https://github.com/Nekso/nkpacket
pkg_nkpacket_commit = master

PACKAGES += nksip
pkg_nksip_name = nksip
pkg_nksip_description = Erlang SIP application server
pkg_nksip_homepage = https://github.com/kalta/nksip
pkg_nksip_fetch = git
pkg_nksip_repo = https://github.com/kalta/nksip
pkg_nksip_commit = master

PACKAGES += nodefinder
pkg_nodefinder_name = nodefinder
pkg_nodefinder_description = automatic node discovery via UDP multicast
Expand Down Expand Up @@ -2967,14 +2965,6 @@ pkg_psycho_fetch = git
pkg_psycho_repo = https://github.com/gar1t/psycho
pkg_psycho_commit = master

PACKAGES += ptrackerl
pkg_ptrackerl_name = ptrackerl
pkg_ptrackerl_description = Pivotal Tracker API Client written in Erlang
pkg_ptrackerl_homepage = https://github.com/inaka/ptrackerl
pkg_ptrackerl_fetch = git
pkg_ptrackerl_repo = https://github.com/inaka/ptrackerl
pkg_ptrackerl_commit = master

PACKAGES += purity
pkg_purity_name = purity
pkg_purity_description = A side-effect analyzer for Erlang
Expand Down Expand Up @@ -4490,7 +4480,7 @@ define dep_autopatch_app.erl
false -> ok;
true ->
{ok, [{application, '$(1)', L0}]} = file:consult(App),
Mods = filelib:fold_files("$(call core_native_path,$(DEPS_DIR)/$1/src)", "\\\\.erl$$$$", true,
Mods = filelib:fold_files("$(call core_native_path,$(DEPS_DIR)/$1/src)", "\\\\.erl$$", true,
fun (F, Acc) -> [list_to_atom(filename:rootname(filename:basename(F)))|Acc] end, []),
L = lists:keystore(modules, 1, L0, {modules, Mods}),
ok = file:write_file(App, io_lib:format("~p.~n", [{application, '$(1)', L}]))
Expand Down Expand Up @@ -4666,6 +4656,67 @@ $(foreach p,$(DEP_PLUGINS),\
$(call core_dep_plugin,$p,$(firstword $(subst /, ,$p))),\
$(call core_dep_plugin,$p/plugins.mk,$p))))

# Copyright (c) 2013-2015, Loïc Hoguin <essen@ninenines.eu>
# This file is part of erlang.mk and subject to the terms of the ISC License.

# Configuration.

DTL_FULL_PATH ?=
DTL_PATH ?= templates/
DTL_SUFFIX ?= _dtl

# Verbosity.

dtl_verbose_0 = @echo " DTL " $(filter %.dtl,$(?F));
dtl_verbose = $(dtl_verbose_$(V))

# Core targets.

define erlydtl_compile.erl
[begin
Module0 = case "$(strip $(DTL_FULL_PATH))" of
"" ->
filename:basename(F, ".dtl");
_ ->
"$(DTL_PATH)" ++ F2 = filename:rootname(F, ".dtl"),
re:replace(F2, "/", "_", [{return, list}, global])
end,
Module = list_to_atom(string:to_lower(Module0) ++ "$(DTL_SUFFIX)"),
case erlydtl:compile(F, Module, [{out_dir, "ebin/"}, return_errors, {doc_root, "templates"}]) of
ok -> ok;
{ok, _} -> ok
end
end || F <- string:tokens("$(1)", " ")],
halt().
endef

ifneq ($(wildcard src/),)

DTL_FILES = $(sort $(call core_find,$(DTL_PATH),*.dtl))

ifdef DTL_FULL_PATH
BEAM_FILES += $(addprefix ebin/,$(patsubst %.dtl,%_dtl.beam,$(subst /,_,$(DTL_FILES:$(DTL_PATH)%=%))))
else
BEAM_FILES += $(addprefix ebin/,$(patsubst %.dtl,%_dtl.beam,$(notdir $(DTL_FILES))))
endif

ifneq ($(words $(DTL_FILES)),0)
# Rebuild everything when the Makefile changes.
$(ERLANG_MK_TMP)/last-makefile-change-erlydtl: $(MAKEFILE_LIST)
@mkdir -p $(ERLANG_MK_TMP)
@if test -f $@; then \
touch $(DTL_FILES); \
fi
@touch $@

ebin/$(PROJECT).app:: $(ERLANG_MK_TMP)/last-makefile-change-erlydtl
endif

ebin/$(PROJECT).app:: $(DTL_FILES)
$(if $(strip $?),\
$(dtl_verbose) $(call erlang,$(call erlydtl_compile.erl,$?,-pa ebin/ $(DEPS_DIR)/erlydtl/ebin/)))
endif

# Copyright (c) 2015, Loïc Hoguin <essen@ninenines.eu>
# This file is part of erlang.mk and subject to the terms of the ISC License.

Expand Down Expand Up @@ -4752,10 +4803,10 @@ ifneq ($(wildcard src/),)
# Targets.

ifeq ($(wildcard ebin/test),)
app:: $(PROJECT).d
app:: deps $(PROJECT).d
$(verbose) $(MAKE) --no-print-directory app-build
else
app:: clean $(PROJECT).d
app:: clean deps $(PROJECT).d
$(verbose) $(MAKE) --no-print-directory app-build
endif

Expand Down Expand Up @@ -4900,6 +4951,7 @@ $(ERLANG_MK_TMP)/last-makefile-change: $(MAKEFILE_LIST)
fi
@touch $@

$(ERL_FILES) $(CORE_FILES) $(ASN1_FILES) $(MIB_FILES) $(XRL_FILES) $(YRL_FILES):: $(ERLANG_MK_TMP)/last-makefile-change
ebin/$(PROJECT).app:: $(ERLANG_MK_TMP)/last-makefile-change
endif

Expand Down Expand Up @@ -5457,18 +5509,25 @@ endef
# Plugin-specific targets.

define render_template
$(shell mkdir -p $(dir $(2)))
$(file > $(2),$(call $(1)))
$(verbose) printf -- '$(subst $(newline),\n,$(subst %,%%,$(subst ','\'',$(subst $(tab),$(WS),$(call $(1))))))\n' > $(2)
endef

ifndef WS
ifdef SP
WS = $(subst a,,a $(wordlist 1,$(SP),a a a a a a a a a a a a a a a a a a a a))
else
WS = $(tab)
endif
endif

bootstrap:
ifneq ($(wildcard src/),)
$(error Error: src/ directory already exists)
endif
$(eval p := $(PROJECT))
$(eval n := $(PROJECT)_sup)
$(call render_template,bs_Makefile,Makefile)
$(verbose) mkdir -p src/
$(verbose) mkdir src/
ifdef LEGACY
$(call render_template,bs_appsrc,src/$(PROJECT).app.src)
endif
Expand All @@ -5481,7 +5540,7 @@ ifneq ($(wildcard src/),)
endif
$(eval p := $(PROJECT))
$(call render_template,bs_Makefile,Makefile)
$(verbose) mkdir -p src/
$(verbose) mkdir src/
ifdef LEGACY
$(call render_template,bs_appsrc_lib,src/$(PROJECT).app.src)
endif
Expand All @@ -5495,7 +5554,7 @@ ifneq ($(wildcard rel/),)
endif
$(eval p := $(PROJECT))
$(call render_template,bs_relx_config,relx.config)
$(verbose) mkdir -p rel/
$(verbose) mkdir rel/
$(call render_template,bs_sys_config,rel/sys.config)
$(call render_template,bs_vm_args,rel/vm.args)

Expand Down Expand Up @@ -5990,67 +6049,6 @@ elvis: $(ELVIS) $(ELVIS_CONFIG)
distclean-elvis:
$(gen_verbose) rm -rf $(ELVIS)

# Copyright (c) 2013-2015, Loïc Hoguin <essen@ninenines.eu>
# This file is part of erlang.mk and subject to the terms of the ISC License.

# Configuration.

DTL_FULL_PATH ?=
DTL_PATH ?= templates/
DTL_SUFFIX ?= _dtl

# Verbosity.

dtl_verbose_0 = @echo " DTL " $(filter %.dtl,$(?F));
dtl_verbose = $(dtl_verbose_$(V))

# Core targets.

define erlydtl_compile.erl
[begin
Module0 = case "$(strip $(DTL_FULL_PATH))" of
"" ->
filename:basename(F, ".dtl");
_ ->
"$(DTL_PATH)" ++ F2 = filename:rootname(F, ".dtl"),
re:replace(F2, "/", "_", [{return, list}, global])
end,
Module = list_to_atom(string:to_lower(Module0) ++ "$(DTL_SUFFIX)"),
case erlydtl:compile(F, Module, [{out_dir, "ebin/"}, return_errors, {doc_root, "templates"}]) of
ok -> ok;
{ok, _} -> ok
end
end || F <- string:tokens("$(1)", " ")],
halt().
endef

ifneq ($(wildcard src/),)

DTL_FILES = $(sort $(call core_find,$(DTL_PATH),*.dtl))

ifdef DTL_FULL_PATH
BEAM_FILES += $(addprefix ebin/,$(patsubst %.dtl,%_dtl.beam,$(subst /,_,$(DTL_FILES:$(DTL_PATH)%=%))))
else
BEAM_FILES += $(addprefix ebin/,$(patsubst %.dtl,%_dtl.beam,$(notdir $(DTL_FILES))))
endif

ifneq ($(words $(DTL_FILES)),0)
# Rebuild everything when the Makefile changes.
$(ERLANG_MK_TMP)/last-makefile-change-erlydtl: $(MAKEFILE_LIST)
@mkdir -p $(ERLANG_MK_TMP)
@if test -f $@; then \
touch $(DTL_FILES); \
fi
@touch $@

ebin/$(PROJECT).app:: $(ERLANG_MK_TMP)/last-makefile-change-erlydtl
endif

ebin/$(PROJECT).app:: $(DTL_FILES)
$(if $(strip $?),\
$(dtl_verbose) $(call erlang,$(call erlydtl_compile.erl,$?,-pa ebin/ $(DEPS_DIR)/erlydtl/ebin/)))
endif

# Copyright (c) 2014 Dave Cottlehuber <dch@skunkwerks.at>
# This file is part of erlang.mk and subject to the terms of the ISC License.

Expand Down Expand Up @@ -6191,7 +6189,7 @@ endif

ifeq ($(IS_DEP),)
ifneq ($(wildcard $(RELX_CONFIG)),)
rel:: distclean-relx-rel relx-rel
rel:: relx-rel
endif
endif

Expand All @@ -6203,7 +6201,7 @@ $(RELX):
$(gen_verbose) $(call core_http_get,$(RELX),$(RELX_URL))
$(verbose) chmod +x $(RELX)

relx-rel: $(RELX) rel-deps
relx-rel: $(RELX) rel-deps app
$(verbose) $(RELX) -c $(RELX_CONFIG) $(RELX_OPTS)

distclean-relx-rel:
Expand Down Expand Up @@ -6496,7 +6494,6 @@ fetch-shell-deps: $(ALL_DEPS_DIRS) $(ALL_SHELL_DEPS_DIRS)

# Allow to use fetch-deps and $(DEP_TYPES) to fetch multiple types of
# dependencies with a single target.
ifneq ($(IS_DEP),1)
ifneq ($(filter doc,$(DEP_TYPES)),)
fetch-deps: $(ALL_DOC_DEPS_DIRS)
endif
Expand All @@ -6509,7 +6506,6 @@ endif
ifneq ($(filter shell,$(DEP_TYPES)),)
fetch-deps: $(ALL_SHELL_DEPS_DIRS)
endif
endif # ifneq ($(IS_DEP),1)

fetch-deps fetch-doc-deps fetch-rel-deps fetch-test-deps fetch-shell-deps:
ifndef IS_APP
Expand All @@ -6526,7 +6522,7 @@ endif
echo $$dep >> $(ERLANG_MK_TMP)/$@.log; \
if grep -qs -E "^[[:blank:]]*include[[:blank:]]+(erlang\.mk|.*/erlang\.mk)$$" \
$$dep/GNUmakefile $$dep/makefile $$dep/Makefile; then \
$(MAKE) -C $$dep $@ IS_DEP=1 || exit $$?; \
$(MAKE) -C $$dep fetch-deps IS_DEP=1 || exit $$?; \
fi \
fi \
done
Expand All @@ -6553,26 +6549,34 @@ $(ERLANG_MK_RECURSIVE_DEPS_LIST): fetch-deps
ifneq ($(IS_DEP),1)
$(ERLANG_MK_RECURSIVE_DOC_DEPS_LIST): LIST_DIRS += $(ALL_DOC_DEPS_DIRS)
$(ERLANG_MK_RECURSIVE_DOC_DEPS_LIST): LIST_DEPS += $(DOC_DEPS)
endif
$(ERLANG_MK_RECURSIVE_DOC_DEPS_LIST): fetch-doc-deps
else
$(ERLANG_MK_RECURSIVE_DOC_DEPS_LIST): fetch-deps
endif

ifneq ($(IS_DEP),1)
$(ERLANG_MK_RECURSIVE_REL_DEPS_LIST): LIST_DIRS += $(ALL_REL_DEPS_DIRS)
$(ERLANG_MK_RECURSIVE_REL_DEPS_LIST): LIST_DEPS += $(REL_DEPS)
endif
$(ERLANG_MK_RECURSIVE_REL_DEPS_LIST): fetch-rel-deps
else
$(ERLANG_MK_RECURSIVE_REL_DEPS_LIST): fetch-deps
endif

ifneq ($(IS_DEP),1)
$(ERLANG_MK_RECURSIVE_TEST_DEPS_LIST): LIST_DIRS += $(ALL_TEST_DEPS_DIRS)
$(ERLANG_MK_RECURSIVE_TEST_DEPS_LIST): LIST_DEPS += $(TEST_DEPS)
endif
$(ERLANG_MK_RECURSIVE_TEST_DEPS_LIST): fetch-test-deps
else
$(ERLANG_MK_RECURSIVE_TEST_DEPS_LIST): fetch-deps
endif

ifneq ($(IS_DEP),1)
$(ERLANG_MK_RECURSIVE_SHELL_DEPS_LIST): LIST_DIRS += $(ALL_SHELL_DEPS_DIRS)
$(ERLANG_MK_RECURSIVE_SHELL_DEPS_LIST): LIST_DEPS += $(SHELL_DEPS)
endif
$(ERLANG_MK_RECURSIVE_SHELL_DEPS_LIST): fetch-shell-deps
else
$(ERLANG_MK_RECURSIVE_SHELL_DEPS_LIST): fetch-deps
endif

$(ERLANG_MK_RECURSIVE_DEPS_LIST) \
$(ERLANG_MK_RECURSIVE_DOC_DEPS_LIST) \
Expand Down

0 comments on commit 4766a71

Please sign in to comment.