2
0

Makefile 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. all: compile exe readme man-page bash-completion update-latest
  2. update-latest:
  3. ./youtube-dl --version > LATEST_VERSION
  4. readme:
  5. @options=$$(COLUMNS=80 ./youtube-dl --help | sed -e '1,/.*General Options.*/ d' -e 's/^\W\{2\}\(\w\)/## \1/') && \
  6. header=$$(sed -e '/.*# OPTIONS/,$$ d' README.md) && \
  7. footer=$$(sed -e '1,/.*# FAQ/ d' README.md) && \
  8. echo "$${header}" > README.md && \
  9. echo >> README.md && \
  10. echo '# OPTIONS' >> README.md && \
  11. echo "$${options}" >> README.md&& \
  12. echo >> README.md && \
  13. echo '# FAQ' >> README.md && \
  14. echo "$${footer}" >> README.md
  15. man-page:
  16. pandoc -s -w man README.md -o youtube-dl.1
  17. bash-completion:
  18. @options=`egrep -o '(--[a-z-]+) ' README.md | sort -u | xargs echo` && \
  19. content=`sed "s/opts=\"[^\"]*\"/opts=\"$${options}\"/g" youtube-dl.bash-completion` && \
  20. echo "$${content}" > youtube-dl.bash-completion
  21. compile:
  22. zip --quiet --junk-paths youtube-dl youtube_dl/*.py
  23. echo '#!/usr/bin/env python' > youtube-dl
  24. cat youtube-dl.zip >> youtube-dl
  25. rm youtube-dl.zip
  26. exe:
  27. bash devscripts/wine-py2exe.sh build_exe.py
  28. install:
  29. install -m 755 --owner root --group root youtube-dl /usr/local/bin/
  30. install -m 644 --owner root --group root youtube-dl.1 /usr/local/man/man1
  31. install -m 644 --owner root --group root youtube-dl.bash-completion /etc/bash_completion.d/youtube-dl
  32. release:
  33. @if [ -z "$$version" ]; then echo 'ERROR: specify version number like this: make release version=1994.09.06'; exit 1; fi
  34. @if [ ! -z "`git tag | grep "$$version"`" ]; then echo 'ERROR: version already present'; exit 1; fi
  35. @if [ ! -z "`git status --porcelain`" ]; then echo 'ERROR: the working directory is not clean; commit or stash changes'; exit 1; fi
  36. @sed -i "s/__version__ = '.*'/__version__ = '$$version'/" youtube_dl/__init__.py
  37. make all
  38. git add -A
  39. git commit -m "release $$version"
  40. git tag -m "Release $$version" "$$version"
  41. .PHONY: all update-latest readme man-page bash-completion compile exe install release