Makefile 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. include_dir=build
  2. source=""chapters/documents.md chapters/graphics.md chapters/chrome-plugins.md chapters/devices.md chapters/ops.md chapters/auto.md chapters/hardware.md chapters/api.md chapters/cli.md chapters/backend.md chapters/science.md chapters/image.md""
  3. title='一个全栈工程师的工具箱'
  4. filename='ebook'
  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 $(title) \
  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. --listings -H listings-setup.tex \
  39. --template=template/template.tex \
  40. --normalize \
  41. --smart \
  42. --toc \
  43. --latex-engine=`which xelatex`
  44. mobi: epub
  45. # Symlink bin: ln -s /path/to/kindlegen /usr/local/bin
  46. kindlegen $(filename).epub