]> jfr.im git - yt-dlp.git/blob - Makefile
removing extended globbing for the find utility
[yt-dlp.git] / Makefile
1 all: youtube-dl README.md youtube-dl.1 youtube-dl.bash-completion LATEST_VERSION
2 # TODO: re-add youtube-dl.exe, and make sure it's 1. safe and 2. doesn't need sudo
3
4 clean:
5 rm -f youtube-dl youtube-dl.exe youtube-dl.1 LATEST_VERSION
6
7 PREFIX=/usr/local
8 install: youtube-dl youtube-dl.1 youtube-dl.bash-completion
9 install -m 755 --owner root --group root youtube-dl $(PREFIX)/bin/
10 install -m 644 --owner root --group root youtube-dl.1 $(PREFIX)/man/man1
11 install -m 644 --owner root --group root youtube-dl.bash-completion /etc/bash_completion.d/youtube-dl
12
13 .PHONY: all clean install README.md youtube-dl.bash-completion
14 # TODO un-phony README.md and youtube-dl.bash_completion by reading from .in files and generating from them
15
16 youtube-dl: youtube_dl/*.py
17 zip --quiet --junk-paths youtube-dl youtube_dl/*.py
18 echo '#!/usr/bin/env python' > youtube-dl
19 cat youtube-dl.zip >> youtube-dl
20 rm youtube-dl.zip
21 chmod a+x youtube-dl
22
23 youtube-dl.exe: youtube_dl/*.py
24 bash devscripts/wine-py2exe.sh build_exe.py
25
26 README.md: youtube_dl/*.py
27 @options=$$(COLUMNS=80 python -m youtube_dl --help | sed -e '1,/.*General Options.*/ d' -e 's/^\W\{2\}\(\w\)/## \1/') && \
28 header=$$(sed -e '/.*# OPTIONS/,$$ d' README.md) && \
29 footer=$$(sed -e '1,/.*# FAQ/ d' README.md) && \
30 echo "$${header}" > README.md && \
31 echo >> README.md && \
32 echo '# OPTIONS' >> README.md && \
33 echo "$${options}" >> README.md&& \
34 echo >> README.md && \
35 echo '# FAQ' >> README.md && \
36 echo "$${footer}" >> README.md
37
38 youtube-dl.1: README.md
39 pandoc -s -w man README.md -o youtube-dl.1
40
41 youtube-dl.bash-completion: README.md
42 @options=`egrep -o '(--[a-z-]+) ' README.md | sort -u | xargs echo` && \
43 content=`sed "s/opts=\"[^\"]*\"/opts=\"$${options}\"/g" youtube-dl.bash-completion` && \
44 echo "$${content}" > youtube-dl.bash-completion
45
46 LATEST_VERSION: youtube_dl/__init__.py
47 python -m youtube_dl --version > LATEST_VERSION
48
49 test:
50 nosetests2 test/*
51
52 clean:
53 find -name "*.pyc" -delete
54
55 .PHONY: default compile update update-latest update-readme test clean