alshabib | bfb8bb9 | 2017-02-15 12:48:33 -0800 | [diff] [blame] | 1 | # Makefile to make it obvious what operations exist for this repo |
| 2 | |
| 3 | GITBOOK := node_modules/.bin/gitbook |
| 4 | |
| 5 | default: html |
| 6 | |
| 7 | help: |
| 8 | @echo "Available make targets:" |
| 9 | @echo " help - Print this help" |
| 10 | @echo " serve - Build gitbook static web pages and serve them locally" |
| 11 | @echo " html - Build gitbook static pages under _book dir" |
| 12 | @echo " pdf - Build gitbook pdf as book.pdf" |
| 13 | @echo |
| 14 | @echo "The following additional commands are used internally:" |
| 15 | @echo " check-gitbook - Check gitbook if gitbook is installed" |
| 16 | @echo " install-gitbook - Install the gitbook toolchain and plugins needed to build books" |
| 17 | @echo " prepare-gitbook - Make sure gitbook plugins are installed" |
| 18 | |
| 19 | check-gitbook: |
| 20 | @echo "Checking 'gitbook' installation..." |
| 21 | @if test -x $(GITBOOK) && $(GITBOOK) --version;\ |
| 22 | then \ |
| 23 | echo "Good. You have gitbook installed.";\ |
| 24 | else \ |
| 25 | echo "No gitbook execuatble found. Please run:";\ |
| 26 | echo "";\ |
| 27 | echo " make install-gitbook";\ |
| 28 | echo "";\ |
| 29 | echo "(You may be prompted for your password.)";\ |
| 30 | echo "";\ |
| 31 | fi |
| 32 | |
| 33 | install-gitbook: |
| 34 | @echo "Installing gitbook (may prompt for your password)..." |
| 35 | npm install |
| 36 | $(GITBOOK) install |
| 37 | |
| 38 | prepare-gitbook: check-gitbook |
| 39 | @echo "Checking 'gitbook' installation and do what's needed" |
| 40 | $(GITBOOK) init |
| 41 | |
| 42 | serve: prepare-gitbook |
| 43 | @echo "Continuous building and serving static web pages..." |
| 44 | $(GITBOOK) serve |
| 45 | |
| 46 | html: prepare-gitbook |
| 47 | @echo "Building static web pages..." |
| 48 | $(GITBOOK) build |
| 49 | |
| 50 | pdf: prepare-gitbook |
| 51 | @echo "Building PDF book..." |
| 52 | $(GITBOOK) pdf . VolthaMissingManual.pdf |
| 53 | |
| 54 | clean: |
| 55 | rm -rf _book |
| 56 | rm -rf VolthaMissingManual.pdf |