-
Notifications
You must be signed in to change notification settings - Fork 3
/
Makefile
54 lines (40 loc) · 1.4 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
.DEFAULT_GOAL := all
ROOT=.
DEPDIR=.deps
SRCDIR=c-ares.git
DOCSDIR=$(SRCDIR)/docs
DOCSDEST=docs
MAN2HTML=roffit --bare --mandir=$(DOCSDIR) --hrefdir=/$(DOCSDEST)
MANPAGES_SRC=$(sort $(shell find $(DOCSDIR) -name "*.3"))
MANPAGES=$(addprefix $(DOCSDEST)/,$(sort $(notdir $(MANPAGES_SRC:.3=.html))))
MANPAGES_NAMES=$(sort $(notdir $(MANPAGES_SRC)))
DEPFILES=$(MANPAGES_NAMES:%.3=$(DEPDIR)/%.d)
PAGES=$(MANPAGES) features.md security.md license.md
$(DOCSDEST):
mkdir -p $@
$(DEPDIR): $(DOCSDEST)
mkdir -p $@
$(DEPDIR)/%.d: $(DOCSDIR)/%.3
sed -n -e 's|^\.so man[0-9]/\(.*\.[0-9]\).*|/$(DOCSDEST)/$*.html: $(DOCSDIR)/\1|p' < $< > $@
$(DOCSDEST)/%.html: $(DOCSDIR)/%.3 $(DEPDIR)/%.d
$(MAN2HTML) < $< > $(DOCSDEST)/$*.raw
echo "---\nlayout: page\ntitle: $*\n---" > $(DOCSDEST)/$*.html
cat $(DOCSDEST)/$*.raw >> $(DOCSDEST)/$*.html
rm -f $(DOCSDEST)/$*.raw
security.md: c-ares.git/SECURITY.md
echo "---\nlayout: page\ntitle: \"c-ares Security Policies and Procedures\"\n---" > $@
cat $< >> $@
license.md: c-ares.git/LICENSE.md
echo "---\nlayout: page\ntitle: \"c-ares License\"\nmenu: License\n---" > $@
cat $< >> $@
features.md: c-ares.git/FEATURES.md
echo "---\nlayout: page\ntitle: \"\"\nmenu: Features\npermalink: /features/\n---" > $@
cat $< >> $@
$(DEPFILES): $(DEPDIR)
include $(DEPFILES)
all: $(PAGES)
.PHONY: all
clean:
find . -name "*~" -exec rm {} \;
rm -rf $(PAGES) $(DOCSDEST)/*.raw
rm -rf $(DEPDIR)