Makefile 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. include_dir=build
  2. source=chapters/*.md
  3. title='Growth'
  4. filename='growth'
  5. all: html epub rtf pdf mobi
  6. markdown:
  7. awk 'FNR==1{print ""}{print}' $(source) > $(filename).md
  8. html: markdown
  9. pandoc -s $(filename).md -t html5 -o index.html -c style.css \
  10. --include-in-header $(include_dir)/head.html \
  11. --include-before-body $(include_dir)/author.html \
  12. --include-before-body $(include_dir)/share.html \
  13. --include-after-body $(include_dir)/stats.html \
  14. --title-prefix "Growth 实战篇 Django版" \
  15. --normalize \
  16. --smart \
  17. --toc
  18. epub: markdown
  19. pandoc -s $(filename).md --normalize --smart -t epub -o $(filename).epub \
  20. --epub-metadata $(include_dir)/metadata.xml \
  21. --epub-stylesheet epub.css \
  22. --epub-cover-image img/cover.jpg \
  23. --title-prefix $(title) \
  24. --normalize \
  25. --smart \
  26. --toc
  27. rtf: markdown
  28. pandoc -s $(filename).md -o $(filename).rtf \
  29. --title-prefix $(title) \
  30. --normalize \
  31. --smart
  32. pdf: markdown
  33. # OS X: http://www.tug.org/mactex/
  34. # Then find its path: find /usr/ -name "pdflatex"
  35. # Then symlink it: ln -s /path/to/pdflatex /usr/local/bin
  36. pandoc -s $(filename).md -o $(filename).pdf \
  37. --title-prefix $(title) \
  38. --template=template/template.tex \
  39. --normalize \
  40. --smart \
  41. --toc \
  42. --latex-engine=`which xelatex`
  43. mobi: epub
  44. # Symlink bin: ln -s /path/to/kindlegen /usr/local/bin
  45. kindlegen $(filename).epub