Browse files

Rewrite Makefile

  • Loading branch information...
1 parent da0a1df commit 0614b46eb2a6bdd3c87b78a454c5d7ab266242a2 @sindresorhus sindresorhus committed Nov 1, 2012
Showing with 40 additions and 43 deletions.
  1. +40 −27 Makefile
  2. +0 −16 build/build.sh
View
67 Makefile
@@ -1,34 +1,47 @@
-
include_dir=build
-pandoc=`which pandoc`
source=index.md
-title="Developing Backbone.js Applications"
-filename="backbone-fundamentals"
-pdflatex=`which pdflatex`
+title='Developing Backbone.js Applications'
+filename='backbone-fundamentals'
+
+
+all: html epub rtf pdf mobi
-all: pdf html epub rtf
+html:
+ pandoc -s $(source) -t html5 -o index.html -c style.css \
+ --include-in-header $(include_dir)/head.html \
+ --include-before-body $(include_dir)/author.html \
+ --include-before-body $(include_dir)/share.html \
+ --include-after-body $(include_dir)/stats.html \
+ --title-prefix $(title) \
+ --normalize \
+ --smart
-pdf: $(sorce)
- $(pandoc) -s $(source) -o $(filename).tex -w latex \
- --title-prefix=$(filename)
- $(pdflatex) $(filename).tex
+epub:
+ pandoc -s $(source) --normalize --smart -t epub -o $(filename).epub \
+ --epub-metadata $(include_dir)/metadata.xml \
+ --epub-stylesheet epub.css \
+ --epub-cover-image img/cover.jpg \
+ --title-prefix $(title) \
+ --normalize \
+ --smart
-html: $(source)
- $(pandoc) -s $(source) -o index.html -c style.css \
- --include-in-header=$(include_dir)/head.html \
- --include-before-body=$(include_dir)/author.html \
- --include-before-body=$(include_dir)/share.html \
- --include-after-body=$(include_dir)/stats.html \
- --title-prefix=$(title)
+rtf:
+ pandoc -s $(source) -o $(filename).rtf \
+ --title-prefix $(filename) \
+ --normalize \
+ --smart
-epub: $(source)
- $(pandoc) -s $(source) -t epub --epub-metadata=$(include_dir)/metadata.xml \
- -o $(filename).epub --epub-stylesheet=epub.css --title-prefix=$(title) \
- --epub-cover-image=img/cover.jpg
+pdf:
+ # You need `pdflatex`
+ # OS X: http://www.tug.org/mactex/
+ # Then find its path: find /usr/ -name "pdflatex"
+ # Then symlink it: ln -s /path/to/pdflatex /usr/local/bin
+ pandoc -s $(source) -o $(filename).pdf \
+ --title-prefix $(title) \
+ --normalize \
+ --smart
-clean:
- rm -f $(filename).aux \
- $(filename).db \
- $(filename).log \
- $(filename).out \
- $(filename).tex
+mobi: epub
+ # Download: http://www.amazon.com/gp/feature.html?ie=UTF8&docId=1000765211
+ # Symlink bin: ln -s /path/to/kindlegen /usr/local/bin
+ kindlegen $(filename).epub
View
16 build/build.sh
@@ -1,16 +0,0 @@
-
-# A little build script for compiling the HTML, ePub and RTF versions of the book.
-# use with sh build.sh in this directory
-
-#pandoc is the path to the pandoc executable. It can either simply be 'pandoc',
-#or if you require a custom path just replace it with that path.
-#e.g /Users/apple/Desktop/usr/local/bin/pandoc
-
-#html
-pandoc -s ../index.md -o ../index.html -c style.css --include-in-header=head.html --include-before-body=author.html --include-before-body=share.html --include-after-body=stats.html --title-prefix='Developing Backbone.js Applications'
-
-#epub
-pandoc -s -S ../index.md -t epub --epub-metadata=metadata.xml -o ../backbone-fundamentals.epub --epub-stylesheet=../epub.css --title-prefix='Developing Backbone.js Applications' --epub-cover-image=../img/cover.jpg
-
-#rtf
-pandoc -s title.txt -S ../index.md -o ../backbone-fundamentals.rtf

0 comments on commit 0614b46

Please sign in to comment.