Skip to content

Commit

Permalink
Add makefile target to produce man page.
Browse files Browse the repository at this point in the history
Thanks to ber532k for the idea.
  • Loading branch information
wangp committed Aug 5, 2017
1 parent c0e45ee commit ff95a1e
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ Mercury/
*.err
*.mh
tags
bower.1
8 changes: 8 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
.PHONY: bower
bower:
@$(MAKE) -C src ../bower

.PHONY: man
man: bower.1

bower.1: README.md make_man
./make_man < README.md | \
pandoc -f markdown -t man --standalone \
-M title=bower -M section=1 -o bower.1
13 changes: 13 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,13 @@ At run time:
* lynx to dump HTML emails (configurable)
* file(1) to detect MIME types when adding attachments

To create a man page from this readme, you will need:

* [pandoc] universal document converter
* awk

[pandoc]: https://github.com/jgm/pandoc


Compiling
=========
Expand All @@ -54,6 +61,12 @@ With Mercury installed and `mmc` in your PATH, run:
You may want to edit `Mercury.options` to suit your system.
If successful, you will get a binary named `bower`.

To generate a man page, run:

make man

This will produce `bower.1` for installation into your `man` search path.


Configuration
=============
Expand Down
21 changes: 21 additions & 0 deletions make_man
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/usr/bin/awk -f

BEGIN {
output = 1;
}

/^See some.*screen shots/ {
next;
}

/^Requirements$/ {
output = 0;
}

/^Configuration$/ {
output = 1;
}

output {
print
}

0 comments on commit ff95a1e

Please sign in to comment.