Skip to content

Commit

Permalink
generate manpages
Browse files Browse the repository at this point in the history
  • Loading branch information
bradh352 committed Jul 4, 2024
1 parent 7b84112 commit 495e353
Show file tree
Hide file tree
Showing 4 changed files with 54 additions and 1 deletion.
3 changes: 3 additions & 0 deletions .github/workflows/deploy-pages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,9 @@ jobs:
sudo make install
- name: Setup Pages
uses: actions/configure-pages@v5
- name: Build external pages
run: |
make
- name: Build with Jekyll
uses: actions/jekyll-build-pages@v1
with:
Expand Down
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
Gemfile.lock
_site
.sass-cache
.deps
c-ares.git
roffit.git
docs

44 changes: 44 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
.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)

$(DEPDIR):
mkdir -p $@

$(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 "---" > $(DOCSDEST)/$*.html
echo "layout: page" >> $(DOCSDEST)/$*.html
echo "---" >> $(DOCSDEST)/$*.html
cat $(DOCSDEST)/$*.raw >> $(DOCSDEST)/$*.html
rm -f $(DOCSDEST)$*.raw

$(DEPFILES): $(DOCSDEST) $(DEPDIR)

include $(DEPFILES)

all: $(PAGES)

.PHONY: all

clean:
find . -name "*~" -exec rm {} \;
rm -rf $(DOCSDEST)/*.html $(DOCSDEST)/*.raw
rm -rf $(DEPDIR)

3 changes: 2 additions & 1 deletion _config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,4 +40,5 @@ exclude:
- c-ares.git
- roffit.git
- Makefile

- docs/*.raw
- .deps

0 comments on commit 495e353

Please sign in to comment.