Skip to content
This repository was archived by the owner on Jul 9, 2024. It is now read-only.

Commit ce311ee

Browse files
author
dcorbacho
committed
Update erlang.mk
1 parent 53ef140 commit ce311ee

File tree

1 file changed

+113
-17
lines changed

1 file changed

+113
-17
lines changed

erlang.mk

Lines changed: 113 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
ERLANG_MK_FILENAME := $(realpath $(lastword $(MAKEFILE_LIST)))
1818
export ERLANG_MK_FILENAME
1919

20-
ERLANG_MK_VERSION = 2019.07.01-18-g7edc30a
20+
ERLANG_MK_VERSION = 2019.07.01-40-geb3e4b0
2121
ERLANG_MK_WITHOUT =
2222

2323
# Make 3.81 and 3.82 are deprecated.
@@ -1633,6 +1633,14 @@ pkg_escalus_fetch = git
16331633
pkg_escalus_repo = https://github.com/esl/escalus
16341634
pkg_escalus_commit = master
16351635

1636+
PACKAGES += esh_mk
1637+
pkg_esh_mk_name = esh_mk
1638+
pkg_esh_mk_description = esh template engine plugin for erlang.mk
1639+
pkg_esh_mk_homepage = https://github.com/crownedgrouse/esh.mk
1640+
pkg_esh_mk_fetch = git
1641+
pkg_esh_mk_repo = https://github.com/crownedgrouse/esh.mk.git
1642+
pkg_esh_mk_commit = master
1643+
16361644
PACKAGES += espec
16371645
pkg_espec_name = espec
16381646
pkg_espec_description = ESpec: Behaviour driven development framework for Erlang
@@ -4826,7 +4834,7 @@ define dep_autopatch_rebar.erl
48264834
Write("\npre-app::\n\t@$$\(MAKE) --no-print-directory -f c_src/Makefile.erlang.mk\n"),
48274835
PortSpecWrite(io_lib:format("ERL_CFLAGS ?= -finline-functions -Wall -fPIC -I \\"~s/erts-~s/include\\" -I \\"~s\\"\n",
48284836
[code:root_dir(), erlang:system_info(version), code:lib_dir(erl_interface, include)])),
4829-
PortSpecWrite(io_lib:format("ERL_LDFLAGS ?= -L \\"~s\\" -lerl_interface -lei\n",
4837+
PortSpecWrite(io_lib:format("ERL_LDFLAGS ?= -L \\"~s\\" -lei\n",
48304838
[code:lib_dir(erl_interface, lib)])),
48314839
[PortSpecWrite(["\n", E, "\n"]) || E <- OsEnv],
48324840
FilterEnv = fun(Env) ->
@@ -5374,11 +5382,16 @@ define makedep.erl
53745382
string:join(DirSubname ++ [atom_to_list(Target)], "/")
53755383
end
53765384
end,
5377-
ok = file:write_file("$(1)", unicode:characters_to_binary([
5385+
Output0 = [
53785386
"# Generated by Erlang.mk. Edit at your own risk!\n\n",
53795387
[[F, "::", [[" ", D] || D <- Deps], "; @touch \$$@\n"] || {F, Deps} <- Depend],
53805388
"\nCOMPILE_FIRST +=", [[" ", TargetPath(CF)] || CF <- CompileFirst], "\n"
5381-
])),
5389+
],
5390+
Output = case "é" of
5391+
[233] -> unicode:characters_to_binary(Output0);
5392+
_ -> Output0
5393+
end,
5394+
ok = file:write_file("$(1)", Output),
53825395
halt()
53835396
endef
53845397

@@ -5538,46 +5551,60 @@ test-deps: $(ALL_TEST_DEPS_DIRS)
55385551
endif
55395552

55405553
ifneq ($(wildcard $(TEST_DIR)),)
5541-
test-dir:
5542-
$(gen_verbose) erlc -v $(TEST_ERLC_OPTS) -o $(TEST_DIR) \
5543-
-pa ebin/ -I include/ $(call core_find,$(TEST_DIR)/,*.erl)
5554+
test-dir: $(ERLANG_MK_TMP)/$(PROJECT).last-testdir-build
5555+
@:
5556+
5557+
test_erlc_verbose_0 = @echo " ERLC " $(filter-out $(patsubst %,%.erl,$(ERLC_EXCLUDE)),\
5558+
$(filter %.erl %.core,$(notdir $(FILES_TO_COMPILE))));
5559+
test_erlc_verbose_2 = set -x;
5560+
test_erlc_verbose = $(test_erlc_verbose_$(V))
5561+
5562+
define compile_test_erl
5563+
$(test_erlc_verbose) erlc -v $(TEST_ERLC_OPTS) -o $(TEST_DIR) \
5564+
-pa ebin/ -I include/ $(1)
5565+
endef
5566+
5567+
ERL_TEST_FILES = $(call core_find,$(TEST_DIR)/,*.erl)
5568+
$(ERLANG_MK_TMP)/$(PROJECT).last-testdir-build: $(ERL_TEST_FILES) $(MAKEFILE_LIST)
5569+
$(eval FILES_TO_COMPILE := $(if $(filter $(MAKEFILE_LIST),$?),$(filter $(ERL_TEST_FILES),$^),$?))
5570+
$(if $(strip $(FILES_TO_COMPILE)),$(call compile_test_erl,$(FILES_TO_COMPILE)) && touch $@)
55445571
endif
55455572

55465573
test-build:: IS_TEST=1
55475574
test-build:: ERLC_OPTS=$(TEST_ERLC_OPTS)
55485575
test-build:: $(if $(wildcard src),$(if $(wildcard ebin/test),,clean)) $(if $(IS_APP),,deps test-deps)
55495576
# We already compiled everything when IS_APP=1.
55505577
ifndef IS_APP
5551-
ifneq ($(wildcard $(TEST_DIR)),)
5552-
$(verbose) $(MAKE) --no-print-directory test-dir ERLC_OPTS="$(call escape_dquotes,$(TEST_ERLC_OPTS))"
5553-
endif
55545578
ifneq ($(wildcard src),)
55555579
$(verbose) $(MAKE) --no-print-directory $(PROJECT).d ERLC_OPTS="$(call escape_dquotes,$(TEST_ERLC_OPTS))"
55565580
$(verbose) $(MAKE) --no-print-directory app-build ERLC_OPTS="$(call escape_dquotes,$(TEST_ERLC_OPTS))"
55575581
$(gen_verbose) touch ebin/test
55585582
endif
5583+
ifneq ($(wildcard $(TEST_DIR)),)
5584+
$(verbose) $(MAKE) --no-print-directory test-dir ERLC_OPTS="$(call escape_dquotes,$(TEST_ERLC_OPTS))"
5585+
endif
55595586
endif
55605587

55615588
# Roughly the same as test-build, but when IS_APP=1.
55625589
# We only care about compiling the current application.
55635590
ifdef IS_APP
55645591
test-build-app:: ERLC_OPTS=$(TEST_ERLC_OPTS)
55655592
test-build-app:: deps test-deps
5566-
ifneq ($(wildcard $(TEST_DIR)),)
5567-
$(verbose) $(MAKE) --no-print-directory test-dir ERLC_OPTS="$(call escape_dquotes,$(TEST_ERLC_OPTS))"
5568-
endif
55695593
ifneq ($(wildcard src),)
55705594
$(verbose) $(MAKE) --no-print-directory $(PROJECT).d ERLC_OPTS="$(call escape_dquotes,$(TEST_ERLC_OPTS))"
55715595
$(verbose) $(MAKE) --no-print-directory app-build ERLC_OPTS="$(call escape_dquotes,$(TEST_ERLC_OPTS))"
55725596
$(gen_verbose) touch ebin/test
55735597
endif
5598+
ifneq ($(wildcard $(TEST_DIR)),)
5599+
$(verbose) $(MAKE) --no-print-directory test-dir ERLC_OPTS="$(call escape_dquotes,$(TEST_ERLC_OPTS))"
5600+
endif
55745601
endif
55755602

55765603
clean:: clean-test-dir
55775604

55785605
clean-test-dir:
55795606
ifneq ($(wildcard $(TEST_DIR)/*.beam),)
5580-
$(gen_verbose) rm -f $(TEST_DIR)/*.beam
5607+
$(gen_verbose) rm -f $(TEST_DIR)/*.beam $(ERLANG_MK_TMP)/$(PROJECT).last-testdir-build
55815608
endif
55825609

55835610
# Copyright (c) 2015-2016, Loïc Hoguin <essen@ninenines.eu>
@@ -6261,14 +6288,14 @@ endif
62616288
CFLAGS += -I"$(ERTS_INCLUDE_DIR)" -I"$(ERL_INTERFACE_INCLUDE_DIR)"
62626289
CXXFLAGS += -I"$(ERTS_INCLUDE_DIR)" -I"$(ERL_INTERFACE_INCLUDE_DIR)"
62636290

6264-
LDLIBS += -L"$(ERL_INTERFACE_LIB_DIR)" -lerl_interface -lei
6291+
LDLIBS += -L"$(ERL_INTERFACE_LIB_DIR)" -lei
62656292

62666293
# Verbosity.
62676294

6268-
c_verbose_0 = @echo " C " $(?F);
6295+
c_verbose_0 = @echo " C " $(filter-out $(notdir $(MAKEFILE_LIST) $(C_SRC_ENV)),$(^F));
62696296
c_verbose = $(c_verbose_$(V))
62706297

6271-
cpp_verbose_0 = @echo " CPP " $(?F);
6298+
cpp_verbose_0 = @echo " CPP " $(filter-out $(notdir $(MAKEFILE_LIST) $(C_SRC_ENV)),$(^F));
62726299
cpp_verbose = $(cpp_verbose_$(V))
62736300

62746301
link_verbose_0 = @echo " LD " $(@F);
@@ -6514,6 +6541,74 @@ help::
65146541

65156542
endif
65166543

6544+
# Copyright (c) 2020, Loïc Hoguin <essen@ninenines.eu>
6545+
# This file is part of erlang.mk and subject to the terms of the ISC License.
6546+
6547+
ifdef CONCUERROR_TESTS
6548+
6549+
.PHONY: concuerror distclean-concuerror
6550+
6551+
# Configuration
6552+
6553+
CONCUERROR_LOGS_DIR ?= $(CURDIR)/logs
6554+
CONCUERROR_OPTS ?=
6555+
6556+
# Core targets.
6557+
6558+
check:: concuerror
6559+
6560+
ifndef KEEP_LOGS
6561+
distclean:: distclean-concuerror
6562+
endif
6563+
6564+
# Plugin-specific targets.
6565+
6566+
$(ERLANG_MK_TMP)/Concuerror/bin/concuerror: | $(ERLANG_MK_TMP)
6567+
$(verbose) git clone https://github.com/parapluu/Concuerror $(ERLANG_MK_TMP)/Concuerror
6568+
$(verbose) $(MAKE) -C $(ERLANG_MK_TMP)/Concuerror
6569+
6570+
$(CONCUERROR_LOGS_DIR):
6571+
$(verbose) mkdir -p $(CONCUERROR_LOGS_DIR)
6572+
6573+
define concuerror_html_report
6574+
<!DOCTYPE html>
6575+
<html lang="en">
6576+
<head>
6577+
<meta charset="utf-8">
6578+
<title>Concuerror HTML report</title>
6579+
</head>
6580+
<body>
6581+
<h1>Concuerror HTML report</h1>
6582+
<p>Generated on $(concuerror_date)</p>
6583+
<ul>
6584+
$(foreach t,$(concuerror_targets),<li><a href="$(t).txt">$(t)</a></li>)
6585+
</ul>
6586+
</body>
6587+
</html>
6588+
endef
6589+
6590+
concuerror: $(addprefix concuerror-,$(subst :,-,$(CONCUERROR_TESTS)))
6591+
$(eval concuerror_date := $(shell date))
6592+
$(eval concuerror_targets := $^)
6593+
$(verbose) $(call core_render,concuerror_html_report,$(CONCUERROR_LOGS_DIR)/concuerror.html)
6594+
6595+
define concuerror_target
6596+
.PHONY: concuerror-$1-$2
6597+
6598+
concuerror-$1-$2: test-build | $(ERLANG_MK_TMP)/Concuerror/bin/concuerror $(CONCUERROR_LOGS_DIR)
6599+
$(ERLANG_MK_TMP)/Concuerror/bin/concuerror \
6600+
--pa $(CURDIR)/ebin --pa $(TEST_DIR) \
6601+
-o $(CONCUERROR_LOGS_DIR)/concuerror-$1-$2.txt \
6602+
$$(CONCUERROR_OPTS) -m $1 -t $2
6603+
endef
6604+
6605+
$(foreach test,$(CONCUERROR_TESTS),$(eval $(call concuerror_target,$(firstword $(subst :, ,$(test))),$(lastword $(subst :, ,$(test))))))
6606+
6607+
distclean-concuerror:
6608+
$(gen_verbose) rm -rf $(CONCUERROR_LOGS_DIR)
6609+
6610+
endif
6611+
65176612
# Copyright (c) 2013-2016, Loïc Hoguin <essen@ninenines.eu>
65186613
# This file is part of erlang.mk and subject to the terms of the ISC License.
65196614

@@ -7636,6 +7731,7 @@ $(ERLANG_MK_RECURSIVE_SHELL_DEPS_LIST): | $(ERLANG_MK_TMP)
76367731
ifeq ($(IS_APP)$(IS_DEP),)
76377732
$(verbose) rm -f $(ERLANG_MK_RECURSIVE_TMP_LIST)
76387733
endif
7734+
$(verbose) touch $(ERLANG_MK_RECURSIVE_TMP_LIST)
76397735
$(verbose) set -e; for dep in $^ ; do \
76407736
if ! grep -qs ^$$dep$$ $(ERLANG_MK_RECURSIVE_TMP_LIST); then \
76417737
echo $$dep >> $(ERLANG_MK_RECURSIVE_TMP_LIST); \

0 commit comments

Comments
 (0)