16
16
17
17
ERLANG_MK_FILENAME := $(realpath $(lastword $(MAKEFILE_LIST ) ) )
18
18
19
- ERLANG_MK_VERSION = 2.0.0-pre.2-207-g9e9b7d2
19
+ ERLANG_MK_VERSION = 2.0.0-pre.2-220-g7a200f5
20
20
21
21
# Make 3.81 and 3.82 are deprecated.
22
22
@@ -4203,17 +4203,16 @@ endif
4203
4203
# in practice only Makefile is needed so far.
4204
4204
define dep_autopatch
4205
4205
if [ -f $(DEPS_DIR ) /$(1 ) /erlang.mk ]; then \
4206
+ rm -rf $(DEPS_DIR ) /$1/ebin/; \
4206
4207
$(call erlang,$(call dep_autopatch_appsrc.erl,$(1 ) ) ) ; \
4207
4208
$(call dep_autopatch_erlang_mk,$(1 ) ) ; \
4208
4209
elif [ -f $(DEPS_DIR ) /$(1 ) /Makefile ]; then \
4209
4210
if [ 0 != `grep -c "include ../\w*\.mk" $(DEPS_DIR ) /$(1 ) /Makefile` ]; then \
4210
4211
$(call dep_autopatch2,$(1 ) ) ; \
4211
- elif [ 0 != `grep -ci rebar $(DEPS_DIR ) /$(1 ) /Makefile` ]; then \
4212
+ elif [ 0 != `grep -ci "^[^ # ].* rebar" $(DEPS_DIR)/$(1)/Makefile` ]; then \
4212
4213
$(call dep_autopatch2,$(1)); \
4213
- elif [ -n "`find $(DEPS_DIR ) /$(1 ) / -type f -name \*.mk -not -name erlang.mk -exec grep -i rebar '{}' \;`" ]; then \
4214
+ elif [ -n "`find $(DEPS_DIR)/$(1)/ -type f -name \*.mk -not -name erlang.mk -exec grep -i "^[^#].* rebar" '{}' \;`" ]; then \
4214
4215
$(call dep_autopatch2,$(1)); \
4215
- else \
4216
- $(call erlang,$(call dep_autopatch_app.erl,$(1 ) ) ) ; \
4217
4216
fi \
4218
4217
else \
4219
4218
if [ ! -d $(DEPS_DIR)/$(1)/src/ ]; then \
@@ -4225,6 +4224,8 @@ define dep_autopatch
4225
4224
endef
4226
4225
4227
4226
define dep_autopatch2
4227
+ mv -n $(DEPS_DIR ) /$1/ebin/$1.app $(DEPS_DIR ) /$1/src/$1.app.src; \
4228
+ rm -f $(DEPS_DIR ) /$1/ebin/$1.app; \
4228
4229
if [ -f $(DEPS_DIR ) /$1/src/$1.app.src.script ]; then \
4229
4230
$(call erlang,$(call dep_autopatch_appsrc_script.erl,$(1 ) ) ) ; \
4230
4231
fi; \
@@ -4536,22 +4537,6 @@ define dep_autopatch_rebar.erl
4536
4537
halt()
4537
4538
endef
4538
4539
4539
- define dep_autopatch_app.erl
4540
- UpdateModules = fun(App) ->
4541
- case filelib:is_regular(App) of
4542
- false -> ok;
4543
- true ->
4544
- {ok, [{application, '$(1 ) ', L0}]} = file:consult(App),
4545
- Mods = filelib:fold_files("$(call core_native_path,$(DEPS_DIR ) /$1/src) ", "\\\\.erl$$", true,
4546
- fun (F, Acc) -> [list_to_atom(filename:rootname(filename:basename(F)))|Acc] end, []),
4547
- L = lists:keystore(modules, 1, L0, {modules, Mods}),
4548
- ok = file:write_file(App, io_lib:format("~p.~n", [{application, '$(1 ) ', L}]))
4549
- end
4550
- end,
4551
- UpdateModules("$(call core_native_path,$(DEPS_DIR ) /$1/ebin/$1.app) "),
4552
- halt()
4553
- endef
4554
-
4555
4540
define dep_autopatch_appsrc_script.erl
4556
4541
AppSrc = "$(call core_native_path,$(DEPS_DIR ) /$1/src/$1.app.src) ",
4557
4542
AppSrcScript = AppSrc ++ ".script",
@@ -4828,6 +4813,8 @@ COMPILE_FIRST_PATHS = $(addprefix src/,$(addsuffix .erl,$(COMPILE_FIRST)))
4828
4813
ERLC_EXCLUDE ?=
4829
4814
ERLC_EXCLUDE_PATHS = $(addprefix src/,$(addsuffix .erl,$(ERLC_EXCLUDE ) ) )
4830
4815
4816
+ ERLC_ASN1_OPTS ?=
4817
+
4831
4818
ERLC_MIB_OPTS ?=
4832
4819
COMPILE_MIB_FIRST ?=
4833
4820
COMPILE_MIB_FIRST_PATHS = $(addprefix mibs/,$(addsuffix .mib,$(COMPILE_MIB_FIRST ) ) )
@@ -4877,7 +4864,7 @@ endif
4877
4864
4878
4865
ifeq ($(wildcard src/$(PROJECT_MOD ) .erl) ,)
4879
4866
define app_file
4880
- {application, $(PROJECT ) , [
4867
+ {application, ' $(PROJECT ) ' , [
4881
4868
{description, "$(PROJECT_DESCRIPTION ) "},
4882
4869
{vsn, "$(PROJECT_VERSION ) "},$(if $(IS_DEP ) ,
4883
4870
{id$(comma )$(space ) "$(1 ) "}$(comma ) )
@@ -4889,7 +4876,7 @@ define app_file
4889
4876
endef
4890
4877
else
4891
4878
define app_file
4892
- {application, $(PROJECT ) , [
4879
+ {application, ' $(PROJECT ) ' , [
4893
4880
{description, "$(PROJECT_DESCRIPTION ) "},
4894
4881
{vsn, "$(PROJECT_VERSION ) "},$(if $(IS_DEP ) ,
4895
4882
{id$(comma )$(space ) "$(1 ) "}$(comma ) )
@@ -4920,7 +4907,7 @@ ERL_FILES += $(addprefix src/,$(patsubst %.asn1,%.erl,$(notdir $(ASN1_FILES))))
4920
4907
4921
4908
define compile_asn1
4922
4909
$(verbose ) mkdir -p include/
4923
- $(asn1_verbose ) erlc -v -I include/ -o asn1/ +noobj $(1 )
4910
+ $(asn1_verbose ) erlc -v -I include/ -o asn1/ +noobj $(ERLC_ASN1_OPTS ) $( 1 )
4924
4911
$(verbose ) mv asn1/*.erl src/
4925
4912
$(verbose ) mv asn1/*.hrl include/
4926
4913
$(verbose ) mv asn1/*.asn1db include/
@@ -5052,7 +5039,7 @@ $(ERL_FILES) $(CORE_FILES) $(ASN1_FILES) $(MIB_FILES) $(XRL_FILES) $(YRL_FILES):
5052
5039
ebin/$(PROJECT ) .app :: $(ERLANG_MK_TMP ) /last-makefile-change
5053
5040
endif
5054
5041
5055
- - include $(PROJECT ) .d
5042
+ include $(wildcard $( PROJECT ) .d)
5056
5043
5057
5044
ebin/$(PROJECT ) .app :: ebin/
5058
5045
@@ -5277,6 +5264,7 @@ MAN_VERSION ?= $(PROJECT_VERSION)
5277
5264
define asciidoc2man.erl
5278
5265
try
5279
5266
[begin
5267
+ io:format(" ADOC ~s~n", [F]),
5280
5268
ok = asciideck:to_manpage(asciideck:parse_file(F), # {
5281
5269
compress => gzip,
5282
5270
outdir => filename:dirname(F),
@@ -5285,7 +5273,8 @@ try
5285
5273
})
5286
5274
end || F <- [$(shell echo $(addprefix $(comma ) \",$(addsuffix \",$1) ) | sed 's/^.//') ]],
5287
5275
halt(0)
5288
- catch _:_ ->
5276
+ catch C:E ->
5277
+ io:format("Exception ~p:~p~nStacktrace: ~p~n", [C, E, erlang:get_stacktrace()]),
5289
5278
halt(1)
5290
5279
end.
5291
5280
endef
@@ -6123,6 +6112,7 @@ CT_SUITES := $(sort $(subst _SUITE.erl,,$(notdir $(call core_find,$(TEST_DIR)/,*
6123
6112
endif
6124
6113
endif
6125
6114
CT_SUITES ?=
6115
+ CT_LOGS_DIR ?= $(CURDIR ) /logs
6126
6116
6127
6117
# Core targets.
6128
6118
@@ -6145,13 +6135,13 @@ CT_RUN = ct_run \
6145
6135
-noinput \
6146
6136
-pa $(CURDIR ) /ebin $(DEPS_DIR ) /*/ebin $(APPS_DIR ) /*/ebin $(TEST_DIR ) \
6147
6137
-dir $(TEST_DIR ) \
6148
- -logdir $(CURDIR ) /logs
6138
+ -logdir $(CT_LOGS_DIR )
6149
6139
6150
6140
ifeq ($(CT_SUITES ) ,)
6151
6141
ct : $(if $(IS_APP ) ,,apps-ct)
6152
6142
else
6153
6143
ct : test-build $(if $(IS_APP ) ,,apps-ct)
6154
- $(verbose ) mkdir -p $(CURDIR ) /logs/
6144
+ $(verbose ) mkdir -p $(CT_LOGS_DIR )
6155
6145
$(gen_verbose ) $(CT_RUN ) -sname ct_$(PROJECT ) -suite $(addsuffix _SUITE,$(CT_SUITES ) ) $(CT_OPTS )
6156
6146
endif
6157
6147
@@ -6179,14 +6169,14 @@ endif
6179
6169
6180
6170
define ct_suite_target
6181
6171
ct-$(1 ) : test-build
6182
- $(verbose ) mkdir -p $(CURDIR ) /logs/
6172
+ $(verbose ) mkdir -p $(CT_LOGS_DIR )
6183
6173
$(gen_verbose ) $(CT_RUN ) -sname ct_$(PROJECT ) -suite $(addsuffix _SUITE,$(1 ) ) $(CT_EXTRA ) $(CT_OPTS )
6184
6174
endef
6185
6175
6186
6176
$(foreach test,$(CT_SUITES),$(eval $(call ct_suite_target,$(test))))
6187
6177
6188
6178
distclean-ct :
6189
- $(gen_verbose ) rm -rf $(CURDIR ) /logs/
6179
+ $(gen_verbose ) rm -rf $(CT_LOGS_DIR )
6190
6180
6191
6181
# Copyright (c) 2013-2016, Loïc Hoguin <[email protected] >
6192
6182
# This file is part of erlang.mk and subject to the terms of the ISC License.
@@ -6232,8 +6222,10 @@ define filter_opts.erl
6232
6222
endef
6233
6223
6234
6224
$(DIALYZER_PLT ) : deps app
6235
- $(verbose ) dialyzer --build_plt --apps erts kernel stdlib $(PLT_APPS ) $(OTP_DEPS ) $(LOCAL_DEPS ) \
6236
- ` test -f $( ERLANG_MK_TMP) /deps.log && cat $( ERLANG_MK_TMP) /deps.log`
6225
+ $(eval DEPS_LOG := $(shell test -f $(ERLANG_MK_TMP ) /deps.log && \
6226
+ while read p; do test -d $$ p/ebin && echo $$ p/ebin; done < $(ERLANG_MK_TMP ) /deps.log))
6227
+ $(verbose ) dialyzer --build_plt --apps erts kernel stdlib \
6228
+ $(PLT_APPS ) $(OTP_DEPS ) $(LOCAL_DEPS ) $(DEPS_LOG )
6237
6229
6238
6230
plt : $(DIALYZER_PLT )
6239
6231
@@ -6319,7 +6311,7 @@ escript:: escript-zip
6319
6311
$(verbose ) chmod +x $(ESCRIPT_FILE )
6320
6312
6321
6313
distclean-escript :
6322
- $(gen_verbose ) rm -f $(ESCRIPT_NAME )
6314
+ $(gen_verbose ) rm -f $(ESCRIPT_FILE )
6323
6315
6324
6316
# Copyright (c) 2015-2016, Loïc Hoguin <[email protected] >
6325
6317
# Copyright (c) 2014, Enrique Fernandez <[email protected] >
@@ -6495,6 +6487,20 @@ build-shell-deps: $(ALL_SHELL_DEPS_DIRS)
6495
6487
shell : build-shell-deps
6496
6488
$(gen_verbose ) $(SHELL_ERL ) -pa $(SHELL_PATHS ) $(SHELL_OPTS )
6497
6489
6490
+ # Copyright (c) 2017, Jean-Sébastien Pédron <[email protected] >
6491
+ # This file is contributed to erlang.mk and subject to the terms of the ISC License.
6492
+
6493
+ .PHONY : show-ERL_LIBS show-ERLC_OPTS show-TEST_ERLC_OPTS
6494
+
6495
+ show-ERL_LIBS :
6496
+ @echo $(ERL_LIBS )
6497
+
6498
+ show-ERLC_OPTS :
6499
+ @$(foreach opt,$(ERLC_OPTS ) -pa ebin -I include,echo "$(opt ) ";)
6500
+
6501
+ show-TEST_ERLC_OPTS :
6502
+ @$(foreach opt,$(TEST_ERLC_OPTS ) -pa ebin -I include,echo "$(opt ) ";)
6503
+
6498
6504
# Copyright (c) 2015-2016, Loïc Hoguin <[email protected] >
6499
6505
# This file is part of erlang.mk and subject to the terms of the ISC License.
6500
6506
0 commit comments