Makefile 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. all: youtube-dl README.md README.txt youtube-dl.1 youtube-dl.bash-completion
  2. clean:
  3. rm -rf youtube-dl youtube-dl.exe youtube-dl.1 youtube-dl.bash-completion README.txt MANIFEST build/ dist/
  4. PREFIX=/usr/local
  5. BINDIR=$(PREFIX)/bin
  6. MANDIR=$(PREFIX)/man
  7. SYSCONFDIR=/etc
  8. install: youtube-dl youtube-dl.1 youtube-dl.bash-completion
  9. install -d $(DESTDIR)$(BINDIR)
  10. install -m 755 youtube-dl $(DESTDIR)$(BINDIR)
  11. install -d $(DESTDIR)$(MANDIR)/man1
  12. install -m 644 youtube-dl.1 $(DESTDIR)$(MANDIR)/man1
  13. install -d $(DESTDIR)$(SYSCONFDIR)/bash_completion.d
  14. install -m 644 youtube-dl.bash-completion $(DESTDIR)$(SYSCONFDIR)/bash_completion.d/youtube-dl
  15. test:
  16. nosetests2 --nocapture test
  17. .PHONY: all clean install test
  18. youtube-dl: youtube_dl/*.py
  19. zip --quiet youtube-dl youtube_dl/*.py
  20. zip --quiet --junk-paths youtube-dl youtube_dl/__main__.py
  21. echo '#!/usr/bin/env python' > youtube-dl
  22. cat youtube-dl.zip >> youtube-dl
  23. rm youtube-dl.zip
  24. chmod a+x youtube-dl
  25. README.md: youtube_dl/*.py
  26. @options=$$(COLUMNS=80 python -m youtube_dl --help | sed -e '1,/.*General Options.*/ d' -e 's/^\W\{2\}\(\w\)/## \1/') && \
  27. header=$$(sed -e '/.*# OPTIONS/,$$ d' README.md) && \
  28. footer=$$(sed -e '1,/.*# CONFIGURATION/ d' README.md) && \
  29. echo "$${header}" > README.md && \
  30. echo >> README.md && \
  31. echo '# OPTIONS' >> README.md && \
  32. echo "$${options}" >> README.md&& \
  33. echo >> README.md && \
  34. echo '# CONFIGURATION' >> README.md && \
  35. echo "$${footer}" >> README.md
  36. README.txt: README.md
  37. pandoc -s -f markdown -t plain README.md -o README.txt
  38. youtube-dl.1: README.md
  39. pandoc -s -f markdown -t man README.md -o youtube-dl.1
  40. youtube-dl.bash-completion: README.md youtube-dl.bash-completion.in
  41. @options=`egrep -o '(--[a-z-]+) ' README.md | sort -u | xargs echo` && \
  42. content=`sed "s/opts=\"[^\"]*\"/opts=\"$${options}\"/g" youtube-dl.bash-completion.in` && \
  43. echo "$${content}" > youtube-dl.bash-completion