auto-generating manpage from README.md (closes #151); redesigned Makefile
[youtube-dl] / Makefile
1 all: compile exe readme man-page update-latest
2
3 update-latest:
4         ./youtube-dl --version > LATEST_VERSION
5
6 readme:
7         @options=$$(COLUMNS=80 ./youtube-dl --help | sed -e '1,/.*General Options.*/ d' -e 's/^\W\{2\}\(\w\)/## \1/') && \
8                 header=$$(sed -e '/.*# OPTIONS/,$$ d' README.md) && \
9                 footer=$$(sed -e '1,/.*# FAQ/ d' README.md) && \
10                 echo "$${header}" > README.md && \
11                 echo >> README.md && \
12                 echo '# OPTIONS' >> README.md && \
13                 echo "$${options}" >> README.md&& \
14                 echo >> README.md && \
15                 echo '# FAQ' >> README.md && \
16                 echo "$${footer}" >> README.md
17
18 man-page:
19         pandoc -s -w man README.md -o youtube-dl.1
20
21 compile:
22         zip --quiet --junk-paths youtube-dl youtube_dl/*.py
23         echo '#!/usr/bin/env python' > youtube-dl
24         cat youtube-dl.zip >> youtube-dl
25         rm youtube-dl.zip
26
27 exe:
28         bash devscripts/wine-py2exe.sh build_exe.py
29
30 install:
31         install -m 755 --owner root --group root youtube-dl /usr/local/bin/
32         install -m 644 --owner root --group root youtube-dl.1 /usr/local/man/man1
33
34 .PHONY: all update-latest readme man-page compile exe install