diff --git a/common.mk b/common.mk index 51dcc8a..0b9501b 100644 --- a/common.mk +++ b/common.mk @@ -82,7 +82,7 @@ build-all: $(VERSIONS) done .PHONY: $(VERSIONS) -$(VERSIONS): +$(VERSIONS): copy_md_files VERSION="$@" $(script_env) $(build) .PHONY: test check @@ -127,7 +127,7 @@ betka: $(script_env) $(betka) .PHONY: clean clean-hook clean-images clean-versions -clean: clean-images +clean: remove_md_files clean-images @$(MAKE) --no-print-directory clean-hook clean-images: @@ -136,6 +136,25 @@ clean-images: clean-versions: rm -rf $(VERSIONS) +# Copy also all .md files from version directory to the root of +# container images, so that they are available in the image +# Currently there is only README.md, but there may be more in the future +copy_md_files: + @for version in $(VERSIONS); do \ + mkdir -p "$$version/root" ; \ + if ls $$version/*.md 1> /dev/null 2>&1; then \ + cp -v $$version/*.md "$$version/root" ; \ + chmod a+r $$version/root/*.md ; \ + fi ; \ + done + +remove_md_files: + @for version in $(VERSIONS); do \ + if ls $$version/*.md 1> /dev/null 2>&1; then \ + rm -v $$version/root/*.md ; \ + fi ; \ + done + generate-all: generate .PHOHY: generate