You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

59 lines
2.1 KiB

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