]> woffs.de Git - fd/haskell-amqp-utils.git/blob - doc/Makefile
LineBuffering
[fd/haskell-amqp-utils.git] / doc / Makefile
1 # SPDX-FileCopyrightText: 2022 Frank Doepper
2 #
3 # SPDX-License-Identifier: GPL-3.0-only
4
5 DESTDIR=
6 pfx = /usr/local
7
8 build: konsum.1 agitprop.1 arbeite.1 plane.1
9
10 doc: konsum.md agitprop.md arbeite.md plane.md
11
12 callbacks.readme: callbacks.md
13         tail -n +7 $^ | perl -pe 's/^(?=# ENV)/##/' > $@
14
15 footer.readme: footer.md
16         tail -n +7 $^ > $@
17
18 %.readme: %.head %.options %.rest
19         tail -n +15 $*.head | perl -ne 'if(s/^# NAME/## /){chomp;print;next;} next if /^# (SYNOPSIS|DESCRIPTION)/; s/^#/###/; print' > $@
20         perl -pe 's/^#/###/' $*.options >> $@
21         tail -n +6 $*.rest | perl -pe 's/^#/###/' >> $@
22
23 ../README.md: header.md konsum.readme agitprop.readme plane.readme arbeite.readme callbacks.readme footer.readme
24         cat $^ > $@
25
26 EXTRA =
27 konsum.md arbeite.md: EXTRA = callbacks.md
28 %.md: %.head %.options %.rest
29         cat $^ $(EXTRA) > $@
30
31 %.1: %.md
32         pandoc -s $< -f markdown -t man -o $@
33
34 %.options: ../dist/build/%
35         ../dist/build/$*/$* --help 2>&1 | perl -ne 'print "    $$_" if /^Options/../^\(/' | head -n-1 | tail +2 > $@
36
37 clean:
38         rm -f *.options *.readme *.1
39
40 install: konsum.1 agitprop.1 arbeite.1 plane.1
41         install -d -m755 $(DESTDIR)$(pfx)/share/man/man1
42         install -m644 $^ $(DESTDIR)$(pfx)/share/man/man1/