Makefile 5.1 KB

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