all_docs != find krov/serverko -name README.md path_to_docs = $(patsubst krov/%/README.md, docs/%.md, $(all_docs)) stripped_docs = $(notdir $(path_to_docs)) x: $(info $(all_docs)) $(info $(stripped_docs)) docs/kralizec/%.md: kralizec/%/README.md mkdir -p $(@D) cp $< $@ docs/serverko/%.md: krov/serverko/%/README.md mkdir -p $(@D) cp $< $@