]> Raphaƫl G. Git Repositories - youtubedl/blob - Makefile
New upstream version 2018.03.14
[youtubedl] / Makefile
1 all: youtube-dl README.md CONTRIBUTING.md README.txt youtube-dl.1 youtube-dl.bash-completion youtube-dl.zsh youtube-dl.fish supportedsites
2
3 clean:
4 rm -rf youtube-dl.1.temp.md youtube-dl.1 youtube-dl.bash-completion README.txt MANIFEST build/ dist/ .coverage cover/ youtube-dl.tar.gz youtube-dl.zsh youtube-dl.fish youtube_dl/extractor/lazy_extractors.py *.dump *.part* *.ytdl *.info.json *.mp4 *.m4a *.flv *.mp3 *.avi *.mkv *.webm *.3gp *.wav *.ape *.swf *.jpg *.png CONTRIBUTING.md.tmp ISSUE_TEMPLATE.md.tmp youtube-dl youtube-dl.exe
5 find . -name "*.pyc" -delete
6 find . -name "*.class" -delete
7
8 PREFIX ?= /usr/local
9 BINDIR ?= $(PREFIX)/bin
10 MANDIR ?= $(PREFIX)/man
11 SHAREDIR ?= $(PREFIX)/share
12 PYTHON ?= /usr/bin/env python
13
14 # set SYSCONFDIR to /etc if PREFIX=/usr or PREFIX=/usr/local
15 SYSCONFDIR = $(shell if [ $(PREFIX) = /usr -o $(PREFIX) = /usr/local ]; then echo /etc; else echo $(PREFIX)/etc; fi)
16
17 install: youtube-dl youtube-dl.1 youtube-dl.bash-completion youtube-dl.zsh youtube-dl.fish
18 install -d $(DESTDIR)$(BINDIR)
19 install -m 755 youtube-dl $(DESTDIR)$(BINDIR)
20 install -d $(DESTDIR)$(MANDIR)/man1
21 install -m 644 youtube-dl.1 $(DESTDIR)$(MANDIR)/man1
22 install -d $(DESTDIR)$(SYSCONFDIR)/bash_completion.d
23 install -m 644 youtube-dl.bash-completion $(DESTDIR)$(SYSCONFDIR)/bash_completion.d/youtube-dl
24 install -d $(DESTDIR)$(SHAREDIR)/zsh/site-functions
25 install -m 644 youtube-dl.zsh $(DESTDIR)$(SHAREDIR)/zsh/site-functions/_youtube-dl
26 install -d $(DESTDIR)$(SYSCONFDIR)/fish/completions
27 install -m 644 youtube-dl.fish $(DESTDIR)$(SYSCONFDIR)/fish/completions/youtube-dl.fish
28
29 codetest:
30 flake8 .
31
32 test:
33 #nosetests --with-coverage --cover-package=youtube_dl --cover-html --verbose --processes 4 test
34 nosetests --verbose test
35 $(MAKE) codetest
36
37 ot: offlinetest
38
39 # Keep this list in sync with devscripts/run_tests.sh
40 offlinetest: codetest
41 $(PYTHON) -m nose --verbose test \
42 --exclude test_age_restriction.py \
43 --exclude test_download.py \
44 --exclude test_iqiyi_sdk_interpreter.py \
45 --exclude test_socks.py \
46 --exclude test_subtitles.py \
47 --exclude test_write_annotations.py \
48 --exclude test_youtube_lists.py \
49 --exclude test_youtube_signature.py
50
51 tar: youtube-dl.tar.gz
52
53 .PHONY: all clean install test tar bash-completion pypi-files zsh-completion fish-completion ot offlinetest codetest supportedsites
54
55 pypi-files: youtube-dl.bash-completion README.txt youtube-dl.1 youtube-dl.fish
56
57 youtube-dl: youtube_dl/*.py youtube_dl/*/*.py
58 mkdir -p zip
59 for d in youtube_dl youtube_dl/downloader youtube_dl/extractor youtube_dl/postprocessor ; do \
60 mkdir -p zip/$$d ;\
61 cp -pPR $$d/*.py zip/$$d/ ;\
62 done
63 touch -t 200001010101 zip/youtube_dl/*.py zip/youtube_dl/*/*.py
64 mv zip/youtube_dl/__main__.py zip/
65 cd zip ; zip -q ../youtube-dl youtube_dl/*.py youtube_dl/*/*.py __main__.py
66 rm -rf zip
67 echo '#!$(PYTHON)' > youtube-dl
68 cat youtube-dl.zip >> youtube-dl
69 rm youtube-dl.zip
70 chmod a+x youtube-dl
71
72 README.md: youtube_dl/*.py youtube_dl/*/*.py
73 COLUMNS=80 $(PYTHON) youtube_dl/__main__.py --help | $(PYTHON) devscripts/make_readme.py
74
75 CONTRIBUTING.md: README.md
76 $(PYTHON) devscripts/make_contributing.py README.md CONTRIBUTING.md
77
78 .github/ISSUE_TEMPLATE.md: devscripts/make_issue_template.py .github/ISSUE_TEMPLATE_tmpl.md youtube_dl/version.py
79 $(PYTHON) devscripts/make_issue_template.py .github/ISSUE_TEMPLATE_tmpl.md .github/ISSUE_TEMPLATE.md
80
81 supportedsites:
82 $(PYTHON) devscripts/make_supportedsites.py docs/supportedsites.md
83
84 README.txt: README.md
85 pandoc -f markdown -t plain README.md -o README.txt
86
87 youtube-dl.1: README.md
88 $(PYTHON) devscripts/prepare_manpage.py youtube-dl.1.temp.md
89 pandoc -s -f markdown -t man youtube-dl.1.temp.md -o youtube-dl.1
90 rm -f youtube-dl.1.temp.md
91
92 youtube-dl.bash-completion: youtube_dl/*.py youtube_dl/*/*.py devscripts/bash-completion.in
93 $(PYTHON) devscripts/bash-completion.py
94
95 bash-completion: youtube-dl.bash-completion
96
97 youtube-dl.zsh: youtube_dl/*.py youtube_dl/*/*.py devscripts/zsh-completion.in
98 $(PYTHON) devscripts/zsh-completion.py
99
100 zsh-completion: youtube-dl.zsh
101
102 youtube-dl.fish: youtube_dl/*.py youtube_dl/*/*.py devscripts/fish-completion.in
103 $(PYTHON) devscripts/fish-completion.py
104
105 fish-completion: youtube-dl.fish
106
107 lazy-extractors: youtube_dl/extractor/lazy_extractors.py
108
109 _EXTRACTOR_FILES = $(shell find youtube_dl/extractor -iname '*.py' -and -not -iname 'lazy_extractors.py')
110 youtube_dl/extractor/lazy_extractors.py: devscripts/make_lazy_extractors.py devscripts/lazy_load_template.py $(_EXTRACTOR_FILES)
111 $(PYTHON) devscripts/make_lazy_extractors.py $@
112
113 youtube-dl.tar.gz: youtube-dl README.md README.txt youtube-dl.1 youtube-dl.bash-completion youtube-dl.zsh youtube-dl.fish ChangeLog AUTHORS
114 @tar -czf youtube-dl.tar.gz --transform "s|^|youtube-dl/|" --owner 0 --group 0 \
115 --exclude '*.DS_Store' \
116 --exclude '*.kate-swp' \
117 --exclude '*.pyc' \
118 --exclude '*.pyo' \
119 --exclude '*~' \
120 --exclude '__pycache__' \
121 --exclude '.git' \
122 --exclude 'docs/_build' \
123 -- \
124 bin devscripts test youtube_dl docs \
125 ChangeLog AUTHORS LICENSE README.md README.txt \
126 Makefile MANIFEST.in youtube-dl.1 youtube-dl.bash-completion \
127 youtube-dl.zsh youtube-dl.fish setup.py setup.cfg \
128 youtube-dl