-
Notifications
You must be signed in to change notification settings - Fork 8
/
Makefile
121 lines (98 loc) · 2.49 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
PROJECT ?= rsetup
PREFIX ?= /usr
BINDIR ?= $(PREFIX)/bin
LIBDIR ?= $(PREFIX)/lib
MANDIR ?= $(PREFIX)/share/man
.PHONY: all
all: build
#
# Development
#
.PHONY: overlay
overlay:
$(eval OVERLAY_DIR := $(shell mktemp -d))
sudo mount -t overlay overlay -o lowerdir=/:./src:./overlay "$(OVERLAY_DIR)"
sudo mount -o ro --bind ./externals/librtui/src/lib/librtui "$(OVERLAY_DIR)/usr/lib/librtui"
sudo mount -o ro --bind ./externals/librtui/src/share/librtui "$(OVERLAY_DIR)/usr/share/librtui"
sudo systemd-nspawn --link-journal no -D $(OVERLAY_DIR) $(OVERLAY_CMD) || true
sudo umount -R $(OVERLAY_DIR)
rmdir $(OVERLAY_DIR)
.PHONY: run
run: OVERLAY_CMD := rsetup
run: overlay
.PHONY: debug
debug: OVERLAY_CMD := bash -c "DEBUG=true /usr/bin/rsetup"
debug: overlay
.PHONY: shell
shell: OVERLAY_CMD := bash
shell: overlay
#
# Test
#
.PHONY: test
test:
#
# Build
#
.PHONY: build
build: build-man build-doc
SRC-MAN := src/usr/share/man/man8
SRCS-MAN := $(wildcard $(SRC-MAN)/*.md)
MANS := $(SRCS-MAN:.md=)
.PHONY: build-man
build-man: $(MANS)
$(SRC-MAN)/%: $(SRC-MAN)/%.md
pandoc "$<" -o "$@" --from markdown --to man -s
SRC-DOC := src
DOCS := $(SRC-DOC)/SOURCE
.PHONY: build-doc
build-doc: $(DOCS)
$(SRC-DOC):
mkdir -p $(SRC-DOC)
.PHONY: $(SRC-DOC)/SOURCE
$(SRC-DOC)/SOURCE: $(SRC-DOC)
echo -e "git clone $(shell git remote get-url origin)\ngit checkout $(shell git rev-parse HEAD)" > "$@"
#
# Documentation
#
.PHONY: serve
serve:
mdbook serve
.PHONY: serve_zh-CN
serve_zh-CN:
MDBOOK_BOOK__LANGUAGE=zh-CN mdbook serve -d book/zh-CN
.PHONY: translate
translate:
MDBOOK_OUTPUT='{"xgettext": {"pot-file": "messages.pot"}}' mdbook build -d po
for i in po/*.po; \
do \
msgmerge --update $$i po/messages.pot; \
done
#
# Clean
#
.PHONY: distclean
distclean: clean
.PHONY: clean
clean: clean-man clean-doc clean-deb
.PHONY: clean-man
clean-man:
rm -rf $(MANS)
.PHONY: clean-doc
clean-doc:
rm -rf $(DOCS)
.PHONY: clean-deb
clean-deb:
rm -rf debian/.debhelper debian/${PROJECT}*/ debian/debhelper-build-stamp debian/files debian/*.debhelper.log debian/*.postrm.debhelper debian/*.substvars
#
# Release
#
.PHONY: dch
dch: debian/changelog
EDITOR=true gbp dch --ignore-branch --multimaint-merge --commit --release --dch-opt=--upstream
.PHONY: deb
deb: debian
debuild --no-lintian --lintian-hook "lintian --fail-on error,warning --suppress-tags bad-distribution-in-changes-file -- %p_%v_*.changes" --no-sign -b
.PHONY: release
release:
gh workflow run .github/workflows/new_version.yml --ref $(shell git branch --show-current)