deps.mk 30 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897
  1. # Copyright (c) 2013-2016, Loïc Hoguin <essen@ninenines.eu>
  2. # This file is part of erlang.mk and subject to the terms of the ISC License.
  3. .PHONY: distclean-deps clean-tmp-deps.log
  4. # Configuration.
  5. ifdef OTP_DEPS
  6. $(warning The variable OTP_DEPS is deprecated in favor of LOCAL_DEPS.)
  7. endif
  8. IGNORE_DEPS ?=
  9. export IGNORE_DEPS
  10. APPS_DIR ?= $(CURDIR)/apps
  11. export APPS_DIR
  12. DEPS_DIR ?= $(CURDIR)/deps
  13. export DEPS_DIR
  14. REBAR_DEPS_DIR = $(DEPS_DIR)
  15. export REBAR_DEPS_DIR
  16. REBAR3_GIT ?= https://github.com/erlang/rebar3
  17. REBAR3_COMMIT ?= 3f563feaf1091a1980241adefa83a32dd2eebf7c # 3.20.0
  18. CACHE_DEPS ?= 0
  19. CACHE_DIR ?= $(if $(XDG_CACHE_HOME),$(XDG_CACHE_HOME),$(HOME)/.cache)/erlang.mk
  20. export CACHE_DIR
  21. # External "early" plugins (see core/plugins.mk for regular plugins).
  22. # They both use the core_dep_plugin macro.
  23. define core_dep_plugin
  24. ifeq ($(2),$(PROJECT))
  25. -include $$(patsubst $(PROJECT)/%,%,$(1))
  26. else
  27. -include $(DEPS_DIR)/$(1)
  28. $(DEPS_DIR)/$(1): $(DEPS_DIR)/$(2) ;
  29. endif
  30. endef
  31. DEP_EARLY_PLUGINS ?=
  32. $(foreach p,$(DEP_EARLY_PLUGINS),\
  33. $(eval $(if $(findstring /,$p),\
  34. $(call core_dep_plugin,$p,$(firstword $(subst /, ,$p))),\
  35. $(call core_dep_plugin,$p/early-plugins.mk,$p))))
  36. # Query functions.
  37. query_fetch_method = $(if $(dep_$(1)),$(call _qfm_dep,$(word 1,$(dep_$(1)))),$(call _qfm_pkg,$(1)))
  38. _qfm_dep = $(if $(dep_fetch_$(1)),$(1),$(if $(IS_DEP),legacy,fail))
  39. _qfm_pkg = $(if $(pkg_$(1)_fetch),$(pkg_$(1)_fetch),fail)
  40. query_name = $(if $(dep_$(1)),$(1),$(if $(pkg_$(1)_name),$(pkg_$(1)_name),$(1)))
  41. query_repo = $(call _qr,$(1),$(call query_fetch_method,$(1)))
  42. _qr = $(if $(query_repo_$(2)),$(call query_repo_$(2),$(1)),$(call dep_repo,$(1)))
  43. query_repo_default = $(if $(dep_$(1)),$(word 2,$(dep_$(1))),$(pkg_$(1)_repo))
  44. query_repo_git = $(patsubst git://github.com/%,https://github.com/%,$(call query_repo_default,$(1)))
  45. query_repo_git-subfolder = $(call query_repo_git,$(1))
  46. query_repo_git-submodule = -
  47. query_repo_hg = $(call query_repo_default,$(1))
  48. query_repo_svn = $(call query_repo_default,$(1))
  49. query_repo_cp = $(call query_repo_default,$(1))
  50. query_repo_ln = $(call query_repo_default,$(1))
  51. query_repo_hex = https://hex.pm/packages/$(if $(word 3,$(dep_$(1))),$(word 3,$(dep_$(1))),$(1))
  52. query_repo_fail = -
  53. query_repo_legacy = -
  54. query_version = $(call _qv,$(1),$(call query_fetch_method,$(1)))
  55. _qv = $(if $(query_version_$(2)),$(call query_version_$(2),$(1)),$(call dep_commit,$(1)))
  56. query_version_default = $(if $(dep_$(1)_commit),$(dep_$(1)_commit),$(if $(dep_$(1)),$(word 3,$(dep_$(1))),$(pkg_$(1)_commit)))
  57. query_version_git = $(call query_version_default,$(1))
  58. query_version_git-subfolder = $(call query_version_git,$(1))
  59. query_version_git-submodule = -
  60. query_version_hg = $(call query_version_default,$(1))
  61. query_version_svn = -
  62. query_version_cp = -
  63. query_version_ln = -
  64. query_version_hex = $(if $(dep_$(1)_commit),$(dep_$(1)_commit),$(if $(dep_$(1)),$(word 2,$(dep_$(1))),$(pkg_$(1)_commit)))
  65. query_version_fail = -
  66. query_version_legacy = -
  67. query_extra = $(call _qe,$(1),$(call query_fetch_method,$(1)))
  68. _qe = $(if $(query_extra_$(2)),$(call query_extra_$(2),$(1)),-)
  69. query_extra_git = -
  70. query_extra_git-subfolder = $(if $(dep_$(1)),subfolder=$(word 4,$(dep_$(1))),-)
  71. query_extra_git-submodule = -
  72. query_extra_hg = -
  73. query_extra_svn = -
  74. query_extra_cp = -
  75. query_extra_ln = -
  76. query_extra_hex = $(if $(dep_$(1)),package-name=$(word 3,$(dep_$(1))),-)
  77. query_extra_fail = -
  78. query_extra_legacy = -
  79. query_absolute_path = $(addprefix $(DEPS_DIR)/,$(call query_name,$(1)))
  80. # Deprecated legacy query functions.
  81. dep_fetch = $(call query_fetch_method,$(1))
  82. dep_name = $(call query_name,$(1))
  83. dep_repo = $(call query_repo_git,$(1))
  84. dep_commit = $(if $(dep_$(1)_commit),$(dep_$(1)_commit),$(if $(dep_$(1)),$(if $(filter hex,$(word 1,$(dep_$(1)))),$(word 2,$(dep_$(1))),$(word 3,$(dep_$(1)))),$(pkg_$(1)_commit)))
  85. LOCAL_DEPS_DIRS = $(foreach a,$(LOCAL_DEPS),$(if $(wildcard $(APPS_DIR)/$(a)),$(APPS_DIR)/$(a)))
  86. ALL_DEPS_DIRS = $(addprefix $(DEPS_DIR)/,$(foreach dep,$(filter-out $(IGNORE_DEPS),$(BUILD_DEPS) $(DEPS)),$(call dep_name,$(dep))))
  87. # When we are calling an app directly we don't want to include it here
  88. # otherwise it'll be treated both as an apps and a top-level project.
  89. ALL_APPS_DIRS = $(if $(wildcard $(APPS_DIR)/),$(filter-out $(APPS_DIR),$(shell find $(APPS_DIR) -maxdepth 1 -type d)))
  90. ifdef ROOT_DIR
  91. ifndef IS_APP
  92. ALL_APPS_DIRS := $(filter-out $(APPS_DIR)/$(notdir $(CURDIR)),$(ALL_APPS_DIRS))
  93. endif
  94. endif
  95. ifeq ($(filter $(APPS_DIR) $(DEPS_DIR),$(subst :, ,$(ERL_LIBS))),)
  96. ifeq ($(ERL_LIBS),)
  97. ERL_LIBS = $(APPS_DIR):$(DEPS_DIR)
  98. else
  99. ERL_LIBS := $(ERL_LIBS):$(APPS_DIR):$(DEPS_DIR)
  100. endif
  101. endif
  102. export ERL_LIBS
  103. export NO_AUTOPATCH
  104. # Verbosity.
  105. dep_verbose_0 = @echo " DEP $1 ($(call dep_commit,$1))";
  106. dep_verbose_2 = set -x;
  107. dep_verbose = $(dep_verbose_$(V))
  108. # Optimization: don't recompile deps unless truly necessary.
  109. ifndef IS_DEP
  110. ifneq ($(MAKELEVEL),0)
  111. $(shell rm -f ebin/dep_built)
  112. endif
  113. endif
  114. # Core targets.
  115. ALL_APPS_DIRS_TO_BUILD = $(if $(LOCAL_DEPS_DIRS)$(IS_APP),$(LOCAL_DEPS_DIRS),$(ALL_APPS_DIRS))
  116. apps:: $(ALL_APPS_DIRS) clean-tmp-deps.log | $(ERLANG_MK_TMP)
  117. # Create ebin directory for all apps to make sure Erlang recognizes them
  118. # as proper OTP applications when using -include_lib. This is a temporary
  119. # fix, a proper fix would be to compile apps/* in the right order.
  120. ifndef IS_APP
  121. ifneq ($(ALL_APPS_DIRS),)
  122. $(verbose) set -e; for dep in $(ALL_APPS_DIRS) ; do \
  123. mkdir -p $$dep/ebin; \
  124. done
  125. endif
  126. endif
  127. # At the toplevel: if LOCAL_DEPS is defined with at least one local app, only
  128. # compile that list of apps. Otherwise, compile everything.
  129. # Within an app: compile all LOCAL_DEPS that are (uncompiled) local apps.
  130. ifneq ($(ALL_APPS_DIRS_TO_BUILD),)
  131. $(verbose) set -e; for dep in $(ALL_APPS_DIRS_TO_BUILD); do \
  132. if grep -qs ^$$dep$$ $(ERLANG_MK_TMP)/apps.log; then \
  133. :; \
  134. else \
  135. echo $$dep >> $(ERLANG_MK_TMP)/apps.log; \
  136. $(MAKE) -C $$dep $(if $(IS_TEST),test-build-app) IS_APP=1; \
  137. fi \
  138. done
  139. endif
  140. clean-tmp-deps.log:
  141. ifeq ($(IS_APP)$(IS_DEP),)
  142. $(verbose) rm -f $(ERLANG_MK_TMP)/apps.log $(ERLANG_MK_TMP)/deps.log
  143. endif
  144. # Erlang.mk does not rebuild dependencies after they were compiled
  145. # once. If a developer is working on the top-level project and some
  146. # dependencies at the same time, he may want to change this behavior.
  147. # There are two solutions:
  148. # 1. Set `FULL=1` so that all dependencies are visited and
  149. # recursively recompiled if necessary.
  150. # 2. Set `FORCE_REBUILD=` to the specific list of dependencies that
  151. # should be recompiled (instead of the whole set).
  152. FORCE_REBUILD ?=
  153. ifeq ($(origin FULL),undefined)
  154. ifneq ($(strip $(force_rebuild_dep)$(FORCE_REBUILD)),)
  155. define force_rebuild_dep
  156. echo "$(FORCE_REBUILD)" | grep -qw "$$(basename "$1")"
  157. endef
  158. endif
  159. endif
  160. ifneq ($(SKIP_DEPS),)
  161. deps::
  162. else
  163. deps:: $(ALL_DEPS_DIRS) apps clean-tmp-deps.log | $(ERLANG_MK_TMP)
  164. ifneq ($(ALL_DEPS_DIRS),)
  165. $(verbose) set -e; for dep in $(ALL_DEPS_DIRS); do \
  166. if grep -qs ^$$dep$$ $(ERLANG_MK_TMP)/deps.log; then \
  167. :; \
  168. else \
  169. echo $$dep >> $(ERLANG_MK_TMP)/deps.log; \
  170. if [ -z "$(strip $(FULL))" ] $(if $(force_rebuild_dep),&& ! ($(call force_rebuild_dep,$$dep)),) && [ ! -L $$dep ] && [ -f $$dep/ebin/dep_built ]; then \
  171. :; \
  172. elif [ "$$dep" = "$(DEPS_DIR)/hut" -a "$(HUT_PATCH)" ]; then \
  173. $(MAKE) -C $$dep app IS_DEP=1; \
  174. if [ ! -L $$dep ] && [ -d $$dep/ebin ]; then touch $$dep/ebin/dep_built; fi; \
  175. elif [ -f $$dep/GNUmakefile ] || [ -f $$dep/makefile ] || [ -f $$dep/Makefile ]; then \
  176. $(MAKE) -C $$dep IS_DEP=1; \
  177. if [ ! -L $$dep ] && [ -d $$dep/ebin ]; then touch $$dep/ebin/dep_built; fi; \
  178. else \
  179. echo "Error: No Makefile to build dependency $$dep." >&2; \
  180. exit 2; \
  181. fi \
  182. fi \
  183. done
  184. endif
  185. endif
  186. # Deps related targets.
  187. # @todo rename GNUmakefile and makefile into Makefile first, if they exist
  188. # While Makefile file could be GNUmakefile or makefile,
  189. # in practice only Makefile is needed so far.
  190. define dep_autopatch
  191. if [ -f $(DEPS_DIR)/$(1)/erlang.mk ]; then \
  192. rm -rf $(DEPS_DIR)/$1/ebin/; \
  193. $(call erlang,$(call dep_autopatch_appsrc.erl,$(1))); \
  194. $(call dep_autopatch_erlang_mk,$(1)); \
  195. elif [ -f $(DEPS_DIR)/$(1)/Makefile ]; then \
  196. if [ -f $(DEPS_DIR)/$1/rebar.lock ]; then \
  197. $(call dep_autopatch2,$1); \
  198. elif [ 0 != `grep -c "include ../\w*\.mk" $(DEPS_DIR)/$(1)/Makefile` ]; then \
  199. $(call dep_autopatch2,$(1)); \
  200. elif [ 0 != `grep -ci "^[^#].*rebar" $(DEPS_DIR)/$(1)/Makefile` ]; then \
  201. $(call dep_autopatch2,$(1)); \
  202. elif [ -n "`find $(DEPS_DIR)/$(1)/ -type f -name \*.mk -not -name erlang.mk -exec grep -i "^[^#].*rebar" '{}' \;`" ]; then \
  203. $(call dep_autopatch2,$(1)); \
  204. fi \
  205. else \
  206. if [ ! -d $(DEPS_DIR)/$(1)/src/ ]; then \
  207. $(call dep_autopatch_noop,$(1)); \
  208. else \
  209. $(call dep_autopatch2,$(1)); \
  210. fi \
  211. fi
  212. endef
  213. define dep_autopatch2
  214. ! test -f $(DEPS_DIR)/$1/ebin/$1.app || \
  215. mv -n $(DEPS_DIR)/$1/ebin/$1.app $(DEPS_DIR)/$1/src/$1.app.src; \
  216. rm -f $(DEPS_DIR)/$1/ebin/$1.app; \
  217. if [ -f $(DEPS_DIR)/$1/src/$1.app.src.script ]; then \
  218. $(call erlang,$(call dep_autopatch_appsrc_script.erl,$(1))); \
  219. fi; \
  220. $(call erlang,$(call dep_autopatch_appsrc.erl,$(1))); \
  221. if [ -f $(DEPS_DIR)/$(1)/rebar -o -f $(DEPS_DIR)/$(1)/rebar.config -o -f $(DEPS_DIR)/$(1)/rebar.config.script -o -f $(DEPS_DIR)/$1/rebar.lock ]; then \
  222. $(call dep_autopatch_fetch_rebar); \
  223. $(call dep_autopatch_rebar,$(1)); \
  224. else \
  225. $(call dep_autopatch_gen,$(1)); \
  226. fi
  227. endef
  228. define dep_autopatch_noop
  229. printf "noop:\n" > $(DEPS_DIR)/$(1)/Makefile
  230. endef
  231. # Replace "include erlang.mk" with a line that will load the parent Erlang.mk
  232. # if given. Do it for all 3 possible Makefile file names.
  233. ifeq ($(NO_AUTOPATCH_ERLANG_MK),)
  234. define dep_autopatch_erlang_mk
  235. for f in Makefile makefile GNUmakefile; do \
  236. if [ -f $(DEPS_DIR)/$1/$$f ]; then \
  237. sed -i.bak s/'include *erlang.mk'/'include $$(if $$(ERLANG_MK_FILENAME),$$(ERLANG_MK_FILENAME),erlang.mk)'/ $(DEPS_DIR)/$1/$$f; \
  238. fi \
  239. done
  240. endef
  241. else
  242. define dep_autopatch_erlang_mk
  243. :
  244. endef
  245. endif
  246. define dep_autopatch_gen
  247. printf "%s\n" \
  248. "ERLC_OPTS = +debug_info" \
  249. "include ../../erlang.mk" > $(DEPS_DIR)/$(1)/Makefile
  250. endef
  251. # We use flock/lockf when available to avoid concurrency issues.
  252. define dep_autopatch_fetch_rebar
  253. if command -v flock >/dev/null; then \
  254. flock $(ERLANG_MK_TMP)/rebar.lock sh -c "$(call dep_autopatch_fetch_rebar2)"; \
  255. elif command -v lockf >/dev/null; then \
  256. lockf $(ERLANG_MK_TMP)/rebar.lock sh -c "$(call dep_autopatch_fetch_rebar2)"; \
  257. else \
  258. $(call dep_autopatch_fetch_rebar2); \
  259. fi
  260. endef
  261. define dep_autopatch_fetch_rebar2
  262. if [ ! -d $(ERLANG_MK_TMP)/rebar3 ]; then \
  263. git clone -q -n -- $(REBAR3_GIT) $(ERLANG_MK_TMP)/rebar3; \
  264. cd $(ERLANG_MK_TMP)/rebar3; \
  265. git checkout -q $(REBAR3_COMMIT); \
  266. ./bootstrap; \
  267. cd -; \
  268. fi
  269. endef
  270. define dep_autopatch_rebar
  271. if [ -f $(DEPS_DIR)/$(1)/Makefile ]; then \
  272. mv $(DEPS_DIR)/$(1)/Makefile $(DEPS_DIR)/$(1)/Makefile.orig.mk; \
  273. fi; \
  274. $(call erlang,$(call dep_autopatch_rebar.erl,$(1))); \
  275. rm -f $(DEPS_DIR)/$(1)/ebin/$(1).app
  276. endef
  277. define dep_autopatch_rebar.erl
  278. application:load(rebar),
  279. application:set_env(rebar, log_level, debug),
  280. {module, rebar3} = c:l(rebar3),
  281. Conf1 = case file:consult("$(call core_native_path,$(DEPS_DIR)/$1/rebar.config)") of
  282. {ok, Conf0} -> Conf0;
  283. _ -> []
  284. end,
  285. {Conf, OsEnv} = fun() ->
  286. case filelib:is_file("$(call core_native_path,$(DEPS_DIR)/$1/rebar.config.script)") of
  287. false -> {Conf1, []};
  288. true ->
  289. Bindings0 = erl_eval:new_bindings(),
  290. Bindings1 = erl_eval:add_binding('CONFIG', Conf1, Bindings0),
  291. Bindings = erl_eval:add_binding('SCRIPT', "$(call core_native_path,$(DEPS_DIR)/$1/rebar.config.script)", Bindings1),
  292. Before = os:getenv(),
  293. {ok, Conf2} = file:script("$(call core_native_path,$(DEPS_DIR)/$1/rebar.config.script)", Bindings),
  294. {Conf2, lists:foldl(fun(E, Acc) -> lists:delete(E, Acc) end, os:getenv(), Before)}
  295. end
  296. end(),
  297. Write = fun (Text) ->
  298. file:write_file("$(call core_native_path,$(DEPS_DIR)/$1/Makefile)", Text, [append])
  299. end,
  300. Escape = fun (Text) ->
  301. re:replace(Text, "\\\\$$", "\$$$$", [global, {return, list}])
  302. end,
  303. Write("IGNORE_DEPS += edown eper eunit_formatters meck node_package "
  304. "rebar_lock_deps_plugin rebar_vsn_plugin reltool_util\n"),
  305. Write("C_SRC_DIR = /path/do/not/exist\n"),
  306. Write("C_SRC_TYPE = rebar\n"),
  307. Write("DRV_CFLAGS = -fPIC\nexport DRV_CFLAGS\n"),
  308. Write(["ERLANG_ARCH = ", rebar_utils:wordsize(), "\nexport ERLANG_ARCH\n"]),
  309. ToList = fun
  310. (V) when is_atom(V) -> atom_to_list(V);
  311. (V) when is_list(V) -> "'\\"" ++ V ++ "\\"'"
  312. end,
  313. fun() ->
  314. Write("ERLC_OPTS = +debug_info\n"),
  315. case lists:keyfind(erl_opts, 1, Conf) of
  316. false -> ok;
  317. {_, ErlOpts} ->
  318. lists:foreach(fun
  319. ({d, D}) ->
  320. Write("ERLC_OPTS += -D" ++ ToList(D) ++ "=1\n");
  321. ({d, DKey, DVal}) ->
  322. Write("ERLC_OPTS += -D" ++ ToList(DKey) ++ "=" ++ ToList(DVal) ++ "\n");
  323. ({i, I}) ->
  324. Write(["ERLC_OPTS += -I ", I, "\n"]);
  325. ({platform_define, Regex, D}) ->
  326. case rebar_utils:is_arch(Regex) of
  327. true -> Write("ERLC_OPTS += -D" ++ ToList(D) ++ "=1\n");
  328. false -> ok
  329. end;
  330. ({parse_transform, PT}) ->
  331. Write("ERLC_OPTS += +'{parse_transform, " ++ ToList(PT) ++ "}'\n");
  332. (_) -> ok
  333. end, ErlOpts)
  334. end,
  335. Write("\n")
  336. end(),
  337. GetHexVsn2 = fun(N, NP) ->
  338. case file:consult("$(call core_native_path,$(DEPS_DIR)/$1/rebar.lock)") of
  339. {ok, Lock} ->
  340. io:format("~p~n", [Lock]),
  341. LockPkgs = case lists:keyfind("1.2.0", 1, Lock) of
  342. {_, LP} ->
  343. LP;
  344. _ ->
  345. case lists:keyfind("1.1.0", 1, Lock) of
  346. {_, LP} ->
  347. LP;
  348. _ ->
  349. false
  350. end
  351. end,
  352. if
  353. is_list(LockPkgs) ->
  354. io:format("~p~n", [LockPkgs]),
  355. case lists:keyfind(atom_to_binary(N, latin1), 1, LockPkgs) of
  356. {_, {pkg, _, Vsn}, _} ->
  357. io:format("~p~n", [Vsn]),
  358. {N, {hex, NP, binary_to_list(Vsn)}};
  359. _ ->
  360. false
  361. end;
  362. true ->
  363. false
  364. end;
  365. _ ->
  366. false
  367. end
  368. end,
  369. GetHexVsn3Common = fun(N, NP, S0) ->
  370. case GetHexVsn2(N, NP) of
  371. false ->
  372. S2 = case S0 of
  373. " " ++ S1 -> S1;
  374. _ -> S0
  375. end,
  376. S = case length([ok || $$. <- S2]) of
  377. 0 -> S2 ++ ".0.0";
  378. 1 -> S2 ++ ".0";
  379. _ -> S2
  380. end,
  381. {N, {hex, NP, S}};
  382. NameSource ->
  383. NameSource
  384. end
  385. end,
  386. GetHexVsn3 = fun
  387. (N, NP, "~>" ++ S0) ->
  388. GetHexVsn3Common(N, NP, S0);
  389. (N, NP, ">=" ++ S0) ->
  390. GetHexVsn3Common(N, NP, S0);
  391. (N, NP, S) -> {N, {hex, NP, S}}
  392. end,
  393. fun() ->
  394. File = case lists:keyfind(deps, 1, Conf) of
  395. false -> [];
  396. {_, Deps} ->
  397. [begin case case Dep of
  398. N when is_atom(N) -> GetHexVsn2(N, N);
  399. {N, S} when is_atom(N), is_list(S) -> GetHexVsn3(N, N, S);
  400. {N, {pkg, NP}} when is_atom(N) -> GetHexVsn2(N, NP);
  401. {N, S, {pkg, NP}} -> GetHexVsn3(N, NP, S);
  402. {N, S} when is_tuple(S) -> {N, S};
  403. {N, _, S} -> {N, S};
  404. {N, _, S, _} -> {N, S};
  405. _ -> false
  406. end of
  407. false -> ok;
  408. {Name, Source} ->
  409. {Method, Repo, Commit} = case Source of
  410. {hex, NPV, V} -> {hex, V, NPV};
  411. {git, R} -> {git, R, master};
  412. {M, R, {branch, C}} -> {M, R, C};
  413. {M, R, {ref, C}} -> {M, R, C};
  414. {M, R, {tag, C}} -> {M, R, C};
  415. {M, R, C} -> {M, R, C}
  416. end,
  417. Write(io_lib:format("DEPS += ~s\ndep_~s = ~s ~s ~s~n", [Name, Name, Method, Repo, Commit]))
  418. end end || Dep <- Deps]
  419. end
  420. end(),
  421. fun() ->
  422. case lists:keyfind(erl_first_files, 1, Conf) of
  423. false -> ok;
  424. {_, Files0} ->
  425. Files = [begin
  426. hd(filelib:wildcard("$(call core_native_path,$(DEPS_DIR)/$1/src/**/" ++ filename:rootname(F) ++ ".*rl")))
  427. end || "src/" ++ F <- Files0],
  428. Names = [[" ", case lists:reverse(F) of
  429. "lre." ++ Elif -> lists:reverse(Elif);
  430. "lrx." ++ Elif -> lists:reverse(Elif);
  431. "lry." ++ Elif -> lists:reverse(Elif);
  432. Elif -> lists:reverse(Elif)
  433. end] || "$(call core_native_path,$(DEPS_DIR)/$1/src/)" ++ F <- Files],
  434. Write(io_lib:format("COMPILE_FIRST +=~s\n", [Names]))
  435. end
  436. end(),
  437. Write("\n\nrebar_dep: preprocess pre-deps deps pre-app app\n"),
  438. Write("\npreprocess::\n"),
  439. Write("\npre-deps::\n"),
  440. Write("\npre-app::\n"),
  441. PatchHook = fun(Cmd) ->
  442. Cmd2 = re:replace(Cmd, "^([g]?make)(.*)( -C.*)", "\\\\1\\\\3\\\\2", [{return, list}]),
  443. case Cmd2 of
  444. "make -C" ++ Cmd1 -> "$$\(MAKE) -C" ++ Escape(Cmd1);
  445. "gmake -C" ++ Cmd1 -> "$$\(MAKE) -C" ++ Escape(Cmd1);
  446. "make " ++ Cmd1 -> "$$\(MAKE) -f Makefile.orig.mk " ++ Escape(Cmd1);
  447. "gmake " ++ Cmd1 -> "$$\(MAKE) -f Makefile.orig.mk " ++ Escape(Cmd1);
  448. _ -> Escape(Cmd)
  449. end
  450. end,
  451. fun() ->
  452. case lists:keyfind(pre_hooks, 1, Conf) of
  453. false -> ok;
  454. {_, Hooks} ->
  455. [case H of
  456. {'get-deps', Cmd} ->
  457. Write("\npre-deps::\n\t" ++ PatchHook(Cmd) ++ "\n");
  458. {compile, Cmd} ->
  459. Write("\npre-app::\n\tCC=$$\(CC) " ++ PatchHook(Cmd) ++ "\n");
  460. {{pc, compile}, Cmd} ->
  461. Write("\npre-app::\n\tCC=$$\(CC) " ++ PatchHook(Cmd) ++ "\n");
  462. {Regex, compile, Cmd} ->
  463. case rebar_utils:is_arch(Regex) of
  464. true -> Write("\npre-app::\n\tCC=$$\(CC) " ++ PatchHook(Cmd) ++ "\n");
  465. false -> ok
  466. end;
  467. _ -> ok
  468. end || H <- Hooks]
  469. end
  470. end(),
  471. ShellToMk = fun(V0) ->
  472. V1 = re:replace(V0, "[$$][(]", "$$\(shell ", [global]),
  473. V = re:replace(V1, "([$$])(?![(])(\\\\w*)", "\\\\1(\\\\2)", [global]),
  474. re:replace(V, "-Werror\\\\b", "", [{return, list}, global])
  475. end,
  476. PortSpecs = fun() ->
  477. case lists:keyfind(port_specs, 1, Conf) of
  478. false ->
  479. case filelib:is_dir("$(call core_native_path,$(DEPS_DIR)/$1/c_src)") of
  480. false -> [];
  481. true ->
  482. [{"priv/" ++ proplists:get_value(so_name, Conf, "$(1)_drv.so"),
  483. proplists:get_value(port_sources, Conf, ["c_src/*.c"]), []}]
  484. end;
  485. {_, Specs} ->
  486. lists:flatten([case S of
  487. {Output, Input} -> {ShellToMk(Output), Input, []};
  488. {Regex, Output, Input} ->
  489. case rebar_utils:is_arch(Regex) of
  490. true -> {ShellToMk(Output), Input, []};
  491. false -> []
  492. end;
  493. {Regex, Output, Input, [{env, Env}]} ->
  494. case rebar_utils:is_arch(Regex) of
  495. true -> {ShellToMk(Output), Input, Env};
  496. false -> []
  497. end
  498. end || S <- Specs])
  499. end
  500. end(),
  501. PortSpecWrite = fun (Text) ->
  502. file:write_file("$(call core_native_path,$(DEPS_DIR)/$1/c_src/Makefile.erlang.mk)", Text, [append])
  503. end,
  504. case PortSpecs of
  505. [] -> ok;
  506. _ ->
  507. Write("\npre-app::\n\t@$$\(MAKE) --no-print-directory -f c_src/Makefile.erlang.mk\n"),
  508. PortSpecWrite(io_lib:format("ERL_CFLAGS ?= -finline-functions -Wall -fPIC -I \\"~s/erts-~s/include\\" -I \\"~s\\"\n",
  509. [code:root_dir(), erlang:system_info(version), code:lib_dir(erl_interface, include)])),
  510. PortSpecWrite(io_lib:format("ERL_LDFLAGS ?= -L \\"~s\\" -lei\n",
  511. [code:lib_dir(erl_interface, lib)])),
  512. [PortSpecWrite(["\n", E, "\n"]) || E <- OsEnv],
  513. FilterEnv = fun(Env) ->
  514. lists:flatten([case E of
  515. {_, _} -> E;
  516. {Regex, K, V} ->
  517. case rebar_utils:is_arch(Regex) of
  518. true -> {K, V};
  519. false -> []
  520. end
  521. end || E <- Env])
  522. end,
  523. MergeEnv = fun(Env) ->
  524. lists:foldl(fun ({K, V}, Acc) ->
  525. case lists:keyfind(K, 1, Acc) of
  526. false -> [{K, rebar_utils:expand_env_variable(V, K, "")}|Acc];
  527. {_, V0} -> [{K, rebar_utils:expand_env_variable(V, K, V0)}|Acc]
  528. end
  529. end, [], Env)
  530. end,
  531. PortEnv = case lists:keyfind(port_env, 1, Conf) of
  532. false -> [];
  533. {_, PortEnv0} -> FilterEnv(PortEnv0)
  534. end,
  535. PortSpec = fun ({Output, Input0, Env}) ->
  536. filelib:ensure_dir("$(call core_native_path,$(DEPS_DIR)/$1/)" ++ Output),
  537. Input = [[" ", I] || I <- Input0],
  538. PortSpecWrite([
  539. [["\n", K, " = ", ShellToMk(V)] || {K, V} <- lists:reverse(MergeEnv(PortEnv))],
  540. case $(PLATFORM) of
  541. darwin -> "\n\nLDFLAGS += -flat_namespace -undefined suppress";
  542. _ -> ""
  543. end,
  544. "\n\nall:: ", Output, "\n\t@:\n\n",
  545. "%.o: %.c\n\t$$\(CC) -c -o $$\@ $$\< $$\(CFLAGS) $$\(ERL_CFLAGS) $$\(DRV_CFLAGS) $$\(EXE_CFLAGS)\n\n",
  546. "%.o: %.C\n\t$$\(CXX) -c -o $$\@ $$\< $$\(CXXFLAGS) $$\(ERL_CFLAGS) $$\(DRV_CFLAGS) $$\(EXE_CFLAGS)\n\n",
  547. "%.o: %.cc\n\t$$\(CXX) -c -o $$\@ $$\< $$\(CXXFLAGS) $$\(ERL_CFLAGS) $$\(DRV_CFLAGS) $$\(EXE_CFLAGS)\n\n",
  548. "%.o: %.cpp\n\t$$\(CXX) -c -o $$\@ $$\< $$\(CXXFLAGS) $$\(ERL_CFLAGS) $$\(DRV_CFLAGS) $$\(EXE_CFLAGS)\n\n",
  549. [[Output, ": ", K, " += ", ShellToMk(V), "\n"] || {K, V} <- lists:reverse(MergeEnv(FilterEnv(Env)))],
  550. Output, ": $$\(foreach ext,.c .C .cc .cpp,",
  551. "$$\(patsubst %$$\(ext),%.o,$$\(filter %$$\(ext),$$\(wildcard", Input, "))))\n",
  552. "\t$$\(CC) -o $$\@ $$\? $$\(LDFLAGS) $$\(ERL_LDFLAGS) $$\(DRV_LDFLAGS) $$\(LDLIBS) $$\(EXE_LDFLAGS)",
  553. case {filename:extension(Output), $(PLATFORM)} of
  554. {[], _} -> "\n";
  555. {".so", darwin} -> "-shared\n";
  556. {".dylib", darwin} -> "-shared\n";
  557. {_, darwin} -> "\n";
  558. _ -> " -shared\n"
  559. end])
  560. end,
  561. [PortSpec(S) || S <- PortSpecs]
  562. end,
  563. fun() ->
  564. case lists:keyfind(plugins, 1, Conf) of
  565. false -> ok;
  566. {_, Plugins0} ->
  567. Plugins = [P || P <- Plugins0, is_tuple(P)],
  568. case lists:keyfind('lfe-compile', 1, Plugins) of
  569. false -> ok;
  570. _ -> Write("\nBUILD_DEPS = lfe lfe.mk\ndep_lfe.mk = git https://github.com/ninenines/lfe.mk master\nDEP_PLUGINS = lfe.mk\n")
  571. end
  572. end
  573. end(),
  574. Write("\ninclude $$\(if $$\(ERLANG_MK_FILENAME),$$\(ERLANG_MK_FILENAME),erlang.mk)"),
  575. RunPlugin = fun(Plugin, Step) ->
  576. case erlang:function_exported(Plugin, Step, 2) of
  577. false -> ok;
  578. true ->
  579. c:cd("$(call core_native_path,$(DEPS_DIR)/$1/)"),
  580. Ret = Plugin:Step({config, "", Conf, dict:new(), dict:new(), dict:new(),
  581. dict:store(base_dir, "", dict:new())}, undefined),
  582. io:format("rebar plugin ~p step ~p ret ~p~n", [Plugin, Step, Ret])
  583. end
  584. end,
  585. fun() ->
  586. case lists:keyfind(plugins, 1, Conf) of
  587. false -> ok;
  588. {_, Plugins0} ->
  589. Plugins = [P || P <- Plugins0, is_atom(P)],
  590. [begin
  591. case lists:keyfind(deps, 1, Conf) of
  592. false -> ok;
  593. {_, Deps} ->
  594. case lists:keyfind(P, 1, Deps) of
  595. false -> ok;
  596. _ ->
  597. Path = "$(call core_native_path,$(DEPS_DIR)/)" ++ atom_to_list(P),
  598. io:format("~s", [os:cmd("$(MAKE) -C $(call core_native_path,$(DEPS_DIR)/$1) " ++ Path)]),
  599. io:format("~s", [os:cmd("$(MAKE) -C " ++ Path ++ " IS_DEP=1")]),
  600. code:add_patha(Path ++ "/ebin")
  601. end
  602. end
  603. end || P <- Plugins],
  604. [case code:load_file(P) of
  605. {module, P} -> ok;
  606. _ ->
  607. case lists:keyfind(plugin_dir, 1, Conf) of
  608. false -> ok;
  609. {_, PluginsDir} ->
  610. ErlFile = "$(call core_native_path,$(DEPS_DIR)/$1/)" ++ PluginsDir ++ "/" ++ atom_to_list(P) ++ ".erl",
  611. {ok, P, Bin} = compile:file(ErlFile, [binary]),
  612. {module, P} = code:load_binary(P, ErlFile, Bin)
  613. end
  614. end || P <- Plugins],
  615. [RunPlugin(P, preprocess) || P <- Plugins],
  616. [RunPlugin(P, pre_compile) || P <- Plugins],
  617. [RunPlugin(P, compile) || P <- Plugins]
  618. end
  619. end(),
  620. halt()
  621. endef
  622. define dep_autopatch_appsrc_script.erl
  623. AppSrc = "$(call core_native_path,$(DEPS_DIR)/$1/src/$1.app.src)",
  624. AppSrcScript = AppSrc ++ ".script",
  625. Conf1 = case file:consult(AppSrc) of
  626. {ok, Conf0} -> Conf0;
  627. {error, enoent} -> []
  628. end,
  629. Bindings0 = erl_eval:new_bindings(),
  630. Bindings1 = erl_eval:add_binding('CONFIG', Conf1, Bindings0),
  631. Bindings = erl_eval:add_binding('SCRIPT', AppSrcScript, Bindings1),
  632. Conf = case file:script(AppSrcScript, Bindings) of
  633. {ok, [C]} -> C;
  634. {ok, C} -> C
  635. end,
  636. ok = file:write_file(AppSrc, io_lib:format("~p.~n", [Conf])),
  637. halt()
  638. endef
  639. define dep_autopatch_appsrc.erl
  640. AppSrcOut = "$(call core_native_path,$(DEPS_DIR)/$1/src/$1.app.src)",
  641. AppSrcIn = case filelib:is_regular(AppSrcOut) of false -> "$(call core_native_path,$(DEPS_DIR)/$1/ebin/$1.app)"; true -> AppSrcOut end,
  642. case filelib:is_regular(AppSrcIn) of
  643. false -> ok;
  644. true ->
  645. {ok, [{application, $(1), L0}]} = file:consult(AppSrcIn),
  646. L1 = lists:keystore(modules, 1, L0, {modules, []}),
  647. L2 = case lists:keyfind(vsn, 1, L1) of
  648. {_, git} -> lists:keyreplace(vsn, 1, L1, {vsn, lists:droplast(os:cmd("git -C $(DEPS_DIR)/$1 describe --dirty --tags --always"))});
  649. {_, {cmd, _}} -> lists:keyreplace(vsn, 1, L1, {vsn, "cmd"});
  650. _ -> L1
  651. end,
  652. L3 = case lists:keyfind(registered, 1, L2) of false -> [{registered, []}|L2]; _ -> L2 end,
  653. ok = file:write_file(AppSrcOut, io_lib:format("~p.~n", [{application, $(1), L3}])),
  654. case AppSrcOut of AppSrcIn -> ok; _ -> ok = file:delete(AppSrcIn) end
  655. end,
  656. halt()
  657. endef
  658. ifeq ($(CACHE_DEPS),1)
  659. define dep_cache_fetch_git
  660. mkdir -p $(CACHE_DIR)/git; \
  661. if test -d "$(join $(CACHE_DIR)/git/,$(call dep_name,$1))"; then \
  662. cd $(join $(CACHE_DIR)/git/,$(call dep_name,$1)); \
  663. if ! git checkout -q $(call dep_commit,$1); then \
  664. git remote set-url origin $(call dep_repo,$1) && \
  665. git pull --all && \
  666. git cat-file -e $(call dep_commit,$1) 2>/dev/null; \
  667. fi; \
  668. else \
  669. git clone -q -n -- $(call dep_repo,$1) $(join $(CACHE_DIR)/git/,$(call dep_name,$1)); \
  670. fi; \
  671. git clone -q --branch $(call dep_commit,$1) --single-branch -- $(join $(CACHE_DIR)/git/,$(call dep_name,$1)) $2
  672. endef
  673. define dep_fetch_git
  674. $(call dep_cache_fetch_git,$1,$(DEPS_DIR)/$(call dep_name,$1));
  675. endef
  676. define dep_fetch_git-subfolder
  677. mkdir -p $(ERLANG_MK_TMP)/git-subfolder; \
  678. $(call dep_cache_fetch_git,$1,$(ERLANG_MK_TMP)/git-subfolder/$(call dep_name,$1)); \
  679. ln -s $(ERLANG_MK_TMP)/git-subfolder/$(call dep_name,$1)/$(word 4,$(dep_$1)) \
  680. $(DEPS_DIR)/$(call dep_name,$1);
  681. endef
  682. else
  683. define dep_fetch_git
  684. git clone -q -n -- $(call dep_repo,$1) $(DEPS_DIR)/$(call dep_name,$1); \
  685. cd $(DEPS_DIR)/$(call dep_name,$1) && git checkout -q $(call dep_commit,$1);
  686. endef
  687. define dep_fetch_git-subfolder
  688. mkdir -p $(ERLANG_MK_TMP)/git-subfolder; \
  689. git clone -q -n -- $(call dep_repo,$1) \
  690. $(ERLANG_MK_TMP)/git-subfolder/$(call dep_name,$1); \
  691. cd $(ERLANG_MK_TMP)/git-subfolder/$(call dep_name,$1) \
  692. && git checkout -q $(call dep_commit,$1); \
  693. ln -s $(ERLANG_MK_TMP)/git-subfolder/$(call dep_name,$1)/$(word 4,$(dep_$1)) \
  694. $(DEPS_DIR)/$(call dep_name,$1);
  695. endef
  696. endif
  697. define dep_fetch_git-submodule
  698. git submodule update --init -- $(DEPS_DIR)/$1;
  699. endef
  700. define dep_fetch_hg
  701. hg clone -q -U $(call dep_repo,$(1)) $(DEPS_DIR)/$(call dep_name,$(1)); \
  702. cd $(DEPS_DIR)/$(call dep_name,$(1)) && hg update -q $(call dep_commit,$(1));
  703. endef
  704. define dep_fetch_svn
  705. svn checkout -q $(call dep_repo,$(1)) $(DEPS_DIR)/$(call dep_name,$(1));
  706. endef
  707. define dep_fetch_cp
  708. cp -R $(call dep_repo,$(1)) $(DEPS_DIR)/$(call dep_name,$(1));
  709. endef
  710. define dep_fetch_ln
  711. ln -s $(call dep_repo,$(1)) $(DEPS_DIR)/$(call dep_name,$(1));
  712. endef
  713. ifeq ($(CACHE_DEPS),1)
  714. # Hex only has a package version. No need to look in the Erlang.mk packages.
  715. define dep_fetch_hex
  716. mkdir -p $(CACHE_DIR)/hex $(DEPS_DIR)/$1; \
  717. $(eval hex_tar_name=$(if $(word 3,$(dep_$1)),$(word 3,$(dep_$1)),$1)-$(strip $(word 2,$(dep_$1))).tar) \
  718. $(if $(wildcard $(CACHE_DIR)/hex/$(hex_tar_name)),,$(call core_http_get,$(CACHE_DIR)/hex/$(hex_tar_name),\
  719. https://repo.hex.pm/tarballs/$(hex_tar_name);)) \
  720. tar -xOf $(CACHE_DIR)/hex/$(hex_tar_name) contents.tar.gz | tar -C $(DEPS_DIR)/$1 -xzf -;
  721. endef
  722. else
  723. # Hex only has a package version. No need to look in the Erlang.mk packages.
  724. define dep_fetch_hex
  725. mkdir -p $(ERLANG_MK_TMP)/hex $(DEPS_DIR)/$1; \
  726. $(call core_http_get,$(ERLANG_MK_TMP)/hex/$1.tar,\
  727. https://repo.hex.pm/tarballs/$(if $(word 3,$(dep_$1)),$(word 3,$(dep_$1)),$1)-$(strip $(word 2,$(dep_$1))).tar); \
  728. tar -xOf $(ERLANG_MK_TMP)/hex/$1.tar contents.tar.gz | tar -C $(DEPS_DIR)/$1 -xzf -;
  729. endef
  730. endif
  731. define dep_fetch_fail
  732. echo "Error: Unknown or invalid dependency: $(1)." >&2; \
  733. exit 78;
  734. endef
  735. # Kept for compatibility purposes with older Erlang.mk configuration.
  736. define dep_fetch_legacy
  737. $(warning WARNING: '$(1)' dependency configuration uses deprecated format.) \
  738. git clone -q -n -- $(word 1,$(dep_$(1))) $(DEPS_DIR)/$(1); \
  739. cd $(DEPS_DIR)/$(1) && git checkout -q $(if $(word 2,$(dep_$(1))),$(word 2,$(dep_$(1))),master);
  740. endef
  741. define dep_target
  742. $(DEPS_DIR)/$(call dep_name,$1): | $(ERLANG_MK_TMP)
  743. $(eval DEP_NAME := $(call dep_name,$1))
  744. $(eval DEP_STR := $(if $(filter $1,$(DEP_NAME)),$1,"$1 ($(DEP_NAME))"))
  745. $(verbose) if test -d $(APPS_DIR)/$(DEP_NAME); then \
  746. echo "Error: Dependency" $(DEP_STR) "conflicts with application found in $(APPS_DIR)/$(DEP_NAME)." >&2; \
  747. exit 17; \
  748. fi
  749. $(verbose) mkdir -p $(DEPS_DIR)
  750. $(dep_verbose) $(call dep_fetch_$(strip $(call dep_fetch,$(1))),$(1))
  751. $(verbose) if [ -f $(DEPS_DIR)/$(1)/configure.ac -o -f $(DEPS_DIR)/$(1)/configure.in ] \
  752. && [ ! -f $(DEPS_DIR)/$(1)/configure ]; then \
  753. echo " AUTO " $(DEP_STR); \
  754. cd $(DEPS_DIR)/$(1) && autoreconf -Wall -vif -I m4; \
  755. fi
  756. - $(verbose) if [ -f $(DEPS_DIR)/$(DEP_NAME)/configure ]; then \
  757. echo " CONF " $(DEP_STR); \
  758. cd $(DEPS_DIR)/$(DEP_NAME) && ./configure; \
  759. fi
  760. ifeq ($(filter $(1),$(NO_AUTOPATCH)),)
  761. $(verbose) $$(MAKE) --no-print-directory autopatch-$(DEP_NAME)
  762. endif
  763. .PHONY: autopatch-$(call dep_name,$1)
  764. autopatch-$(call dep_name,$1)::
  765. if [ "$1" = "elixir" -a "$(ELIXIR_PATCH)" ]; then \
  766. ln -s lib/elixir/ebin $(DEPS_DIR)/elixir/; \
  767. else \
  768. $$(call dep_autopatch,$(call dep_name,$1)) \
  769. fi
  770. endef
  771. $(foreach dep,$(BUILD_DEPS) $(DEPS),$(eval $(call dep_target,$(dep))))
  772. ifndef IS_APP
  773. clean:: clean-apps
  774. clean-apps:
  775. $(verbose) set -e; for dep in $(ALL_APPS_DIRS) ; do \
  776. $(MAKE) -C $$dep clean IS_APP=1; \
  777. done
  778. distclean:: distclean-apps
  779. distclean-apps:
  780. $(verbose) set -e; for dep in $(ALL_APPS_DIRS) ; do \
  781. $(MAKE) -C $$dep distclean IS_APP=1; \
  782. done
  783. endif
  784. ifndef SKIP_DEPS
  785. distclean:: distclean-deps
  786. distclean-deps:
  787. $(gen_verbose) rm -rf $(DEPS_DIR)
  788. endif
  789. ifeq ($(CACHE_DEPS),1)
  790. cacheclean:: cacheclean-git cacheclean-hex
  791. cacheclean-git:
  792. $(gen_verbose) rm -rf $(CACHE_DIR)/git
  793. cacheclean-hex:
  794. $(gen_verbose) rm -rf $(CACHE_DIR)/hex
  795. endif
  796. # Forward-declare variables used in core/deps-tools.mk. This is required
  797. # in case plugins use them.
  798. ERLANG_MK_RECURSIVE_DEPS_LIST = $(ERLANG_MK_TMP)/recursive-deps-list.log
  799. ERLANG_MK_RECURSIVE_DOC_DEPS_LIST = $(ERLANG_MK_TMP)/recursive-doc-deps-list.log
  800. ERLANG_MK_RECURSIVE_REL_DEPS_LIST = $(ERLANG_MK_TMP)/recursive-rel-deps-list.log
  801. ERLANG_MK_RECURSIVE_TEST_DEPS_LIST = $(ERLANG_MK_TMP)/recursive-test-deps-list.log
  802. ERLANG_MK_RECURSIVE_SHELL_DEPS_LIST = $(ERLANG_MK_TMP)/recursive-shell-deps-list.log
  803. ERLANG_MK_QUERY_DEPS_FILE = $(ERLANG_MK_TMP)/query-deps.log
  804. ERLANG_MK_QUERY_DOC_DEPS_FILE = $(ERLANG_MK_TMP)/query-doc-deps.log
  805. ERLANG_MK_QUERY_REL_DEPS_FILE = $(ERLANG_MK_TMP)/query-rel-deps.log
  806. ERLANG_MK_QUERY_TEST_DEPS_FILE = $(ERLANG_MK_TMP)/query-test-deps.log
  807. ERLANG_MK_QUERY_SHELL_DEPS_FILE = $(ERLANG_MK_TMP)/query-shell-deps.log