Skip to content

Commit c6665f2

Browse files
committed
Makefile: add, replaces res/{build,install}.sh
1 parent a639e2b commit c6665f2

File tree

4 files changed

+57
-121
lines changed

4 files changed

+57
-121
lines changed

Makefile

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
PREFIX := /usr/local
2+
3+
SOURCES = $(shell find src -not -path 'src/theme*' -type f -name '*.md')
4+
MANPAGES = $(subst src/,book/mandoc/,$(patsubst %.md,%.7,$(SOURCES)))
5+
UTILS = book/void-docs book/void-docs.1
6+
7+
all: void-book void-docs mandoc
8+
9+
install: all
10+
install -Dm0755 book/void-docs $(DESTDIR)$(PREFIX)/bin/void-docs
11+
install -Dm0644 book/void-docs.1 $(DESTDIR)$(PREFIX)/share/man/man1/void-docs.1
12+
13+
install -Dm0644 book/typst/book.pdf $(DESTDIR)$(PREFIX)/share/doc/void/handbook.pdf
14+
15+
cp -r src/ $(DESTDIR)$(PREFIX)/share/doc/void/markdown
16+
rm -fr $(DESTDIR)$(PREFIX)/share/doc/void/markdown/theme
17+
18+
cp -r book/html $(DESTDIR)$(PREFIX)/share/doc/void/html
19+
20+
cp -r book/mandoc $(DESTDIR)$(PREFIX)/share/doc/void/mandoc
21+
22+
void-docs: $(UTILS)
23+
24+
$(UTILS): book/%: res/%.in book
25+
sed -e "s,@PREFIX@,$(PREFIX)," $< >$@
26+
27+
void-book: $(SOURCES) book/typst/handbook-cover.svg
28+
mdbook build
29+
30+
book/typst/handbook-cover.svg: res/handbook-cover.svg book/typst
31+
cp -a $< $@
32+
33+
mandoc: $(MANPAGES)
34+
35+
book/mandoc/%.7: src/%.md book/mandoc
36+
@mkdir -p $(@D)
37+
lowdown -T man -m "title: $(*F)" -m "date: $$(git log --pretty='%cs' -1 $< 2>/dev/null || date -d @$$SOURCE_DATE_EPOCH +%F)" \
38+
-m "section: 7" -m "source: The Void Linux Handbook" -m "volume: The Void Linux Handbook" -s -o $@ $<
39+
40+
book:
41+
mkdir -p book
42+
43+
book/typst: book
44+
mkdir -p book/typst
45+
46+
book/mandoc: book
47+
mkdir -p book/mandoc
48+
49+
clean:
50+
rm -rf book
51+
52+
.PHONY: all install void-docs void-book mandoc clean

README.md

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,20 +7,15 @@ the same protocol as the packages tree. For details, please read
77

88
## Building
99

10-
The [res/build.sh](./res/build.sh) script builds HTML, roff and PDF versions of
11-
the Void documentation and the `void-docs.1` man page. It requires the following
12-
Void packages:
10+
The `Makefile` builds HTML, roff and PDF versions of the Void documentation and
11+
the `void-docs.1` man page. It requires the following Void packages:
1312

1413
- `mdBook`
1514
- `findutils`
1615
- `lowdown` (version 0.8.1 or greater)
17-
- `texlive`
18-
- `perl`
19-
- `perl-File-Which`
20-
- `perl-JSON`
21-
- `librsvg-utils`
16+
- `mdbook-typst`
17+
- `mdbook-linkcheck`
2218
- `python3-md2gemini`
2319

2420
In order to build and install these files, set the `PREFIX` and `DESTDIR`
25-
environment variables to appropriate values and run `res/build.sh` followed by
26-
`res/install.sh`.
21+
variables to appropriate values and run `make` to build, and `make install` to install.

res/build.sh

Lines changed: 0 additions & 92 deletions
This file was deleted.

res/install.sh

Lines changed: 0 additions & 19 deletions
This file was deleted.

0 commit comments

Comments
 (0)