Skip to content
Browse files

Merge pull request #24 from pettter/master

Makefile changes to make out-of-source build reasonable
  • Loading branch information...
2 parents 1d0c576 + 7c4548b commit a6ca3e36cfb952f2659f524fdcbde0c042d32a6f @pettter pettter committed Oct 20, 2012
Showing with 32 additions and 7 deletions.
  1. +21 −6 src/Makefile
  2. +11 −1 src/convert_to_tex.sh
View
27 src/Makefile
@@ -1,10 +1,25 @@
-all: tex combined
+BUILD_DIR=build
+INSTALL_DIR=/path/to/install
+
+TEX_DIR=${BUILD_DIR}/tex
+BOOK_DIR=${BUILD_DIR}/.
+
+all: latex-pdf combined
tex:
- ./convert_to_tex.sh
- pdflatex main.tex
- pdflatex main.tex
+ ./convert_to_tex.sh ${TEX_DIR}
+ cp main.tex ${TEX_DIR}
+
+latex-pdf: tex
+ pdflatex --output-dir=${TEX_DIR} ${TEX_DIR}/main.tex
+ pdflatex --output-dir=${TEX_DIR} ${TEX_DIR}/main.tex
+
+book.md:
+ cat chapter*/*.md > ${BOOK_DIR}/book.md
+
+combined: book.md
-combined:
- cat */*.md > book.md
+install: book.md latex-pdf
+ cp ${TEX_DIR}/main.pdf ${INSTALL_DIR}/cryptoparty-handbook-`date +%F`.pdf
+ cp ${BOOK_DIR}/book.md ${INSTALL_DIR}/cryptoparty-handbook-`date +%F`.md
View
12 src/convert_to_tex.sh
@@ -1,3 +1,13 @@
+#!/bin/bash
+if [ -z $1 ] ; then
+ DIR=.
+else
+ DIR=$1
+fi
+mkdir $DIR
+for d in chapter*; do
+ mkdir $DIR/$d
+done
for f in */*.md; do
- pandoc -f markdown -t latex $f -o $f.tex
+ pandoc -f markdown -t latex $f -o $DIR/$f.tex
done

0 comments on commit a6ca3e3

Please sign in to comment.
Something went wrong with that request. Please try again.