summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile12
1 files changed, 7 insertions, 5 deletions
diff --git a/Makefile b/Makefile
index 577b1c1..3bfeb69 100644
--- a/Makefile
+++ b/Makefile
@@ -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))'): \