-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
134 lines (105 loc) · 3.42 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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
# SPDX-License-Identifier: MIT
# SPDX-FileCopyrightText: 2024 Stefan Lengfeld <[email protected]>
TARGETS += checks/git.show.tags checks/git.ls-tree.tags checks/git.ls-remote
TARGETS += checks/git.log.main checks/git.log.main-readme
TARGETS += checks/links.all
TARGETS += checks/preferred.src
all: $(TARGETS)
checks/git.show.tags:
(cd live555-unofficial-git-archive && \
for tag in $$(git tag); do git show --no-patch $$tag; echo ----; done) > $@
checks/git.ls-tree.tags:
(cd live555-unofficial-git-archive && \
for tag in $$(git tag); do git ls-tree --name-only -r $$tag; done) | sort | uniq > $@
checks/git.ls-remote:
git ls-remote live555-unofficial-git-archive/ > $@
# TODO maybe use 'raw' also for other checks
checks/git.log.main:
(cd live555-unofficial-git-archive && git log main --format=raw) > $@
checks/git.log.main-readme:
(cd live555-unofficial-git-archive && git log main-readme --format=raw) > $@
checks/links.all:
(cd pub/archives && ls -l live* | cut -c 38- ) | sort > $@
checks/preferred.src:
./build.py dump_preferred_src > $@
.PHONY: checks
checks:
./build.py check
./build.py check_git_tags
.PHONY: lint
lint:
pycodestyle *.py
# TODO This build arragement is bad. It does not use dependencies to avoid
# rebuilding and recomputing (e.g. the checksums).
pub:
rm -rf pub-tmp
mkdir -p pub-tmp/archives
./build.py link
./build.py versions > pub-tmp/versions.txt
cd pub-tmp/archives && \
md5sum *.tar.gz > checksums.md5 && \
sha256sum *.tar.gz > checksums.sha256 && \
sha512sum *.tar.gz > checksums.sha512
./build.py list > pub-tmp/list.html
./build.py table > pub-tmp/table.html
rm -rf pub
mv pub-tmp pub
.PHONY: create-pub
create-pub: pub
# TODO This also creates the main branch
.PHONY: create-tags
create-tags:
./build.py tag
# TODO Combine/create target to recreate the whole
# 'live555-unofficial-git-archive' repo
.PHONY: create-branch-readme-main
create-branch-readme-main:
cd live555-unofficial-git-archive && \
../scripts/gen-branch-main-readme.sh
.PHONY: clean-checks
clean-checks:
rm -rf checks
mkdir checks
.PHONY: clean-hard
clean-tags:
cd live555-unofficial-git-archive && \
for tag in $$(git tag); do git tag -d $$tag; done && \
(git branch -D main || true)
.PHONY: clean-pub
clean-pub:
rm -rf pub
# TODO Cleanup the build and pub folder mess!
build:
mkdir -p $@
build/index.html: index.md build
pandoc --toc -s -f markdown -t html $< -o $@
pub/index.html: build/index.html
cp $< $@
# NOTE: This only works if there are uncommitted changes to the website (=the
# gh-pages) branch.
# NOTE: These commands are just tuned for my local setup.
.PHONY: page
page: pub/index.html pub/list.html pub/table.html
git worktree add gh-pages origin/gh-pages
(cd gh-pages && \
git branch -D gh-pages && \
git branch gh-pages origin/gh-pages && \
git rm * && \
touch .nojekyll && \
cd .. && cp $^ gh-pages/ && cd gh-pages && \
git add * .nojekyll && \
git commit -m "update gh-pages" && \
git branch -D gh-pages && \
git branch gh-pages $$(git rev-parse HEAD) && \
echo "summary:" && git diff origin/gh-pages gh-pages --compact-summary && \
echo show changes: git diff origin/gh-pages gh-pages); \
git worktree remove --force gh-pages
DRY_RUN=--dry-run
# Push two branches, new tags and one branch
.PHONY: publish
publish:
git push origin main gh-pages $(DRY_RUN)
cd live555-unofficial-git-archive && git push origin main --tags $(DRY_RUN)
.PHONY: clean
clean:
rm -f $(TARGETS) -r build/