-
Notifications
You must be signed in to change notification settings - Fork 7
/
Makefile
53 lines (41 loc) · 1.62 KB
/
Makefile
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
44
45
46
47
48
49
50
51
52
53
##############################################################################
# Note: This Makefile is only needed to maintain this public git repository. #
# #
# >>>>> Blender users should ignore this file <<<<< #
# #
##############################################################################
SHELL := /bin/bash
ADDONS=$(shell ls -d1 ../addons/* | cut -b 4-)
ADDONS_UPDATE=$(addsuffix .update, $(ADDONS))
ADDONS_CHANGELOG_UPDATE=$(addsuffix /CHANGELOG.md, $(ADDONS))
all: $(ADDONS) $(ADDONS_UPDATE) $(ADDONS_CHANGELOG_UPDATE)
@echo "All done."
addons/%:
git subtree add -P $@ ../$@ main
addons/%.update: addons/%
GIT_EDITOR=/bin/cat git subtree pull -P $< ../$< main
addons/%/CHANGELOG.md: addons/% FORCE
@echo "Updating $@ ..."
@(\
echo -e "# $$(echo $* |\
sed 's/_/ /g;s/\b\(.\)/\u\1/g' )\n\n## Changelog\n" ;\
git log --pretty=format:"%h%x09%d%x20%s" |\
grep $*.py: |\
sed "s/.* $*.py: / * /;s/.* Version bump to \(.*\)/\n\n### \1\n/";\
echo ""\
) |\
sed '/^$$/N;/^\n$$/D' |\
sed 's/\([^ :;.,]*_[^ :;.,]*\)/`\1`/g' |\
sed 's/\([^`]\)\(#[a-zA-Z_][^ :;.,]*\)/\1`\2`/g' > $@
changelogs: $(ADDONS_CHANGELOG_UPDATE)
@echo "All changelogs done."
RED := \033[0;31m
OFF := \033[0m
publish: all
@if [ -n "$$(git status --porcelain)" ] ; then \
echo -e "\n ${RED}ERROR${OFF}: Working directory not clean; cannot publish.\n" ; \
exit 1 ; \
fi
git push origin main
.PHONY: addons/%.update addons/%/CHANGELOG.md changelogs publish
FORCE: