From 4766a71d162e99dc719cd253657b64daca796c0d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jean-S=C3=A9bastien=20P=C3=A9dron?= Date: Wed, 25 Nov 2015 10:35:55 +0100 Subject: [PATCH] Update erlang.mk --- erlang.mk | 198 ++++++++++++++++++++++++++++-------------------------- 1 file changed, 101 insertions(+), 97 deletions(-) diff --git a/erlang.mk b/erlang.mk index d41e780..6e2e132 100644 --- a/erlang.mk +++ b/erlang.mk @@ -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. @@ -78,8 +78,6 @@ endif # Core targets. -.NOTPARALLEL: - all:: deps app rel # Noop to avoid a Make warning when there's nothing to do. @@ -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 @@ -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 @@ -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 @@ -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}])) @@ -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 +# 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 # This file is part of erlang.mk and subject to the terms of the ISC License. @@ -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 @@ -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 @@ -5457,10 +5509,17 @@ 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) @@ -5468,7 +5527,7 @@ 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 @@ -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 @@ -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) @@ -5990,67 +6049,6 @@ elvis: $(ELVIS) $(ELVIS_CONFIG) distclean-elvis: $(gen_verbose) rm -rf $(ELVIS) -# Copyright (c) 2013-2015, Loïc Hoguin -# 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 # This file is part of erlang.mk and subject to the terms of the ISC License. @@ -6191,7 +6189,7 @@ endif ifeq ($(IS_DEP),) ifneq ($(wildcard $(RELX_CONFIG)),) -rel:: distclean-relx-rel relx-rel +rel:: relx-rel endif endif @@ -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: @@ -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 @@ -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 @@ -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 @@ -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) \