forked from ligurio/lua-c-manual-pages
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
43 lines (31 loc) · 949 Bytes
/
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
# This way everything works as expected ever for
# `make -C /path/to/project` or
# `make -f /path/to/project/Makefile`.
MAKEFILE_PATH := $(abspath $(lastword $(MAKEFILE_LIST)))
PROJECT_DIR := $(patsubst %/,%,$(dir $(MAKEFILE_PATH)))
PREFIX ?= /usr
PREFIX_MAN = ${PREFIX}/share/man
.SUFFIXES: .3 .3.html
MANPAGE_FILES := $(wildcard man3/*.3)
HTML_FILES := $(patsubst %.3,%.3.html,$(MANPAGE_FILES))
all: check
man3/%.3.html: style.css
.3.3.html:
mandoc -Thtml -Ostyle=style.css $< > $@
html: ${HTML_FILES}
check: ${MANPAGE_FILES}
@for m in ${MANPAGE_FILES}; do \
mandoc -Tlint $$m -W style; \
done
install: ${MANPAGE_FILES}
@mkdir -p ${PREFIX_MAN}/man3
@for m in ${MANPAGE_FILES}; do \
install $$m ${PREFIX_MAN}/man3/$$(basename $$m); \
done
uninstall: ${MANPAGE_FILES}
@for m in ${MANPAGE_FILES}; do \
rm ${PREFIX_MAN}/man3/$$(basename $$m); \
done
clean:
rm -f ${HTML_FILES}
.PHONY: all check install uninstall html clean