Skip to content

Commit f057013

Browse files
committed
Update erlang.mk
1 parent de22408 commit f057013

File tree

1 file changed

+43
-16
lines changed

1 file changed

+43
-16
lines changed

erlang.mk

Lines changed: 43 additions & 16 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-32-g89f2eca
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
@@ -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 <[email protected]>
@@ -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);

0 commit comments

Comments
 (0)