]>
Commit | Line | Data |
---|---|---|
85f76ac9 | 1 | all: youtube-dl README.md youtube-dl.1 youtube-dl.bash-completion LATEST_VERSION |
85f76ac9 | 2 | # TODO: re-add youtube-dl.exe, and make sure it's 1. safe and 2. doesn't need sudo |
4618f3da | 3 | |
85f76ac9 PH |
4 | clean: |
5 | rm -f youtube-dl youtube-dl.exe youtube-dl.1 LATEST_VERSION | |
4618f3da | 6 | |
0e841bdc | 7 | PREFIX=/usr/local |
e79e8b7d TM |
8 | BINDIR=$(PREFIX)/bin |
9 | MANDIR=$(PREFIX)/man | |
10 | SYSCONFDIR=/etc | |
11 | ||
dce10884 | 12 | install: youtube-dl youtube-dl.1 youtube-dl.bash-completion |
e79e8b7d TM |
13 | install -d $(DESTDIR)$(BINDIR) |
14 | install -m 755 youtube-dl $(DESTDIR)$(BINDIR) | |
15 | install -d $(DESTDIR)$(MANDIR)/man1 | |
16 | install -m 644 youtube-dl.1 $(DESTDIR)$(MANDIR)/man1 | |
17 | install -d $(DESTDIR)$(SYSCONFDIR)/bash_completion.d | |
18 | install -m 644 youtube-dl.bash-completion $(DESTDIR)$(SYSCONFDIR)/bash_completion.d/youtube-dl | |
dce10884 | 19 | |
85f76ac9 | 20 | .PHONY: all clean install README.md youtube-dl.bash-completion |
20326b8b | 21 | # TODO un-phony README.md and youtube-dl.bash_completion by reading from .in files and generating from them |
dce10884 FV |
22 | |
23 | youtube-dl: youtube_dl/*.py | |
24 | zip --quiet --junk-paths youtube-dl youtube_dl/*.py | |
25 | echo '#!/usr/bin/env python' > youtube-dl | |
26 | cat youtube-dl.zip >> youtube-dl | |
27 | rm youtube-dl.zip | |
85f76ac9 | 28 | chmod a+x youtube-dl |
dce10884 FV |
29 | |
30 | youtube-dl.exe: youtube_dl/*.py | |
31 | bash devscripts/wine-py2exe.sh build_exe.py | |
4618f3da | 32 | |
646b885c | 33 | README.md: youtube_dl/*.py |
20326b8b | 34 | @options=$$(COLUMNS=80 python -m youtube_dl --help | sed -e '1,/.*General Options.*/ d' -e 's/^\W\{2\}\(\w\)/## \1/') && \ |
cfcec693 FV |
35 | header=$$(sed -e '/.*# OPTIONS/,$$ d' README.md) && \ |
36 | footer=$$(sed -e '1,/.*# FAQ/ d' README.md) && \ | |
4618f3da | 37 | echo "$${header}" > README.md && \ |
66e87777 | 38 | echo >> README.md && \ |
cfcec693 | 39 | echo '# OPTIONS' >> README.md && \ |
4618f3da | 40 | echo "$${options}" >> README.md&& \ |
66e87777 | 41 | echo >> README.md && \ |
cfcec693 | 42 | echo '# FAQ' >> README.md && \ |
4618f3da PH |
43 | echo "$${footer}" >> README.md |
44 | ||
dce10884 | 45 | youtube-dl.1: README.md |
cfcec693 FV |
46 | pandoc -s -w man README.md -o youtube-dl.1 |
47 | ||
dce10884 | 48 | youtube-dl.bash-completion: README.md |
ce7b2a40 FV |
49 | @options=`egrep -o '(--[a-z-]+) ' README.md | sort -u | xargs echo` && \ |
50 | content=`sed "s/opts=\"[^\"]*\"/opts=\"$${options}\"/g" youtube-dl.bash-completion` && \ | |
51 | echo "$${content}" > youtube-dl.bash-completion | |
4618f3da | 52 | |
646b885c | 53 | LATEST_VERSION: youtube_dl/__init__.py |
20326b8b | 54 | python -m youtube_dl --version > LATEST_VERSION |
b387fb03 | 55 | |
56 | test: | |
edcc7d2d | 57 | nosetests2 --nocapture test |
434d60cd | 58 | |
59 | .PHONY: default compile update update-latest update-readme test clean |