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.

47 lines
1.9 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
  5. PREFIX=/usr/local
  6. install: youtube-dl youtube-dl.1 youtube-dl.bash-completion
  7. install -m 755 --owner root --group root youtube-dl $(PREFIX)/bin/
  8. install -m 644 --owner root --group root youtube-dl.1 $(PREFIX)/man/man1
  9. install -m 644 --owner root --group root youtube-dl.bash-completion /etc/bash_completion.d/youtube-dl
  10. .PHONY: all clean install README.md youtube-dl.bash-completion
  11. # TODO un-phony README.md and youtube-dl.bash_completion by reading from .in files and generating from them
  12. youtube-dl: youtube_dl/*.py
  13. zip --quiet --junk-paths youtube-dl youtube_dl/*.py
  14. echo '#!/usr/bin/env python' > youtube-dl
  15. cat youtube-dl.zip >> youtube-dl
  16. rm youtube-dl.zip
  17. chmod a+x youtube-dl
  18. youtube-dl.exe: youtube_dl/*.py
  19. bash devscripts/wine-py2exe.sh build_exe.py
  20. README.md: youtube_dl/*.py
  21. @options=$$(COLUMNS=80 python -m youtube_dl --help | sed -e '1,/.*General Options.*/ d' -e 's/^\W\{2\}\(\w\)/## \1/') && \
  22. header=$$(sed -e '/.*# OPTIONS/,$$ d' README.md) && \
  23. footer=$$(sed -e '1,/.*# FAQ/ d' README.md) && \
  24. echo "$${header}" > README.md && \
  25. echo >> README.md && \
  26. echo '# OPTIONS' >> README.md && \
  27. echo "$${options}" >> README.md&& \
  28. echo >> README.md && \
  29. echo '# FAQ' >> README.md && \
  30. echo "$${footer}" >> README.md
  31. youtube-dl.1: README.md
  32. pandoc -s -w man README.md -o youtube-dl.1
  33. youtube-dl.bash-completion: README.md
  34. @options=`egrep -o '(--[a-z-]+) ' README.md | sort -u | xargs echo` && \
  35. content=`sed "s/opts=\"[^\"]*\"/opts=\"$${options}\"/g" youtube-dl.bash-completion` && \
  36. echo "$${content}" > youtube-dl.bash-completion
  37. LATEST_VERSION: youtube_dl/__init__.py
  38. python -m youtube_dl --version > LATEST_VERSION