Skip to content

Commit 99e2cf4

Browse files
committed
Update Erlang.mk
1 parent b77dd29 commit 99e2cf4

File tree

1 file changed

+58
-9
lines changed

1 file changed

+58
-9
lines changed

erlang.mk

Lines changed: 58 additions & 9 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 = 16d60fa
20+
ERLANG_MK_VERSION = d3485e7
2121
ERLANG_MK_WITHOUT =
2222

2323
# Make 3.81 and 3.82 are deprecated.
@@ -184,8 +184,9 @@ core_http_get = curl -Lf$(if $(filter-out 0,$(V)),,s)o $(call core_native_path,$
184184

185185
core_eq = $(and $(findstring $(1),$(2)),$(findstring $(2),$(1)))
186186

187-
# We skip files that contain spaces or '#' because they end up causing issues.
188-
core_find = $(if $(wildcard $1),$(shell find $(1:%/=%) \( -type l -o -type f \) -name $(subst *,\*,$2) -not -name "*[ \#]*"))
187+
# We skip files that contain spaces because they end up causing issues.
188+
# Files that begin with a dot are already ignored by the wildcard function.
189+
core_find = $(foreach f,$(wildcard $(1:%/=%)/*),$(if $(wildcard $f/.),$(call core_find,$f,$2),$(if $(filter $(subst *,%,$2),$f),$(if $(wildcard $f),$f))))
189190

190191
core_lc = $(subst A,a,$(subst B,b,$(subst C,c,$(subst D,d,$(subst E,e,$(subst F,f,$(subst G,g,$(subst H,h,$(subst I,i,$(subst J,j,$(subst K,k,$(subst L,l,$(subst M,m,$(subst N,n,$(subst O,o,$(subst P,p,$(subst Q,q,$(subst R,r,$(subst S,s,$(subst T,t,$(subst U,u,$(subst V,v,$(subst W,w,$(subst X,x,$(subst Y,y,$(subst Z,z,$(1)))))))))))))))))))))))))))
191192

@@ -800,7 +801,7 @@ pkg_cuttlefish_description = cuttlefish configuration abstraction
800801
pkg_cuttlefish_homepage = https://github.com/Kyorai/cuttlefish
801802
pkg_cuttlefish_fetch = git
802803
pkg_cuttlefish_repo = https://github.com/Kyorai/cuttlefish
803-
pkg_cuttlefish_commit = master
804+
pkg_cuttlefish_commit = main
804805

805806
PACKAGES += damocles
806807
pkg_damocles_name = damocles
@@ -3564,8 +3565,10 @@ export DEPS_DIR
35643565
REBAR_DEPS_DIR = $(DEPS_DIR)
35653566
export REBAR_DEPS_DIR
35663567

3568+
# When testing Erlang.mk and updating these, make sure
3569+
# to delete test/test_rebar_git before running tests again.
35673570
REBAR3_GIT ?= https://github.com/erlang/rebar3
3568-
REBAR3_COMMIT ?= 06aaecd51b0ce828b66bb65a74d3c1fd7833a4ba # 3.22.1 + OTP-27 fixes
3571+
REBAR3_COMMIT ?= bde4b54248d16280b2c70a244aca3bb7566e2033 # 3.23.0
35693572

35703573
CACHE_DEPS ?= 0
35713574

@@ -4439,6 +4442,49 @@ ERLANG_MK_QUERY_REL_DEPS_FILE = $(ERLANG_MK_TMP)/query-rel-deps.log
44394442
ERLANG_MK_QUERY_TEST_DEPS_FILE = $(ERLANG_MK_TMP)/query-test-deps.log
44404443
ERLANG_MK_QUERY_SHELL_DEPS_FILE = $(ERLANG_MK_TMP)/query-shell-deps.log
44414444

4445+
# Copyright (c) 2024, Loïc Hoguin <[email protected]>
4446+
# This file is part of erlang.mk and subject to the terms of the ISC License.
4447+
4448+
.PHONY: beam-cache-restore-app beam-cache-restore-test clean-beam-cache distclean-beam-cache
4449+
4450+
BEAM_CACHE_DIR ?= $(ERLANG_MK_TMP)/beam-cache
4451+
PROJECT_BEAM_CACHE_DIR = $(BEAM_CACHE_DIR)/$(PROJECT)
4452+
4453+
clean:: clean-beam-cache
4454+
4455+
clean-beam-cache:
4456+
$(verbose) rm -rf $(PROJECT_BEAM_CACHE_DIR)
4457+
4458+
distclean:: distclean-beam-cache
4459+
4460+
$(PROJECT_BEAM_CACHE_DIR):
4461+
$(verbose) mkdir -p $(PROJECT_BEAM_CACHE_DIR)
4462+
4463+
distclean-beam-cache:
4464+
$(gen_verbose) rm -rf $(BEAM_CACHE_DIR)
4465+
4466+
beam-cache-restore-app: | $(PROJECT_BEAM_CACHE_DIR)
4467+
$(verbose) rm -rf $(PROJECT_BEAM_CACHE_DIR)/ebin-test
4468+
ifneq ($(wildcard ebin/),)
4469+
$(verbose) mv ebin/ $(PROJECT_BEAM_CACHE_DIR)/ebin-test
4470+
endif
4471+
ifneq ($(wildcard $(PROJECT_BEAM_CACHE_DIR)/ebin-app),)
4472+
$(gen_verbose) mv $(PROJECT_BEAM_CACHE_DIR)/ebin-app ebin/
4473+
else
4474+
$(verbose) $(MAKE) --no-print-directory clean-app
4475+
endif
4476+
4477+
beam-cache-restore-test: | $(PROJECT_BEAM_CACHE_DIR)
4478+
$(verbose) rm -rf $(PROJECT_BEAM_CACHE_DIR)/ebin-app
4479+
ifneq ($(wildcard ebin/),)
4480+
$(verbose) mv ebin/ $(PROJECT_BEAM_CACHE_DIR)/ebin-app
4481+
endif
4482+
ifneq ($(wildcard $(PROJECT_BEAM_CACHE_DIR)/ebin-test),)
4483+
$(gen_verbose) mv $(PROJECT_BEAM_CACHE_DIR)/ebin-test ebin/
4484+
else
4485+
$(verbose) $(MAKE) --no-print-directory clean-app
4486+
endif
4487+
44424488
# Copyright (c) 2013-2016, Loïc Hoguin <[email protected]>
44434489
# This file is part of erlang.mk and subject to the terms of the ISC License.
44444490

@@ -4494,7 +4540,7 @@ ifneq ($(wildcard src/),)
44944540

44954541
# Targets.
44964542

4497-
app:: $(if $(wildcard ebin/test),clean) deps
4543+
app:: $(if $(wildcard ebin/test),beam-cache-restore-app) deps
44984544
$(verbose) $(MAKE) --no-print-directory $(PROJECT).d
44994545
$(verbose) $(MAKE) --no-print-directory app-build
45004546

@@ -4881,14 +4927,17 @@ define compile_test_erl
48814927
endef
48824928

48834929
ERL_TEST_FILES = $(call core_find,$(TEST_DIR)/,*.erl)
4930+
48844931
$(ERLANG_MK_TMP)/$(PROJECT).last-testdir-build: $(ERL_TEST_FILES) $(MAKEFILE_LIST)
4885-
$(eval FILES_TO_COMPILE := $(if $(filter $(MAKEFILE_LIST),$?),$(filter $(ERL_TEST_FILES),$^),$?))
4932+
# When we have to recompile files in src/ the .d file always gets rebuilt.
4933+
# Therefore we want to ignore it when rebuilding test files.
4934+
$(eval FILES_TO_COMPILE := $(if $(filter $(filter-out $(PROJECT).d,$(MAKEFILE_LIST)),$?),$(filter $(ERL_TEST_FILES),$^),$(filter $(ERL_TEST_FILES),$?)))
48864935
$(if $(strip $(FILES_TO_COMPILE)),$(call compile_test_erl,$(FILES_TO_COMPILE)) && touch $@)
48874936
endif
48884937

48894938
test-build:: IS_TEST=1
48904939
test-build:: ERLC_OPTS=$(TEST_ERLC_OPTS)
4891-
test-build:: $(if $(wildcard src),$(if $(wildcard ebin/test),,clean)) $(if $(IS_APP),,deps test-deps)
4940+
test-build:: $(if $(wildcard src),$(if $(wildcard ebin/test),,beam-cache-restore-test)) $(if $(IS_APP),,deps test-deps)
48924941
# We already compiled everything when IS_APP=1.
48934942
ifndef IS_APP
48944943
ifneq ($(wildcard src),)
@@ -5492,7 +5541,7 @@ endif
54925541
$(verbose) mkdir config/
54935542
$(verbose) $(call core_render,bs_sys_config,config/sys.config)
54945543
$(verbose) $(call core_render,bs_vm_args,config/vm.args)
5495-
$(verbose) awk '/^include erlang.mk/ && !ins {print "BUILD_DEPS += relx";ins=1};{print}' Makefile > Makefile.bak
5544+
$(verbose) awk '/^include erlang.mk/ && !ins {print "REL_DEPS += relx";ins=1};{print}' Makefile > Makefile.bak
54965545
$(verbose) mv Makefile.bak Makefile
54975546

54985547
new-app:

0 commit comments

Comments
 (0)