Skip to content
This repository
tree: fe7737b03a
Fetching contributors…

Octocat-spinner-32-eaf2f5

Cannot retrieve contributors at this time

file 107 lines (87 sloc) 2.461 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106
# Makefile originally from the 'Mastering Node' book written TJ Holowaychuk
# https://github.com/visionmedia/masteringnode
#

PDF_FLAGS = --fontsize 9.0 \
--linkstyle plain \
--linkcolor blue \
--embedfonts \
--footer "c 1" \
--no-toc

#Hoping to autogenerate the ToC.
MD = pages/title.md \
chapters/Table_Of_Contents.md \
    chapters/introduction.md \
    chapters/hello_world.md \
    chapters/platform_features.md \
    chapters/jitsu.md \
    chapters/web_admin.md \
    chapters/json_api.md \
    chapters/haibu.md \
chapters/open_source_projects.md \
    chapters/troubleshooting.md \
    chapters/support.md \
appendices/installing_node.md \
    appendices/package.json.md \
    appendices/resources.md \
    appendices/building_the_handbook.md

README = pages/title.md \
chapters/Table_Of_Contents.md \
    chapters/introduction.md \
    chapters/hello_world.md \
    chapters/platform_features.md \
    chapters/jitsu.md \
    chapters/web_admin.md \
    chapters/json_api.md \
    chapters/haibu.md \
chapters/open_source_projects.md \
    chapters/troubleshooting.md \
    chapters/support.md \
appendices/installing_node.md \
    appendices/package.json.md \
    appendices/resources.md \
    appendices/building_the_handbook.md

API = chapters/json_api.md

HTML = $(MD:.md=.html)

all: book.html book.pdf book.md ReadMe.md API.md clear

regenerate: clean all
git commit -a -m 'Regenerated book' && echo done

book.pdf: $(HTML)
@echo "\n... generating $@"
htmldoc --webpage -f $@ $(PDF_FLAGS) $(HTML)

book.md: $(HTML)
@echo "\n... generating $@"
cat $(MD) > book.md

ReadMe.md: $(HTML)
@echo "\n... generating $@"
cat $(README) > ReadMe.md

API.md: $(HTML)
@echo "\n... generating $@"
cat $(API) > API.md

book.html: pages/head.html pages/tail.html $(HTML)
@echo "\n... generating $@"
@echo $(HTML)
cat pages/head.html $(HTML) pages/tail.html > book.html

%.html: %.md
ronn --pipe --fragment $< \
| sed -r 's/<h1>([^ ]+) - /<h1>/' \
> $@

book.mobi:
@echo "\n... generating $@"
ebook-convert book.html book.mobi --output-profile kindle

book.epub:
@echo "\n... generating $@"
ebook-convert book.html book.epub \
--title "Nodejitsu Handbook" \
--no-default-epub-cover \
--authors "Marak Squires" \
--language en \
--cover pages/cover.jpg

view: book.pdf
open book.pdf

clean:
rm -f book.*
rm -f chapters/*.html

clear:
rm -f chapters/*.html
rm -f pages/index.html

.PHONY: view clean regenerate
Something went wrong with that request. Please try again.