diff options
Diffstat (limited to 'erlang.mk')
-rw-r--r-- | erlang.mk | 61 |
1 files changed, 52 insertions, 9 deletions
@@ -155,7 +155,8 @@ define dep_autopatch $(ERL) -eval " \ DepDir = \"$(DEPS_DIR)/$(1)/\", \ fun() -> \ - {ok, Conf} = file:consult(DepDir ++ \"rebar.config\"), \ + {ok, Conf} = case file:consult(DepDir ++ \"rebar.config\") of \ + {error, enoent} -> {ok, []}; Res -> Res end, \ File = case lists:keyfind(deps, 1, Conf) of false -> []; {_, Deps} -> \ [begin {Method, Repo, Commit} = case Repos of \ {git, R} -> {git, R, master}; \ @@ -166,7 +167,12 @@ fun() -> \ io_lib:format(\"DEPS += ~s\ndep_~s = ~s ~s ~s~n\", [Name, Name, Method, Repo, Commit]) \ end || {Name, _, Repos} <- Deps] \ end, \ - ok = file:write_file(\"$(DEPS_DIR)/$(1)/Makefile\", [\"ERLC_OPTS = +debug_info\n\n\", File, \"\ninclude erlang.mk\"]) \ + First = case lists:keyfind(erl_first_files, 1, Conf) of false -> []; {_, Files} -> \ + Names = [[\" \", begin \"lre.\" ++ R = lists:reverse(F), lists:reverse(R) end] \ + || \"src/\" ++ F <- Files], \ + io_lib:format(\"COMPILE_FIRST +=~s\n\", [Names]) \ + end, \ + ok = file:write_file(\"$(DEPS_DIR)/$(1)/Makefile\", [\"ERLC_OPTS = +debug_info\n\n\", File, First, \"\ninclude erlang.mk\"]) \ end(), \ AppSrcOut = \"$(DEPS_DIR)/$(1)/src/$(1).app.src\", \ AppSrcIn = case filelib:is_regular(AppSrcOut) of false -> \"$(DEPS_DIR)/$(1)/ebin/$(1).app\"; true -> AppSrcOut end, \ @@ -195,6 +201,8 @@ define dep_fetch cd $(DEPS_DIR)/$(1) && hg update -q $$$$COMMIT; \ elif [ "$$$$VS" = "svn" ]; then \ svn checkout $$$$REPO $(DEPS_DIR)/$(1); \ + elif [ "$$$$VS" = "cp" ]; then \ + cp -R $$$$REPO $(DEPS_DIR)/$(1); \ else \ echo "Unknown or invalid dependency: $(1). Please consult the erlang.mk README for instructions." >&2; \ exit 78; \ @@ -218,13 +226,9 @@ else $(call dep_fetch,$(1)) endif ifneq ($(filter $(1),$(AUTOPATCH)),) - $(call dep_autopatch_verbose,$(1)) if [ -f $(DEPS_DIR)/$(1)/rebar.config ]; then \ + $(call dep_autopatch_verbose,$(1)) \ $(call dep_autopatch,$(1)); \ - cd $(DEPS_DIR)/$(1)/ && ln -s ../../erlang.mk; \ - elif [ ! -f $(DEPS_DIR)/$(1)/Makefile ]; then \ - echo "ERLC_OPTS = +debug_info\ninclude erlang.mk" > $(DEPS_DIR)/$(1)/Makefile; \ - cd $(DEPS_DIR)/$(1)/ && ln -s ../../erlang.mk; \ - fi + cd $(DEPS_DIR)/$(1)/ && ln -s ../../erlang.mk endif endef @@ -1177,7 +1181,7 @@ RELX_CONFIG ?= $(CURDIR)/relx.config RELX ?= $(CURDIR)/relx export RELX -RELX_URL ?= https://github.com/erlware/relx/releases/download/v1.2.0/relx +RELX_URL ?= https://github.com/erlware/relx/releases/download/v1.3.1/relx RELX_OPTS ?= RELX_OUTPUT_DIR ?= _rel @@ -1274,3 +1278,42 @@ triq: test-build $(gen_verbose) $(call triq_run,[true] =:= lists:usort([triq:check(M) || M <- [$(MODULES)]])) endif endif + +# Copyright (c) 2015, Euen Lopez <[email protected]> +# This file is part of erlang.mk and subject to the terms of the ISC License. + +.PHONY: xref distclean-xref + +# Configuration. + +ifeq ($(XREF_CONFIG),) + XREF_ARGS := +else + XREF_ARGS := -c $(XREF_CONFIG) +endif + +XREFR ?= $(CURDIR)/xrefr +export XREFR + +XREFR_URL ?= https://github.com/inaka/xref_runner/releases/download/0.2.0/xrefr + +# Core targets. + +help:: + @printf "%s\n" "" \ + "Xref targets:" \ + " xref Run Xrefr using $XREF_CONFIG as config file if defined" + +distclean:: distclean-xref + +# Plugin-specific targets. + +$(XREFR): + @$(call core_http_get,$(XREFR),$(XREFR_URL)) + @chmod +x $(XREFR) + +xref: deps app $(XREFR) + $(gen_verbose) $(XREFR) $(XREFR_ARGS) + +distclean-xref: + $(gen_verbose) rm -rf $(XREFR) |