diff options
-rw-r--r-- | Makefile | 12 |
1 files changed, 7 insertions, 5 deletions
@@ -44,12 +44,14 @@ build/download/tar/%: .tokens/network extract: PHONY $(foreach package,$(packages),build/extract/$(shell utils/spec2file '$($(package))')) build/extract/git/%: - rm -rf '$@' - mkdir -p '$(@D)' + gitref="$$(file2extra 'git/$*'|cut -d/ -f1)" && \ + gitdir=build/extract/"$$(file2base 'git/$*')/$${gitref}" && \ + rm -rf "$$gitdir" && \ { \ - git clone build/download/"$$(file2base 'git/$*')" '$@' && \ - cd '$@' && git checkout "$$(file2extra 'git/$*')"; \ - } || rm -rf '$@' + mkdir -p "$$(dirname "$$gitdir")" && \ + git clone build/download/"$$(file2base 'git/$*')" "$$gitdir" && \ + ( cd "$$gitdir" && git checkout "$$gitref" ); \ + } || rm -rf "$$gitdir" touch '$@' $(foreach package,$(packages),$(if $(filter git|%,$($(package))),$(eval \ build/extract/$(shell utils/spec2file '$($(package))'): \ |