]> arthur.barton.de Git - bup.git/commitdiff
Infrastructure for generating a markdown-based man page using pandoc.
authorAvery Pennarun <apenwarr@gmail.com>
Sun, 24 Jan 2010 03:09:15 +0000 (22:09 -0500)
committerAvery Pennarun <apenwarr@gmail.com>
Fri, 5 Feb 2010 23:59:16 +0000 (18:59 -0500)
The man page (bup.1) is total drivel for the moment, though.  And arguably
we could split up the manpages per subcommand like git does, but maybe
that's overkill at this stage.

.gitignore
Documentation/.gitignore [new file with mode: 0644]
Documentation/Makefile [new file with mode: 0644]
Documentation/bup.1.md [new file with mode: 0644]
Makefile

index 88644b65598835c20cd63934e63e62a2591669c7..42c846523d463f565dfb78b616cf9ed8ba79dd48 100644 (file)
@@ -1,5 +1,5 @@
-bup
-bup-*
+/bup
+/bup-*
 randomgen
 memtest
 *.o
diff --git a/Documentation/.gitignore b/Documentation/.gitignore
new file mode 100644 (file)
index 0000000..764de28
--- /dev/null
@@ -0,0 +1,2 @@
+*.[0-9]
+*.html
diff --git a/Documentation/Makefile b/Documentation/Makefile
new file mode 100644 (file)
index 0000000..0b494a9
--- /dev/null
@@ -0,0 +1,33 @@
+PANDOC:=$(shell \
+       if pandoc </dev/null 2>/dev/null; then \
+               echo pandoc; \
+       else \
+               echo "Warning: pandoc not installed; can't generate manpages." >&2; \
+               echo '@echo Skipping: pandoc'; \
+       fi)
+BUP_VERSION=$(shell git describe --match 'bup-*' | sed 's/^bup-//')
+BUP_DATE=$(shell git log --no-walk --pretty='%ci%n' | (read x y && echo $$x))
+
+default: all
+
+all: man html
+
+man: $(patsubst %.md,%,$(wildcard *.md))
+
+html: $(patsubst %.1.md,%.html,$(wildcard *.md))
+
+%: %.md.tmp Makefile
+       $(PANDOC) -s -r markdown -w man -o $@ $<
+       
+%.html: %.1.md.tmp Makefile
+       $(PANDOC) -s -r markdown -w html -o $@ $<
+       
+.PRECIOUS: %.1.md.tmp
+%.md.tmp: %.md Makefile
+       rm -f $@ $@.new
+       sed -e 's,%BUP_VERSION%,${BUP_VERSION},g' \
+           -e 's,%BUP_DATE%,${BUP_DATE},g' <$< >$@.new
+       mv $@.new $@
+
+clean:
+       rm -f *~ .*~ *.[0-9] *.new *.tmp *.html
diff --git a/Documentation/bup.1.md b/Documentation/bup.1.md
new file mode 100644 (file)
index 0000000..2f09f46
--- /dev/null
@@ -0,0 +1,59 @@
+% bup(1) Bup %BUP_VERSION%
+% Avery Pennarun <apenwarr@gmail.com>
+% %BUP_DATE%
+
+# NAME
+
+bup - Backup program using rolling checksums and git file formats
+
+# SYNOPSIS
+
+bup [*options*] [*input-file*]...
+
+# DESCRIPTION
+
+This is the sample description.
+
+    embeddeded code
+    more code
+  
+More stuff.
+
+## Subsection
+
+Yay!
+
+- this is a list.
+
+- another list item.
+
+    list continuation.
+    
+- another item.
+
+        with some code
+        and more code
+
+1. numbered item.
+
+1. another numbered item.
+
+    - with a list
+    - of items
+    - that say stuff
+
+1. yet another number.
+
+# OPTIONS
+
+-o, --output=*output*
+:   the stuff about the term
+
+--hello
+:   more stuff
+
+# SEE ALSO
+
+`git`(1) and the *README* file from the bup distribution.
+
+The home of bup is at <http://github.com/apenwarr/bup/>.
index a007484646be1f3206681fdf97534ba11c522e7f..fc415de00b7b96d788991a8e041df16c6b7e4c64 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -21,7 +21,14 @@ default: all
 
 all: bup-split bup-join bup-save bup-init bup-server bup-index bup-tick \
        bup-midx bup-fuse bup-ls bup-damage bup-fsck bup-margin bup-drecurse \
-       bup memtest randomgen$(EXT) _hashsplit$(SOEXT)
+       bup memtest randomgen$(EXT) _hashsplit$(SOEXT) \
+       Documentation/all
+       
+%/all:
+       $(MAKE) -C $* all
+       
+%/clean:
+       $(MAKE) -C $* clean
 
 randomgen$(EXT): randomgen.o
        $(CC) $(CFLAGS) -o $@ $<
@@ -67,7 +74,7 @@ bup-%: cmd-%.sh
 %.o: %.c
        gcc -c -o $@ $< $(CPPFLAGS) $(CFLAGS)
 
-clean:
+clean: Documentation/clean
        rm -f *.o *.so *.dll *.exe *~ .*~ *.pyc */*.pyc */*~ \
                bup bup-* randomgen memtest \
                out[12] out2[tc] tags[12] tags2[tc]