diff --git a/Makefile b/Makefile index d628a058a33..eb4d7eeac80 100644 --- a/Makefile +++ b/Makefile @@ -203,8 +203,6 @@ _output/share/doc/lima/%: % | _output/share/doc/lima MKDIR_TARGETS += _output/share/doc/lima -$(MKDIR_TARGETS): - mkdir -p $@ .PHONY: create-links-in-documents create-links-in-documents: _output/share/doc/lima/templates _output/share/doc/lima/examples @@ -318,8 +316,7 @@ _artifacts/lima-%.tar.gz: | _artifacts $(ENVS) make clean binaries $(TAR) -C _output/ -czvf $@ ./ -_artifacts: - mkdir -p $@ +MKDIR_TARGETS += _artifacts .PHONY: artifacts-misc artifacts-misc: | _artifacts @@ -331,3 +328,8 @@ codesign: ifeq ($(GOOS),darwin) codesign --entitlements vz.entitlements -s - ./_output/bin/limactl endif + +# This target must be placed after any changes to the `MKDIR_TARGETS` variable. +# It seems that variable expansion in Makefile targets is not done recursively. +$(MKDIR_TARGETS): + mkdir -p $@