]>
Commit | Line | Data |
---|---|---|
1 | all: youtube-dl README.md README.txt youtube-dl.1 youtube-dl.bash-completion | |
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 -rf youtube-dl youtube-dl.exe youtube-dl.1 youtube-dl.bash-completion README.txt MANIFEST build/ dist/ | |
6 | ||
7 | PREFIX=/usr/local | |
8 | BINDIR=$(PREFIX)/bin | |
9 | MANDIR=$(PREFIX)/man | |
10 | SYSCONFDIR=/etc | |
11 | ||
12 | install: youtube-dl youtube-dl.1 youtube-dl.bash-completion | |
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 | |
19 | ||
20 | test: | |
21 | nosetests2 --nocapture test | |
22 | ||
23 | .PHONY: all clean install test | |
24 | ||
25 | youtube-dl: youtube_dl/*.py | |
26 | zip --quiet youtube-dl youtube_dl/*.py | |
27 | zip --quiet --junk-paths youtube-dl youtube_dl/__main__.py | |
28 | echo '#!/usr/bin/env python' > youtube-dl | |
29 | cat youtube-dl.zip >> youtube-dl | |
30 | rm youtube-dl.zip | |
31 | chmod a+x youtube-dl | |
32 | ||
33 | youtube-dl.exe: youtube_dl/*.py | |
34 | bash devscripts/wine-py2exe.sh build_exe.py | |
35 | ||
36 | README.md: youtube_dl/*.py | |
37 | @options=$$(COLUMNS=80 python -m youtube_dl --help | sed -e '1,/.*General Options.*/ d' -e 's/^\W\{2\}\(\w\)/## \1/') && \ | |
38 | header=$$(sed -e '/.*# OPTIONS/,$$ d' README.md) && \ | |
39 | footer=$$(sed -e '1,/.*# CONFIGURATION/ d' README.md) && \ | |
40 | echo "$${header}" > README.md && \ | |
41 | echo >> README.md && \ | |
42 | echo '# OPTIONS' >> README.md && \ | |
43 | echo "$${options}" >> README.md&& \ | |
44 | echo >> README.md && \ | |
45 | echo '# CONFIGURATION' >> README.md && \ | |
46 | echo "$${footer}" >> README.md | |
47 | ||
48 | README.txt: README.md | |
49 | pandoc -f markdown -t plain README.md -o README.txt | |
50 | ||
51 | youtube-dl.1: README.md | |
52 | pandoc -f markdown -t man README.md -o youtube-dl.1 | |
53 | ||
54 | youtube-dl.bash-completion: README.md youtube-dl.bash-completion.in | |
55 | @options=`egrep -o '(--[a-z-]+) ' README.md | sort -u | xargs echo` && \ | |
56 | content=`sed "s/opts=\"[^\"]*\"/opts=\"$${options}\"/g" youtube-dl.bash-completion.in` && \ | |
57 | echo "$${content}" > youtube-dl.bash-completion |