aboutsummaryrefslogtreecommitdiff
path: root/exp/Makefile
blob: e7314bf5bafb56a39b3397f3a64ccc937a947473 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
REPO_URL  := https://club1.fr/~nicolas/git/dna-backup/

REPO_PATH := repo
GIT_PATH  := git
GITC      := git -C $(REPO_PATH)

TEMP      := temp

.PHONY: all exp
all exp: versions results
	@echo "total size    : `head --lines=1 results | cut -f1`"
	@echo "version count : `wc -l versions`"
	@echo "repo results  :\n`cat results`"

versions: results
	grep [0-9]$$ $< | cut -f1 > $@

results: | $(TEMP)
	du -bad 2 $(TEMP) | sort -k2 > $@

$(TEMP): commits ../dna-backup
	rm -rf $@
	./exp.sh $< $(REPO_PATH) $@

../dna-backup: .FORCE
	@$(MAKE) -C .. --no-print-directory dna-backup

commits: | repo git
	$(GITC) log --reverse --no-merges --pretty=tformat:"%H	%as" \
	| sort --unique --key=2 \
	> $@

repo git:
	git clone --separate-git-dir=$(GIT_PATH) $(REPO_URL) $(REPO_PATH)
# remove warning about detached head state
	$(GITC) config advice.detachedHead false

.PHONY: clean
clean:
	rm -rf $(REPO_PATH) $(GIT_PATH) $(TEMP)
	rm -f commits results versions

.FORCE: ;