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