]> jfr.im git - yt-dlp.git/blob - Makefile
added one-step realese script 'make release version=nn' - closes #158
[yt-dlp.git] / Makefile
1 all: compile exe readme man-page bash-completion 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 bash-completion:
22 @options=`egrep -o '(--[a-z-]+) ' README.md | sort -u | xargs echo` && \
23 content=`sed "s/opts=\"[^\"]*\"/opts=\"$${options}\"/g" youtube-dl.bash-completion` && \
24 echo "$${content}" > youtube-dl.bash-completion
25
26 compile:
27 zip --quiet --junk-paths youtube-dl youtube_dl/*.py
28 echo '#!/usr/bin/env python' > youtube-dl
29 cat youtube-dl.zip >> youtube-dl
30 rm youtube-dl.zip
31
32 exe:
33 bash devscripts/wine-py2exe.sh build_exe.py
34
35 install:
36 install -m 755 --owner root --group root youtube-dl /usr/local/bin/
37 install -m 644 --owner root --group root youtube-dl.1 /usr/local/man/man1
38 install -m 644 --owner root --group root youtube-dl.bash-completion /etc/bash_completion.d/youtube-dl
39
40 release:
41 @if [ -z "$$version" ]; then echo 'ERROR: specify version number like this: make release version=1994.09.06'; exit 1; fi
42 @if [ ! -z "`git tag | grep "$$version"`" ]; then echo 'ERROR: version already present'; exit 1; fi
43 @if [ ! -z "`git status --porcelain`" ]; then echo 'ERROR: the working directory is not clean; commit or stash changes'; exit 1; fi
44 @sed -i "s/__version__ = '.*'/__version__ = '$$version'/" youtube_dl/__init__.py
45 make all
46 git add -A
47 git commit -m "release $$version"
48 git tag -m "Release $$version" "$$version"
49
50 .PHONY: all update-latest readme man-page bash-completion compile exe install release