Makefile 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. OUT_DIR=output
  2. IN_DIR=markdown
  3. STYLES_DIR=styles
  4. STYLE=chmduquesne
  5. all: html pdf docx rtf
  6. pdf: dir
  7. for f in $(IN_DIR)/*.md; do \
  8. FILE_NAME=`basename $$f | sed 's/.md//g'`; \
  9. echo $$FILE_NAME.pdf; \
  10. pandoc --standalone --template $(STYLES_DIR)/$(STYLE).tex \
  11. --from markdown --to context \
  12. -V papersize=A4 \
  13. -o $(OUT_DIR)/$$FILE_NAME.tex $$f > /dev/null; \
  14. context $(OUT_DIR)/$$FILE_NAME.tex --result=$(OUT_DIR)/$$FILE_NAME.pdf > $(OUT_DIR)/context_$$FILE_NAME.log 2>&1; \
  15. done
  16. html: dir
  17. for f in $(IN_DIR)/*.md; do \
  18. FILE_NAME=`basename $$f | sed 's/.md//g'`; \
  19. echo $$FILE_NAME.html; \
  20. pandoc --standalone -H $(STYLES_DIR)/$(STYLE).css \
  21. --from markdown --to html \
  22. -o $(OUT_DIR)/$$FILE_NAME.html $$f; \
  23. done
  24. docx: dir
  25. for f in $(IN_DIR)/*.md; do \
  26. FILE_NAME=`basename $$f | sed 's/.md//g'`; \
  27. echo $$FILE_NAME.docx; \
  28. pandoc -s -S $$f -o $(OUT_DIR)/$$FILE_NAME.docx; \
  29. done
  30. rtf: dir
  31. for f in $(IN_DIR)/*.md; do \
  32. FILE_NAME=`basename $$f | sed 's/.md//g'`; \
  33. echo $$FILE_NAME.rtf; \
  34. pandoc -s -S $$f -o $(OUT_DIR)/$$FILE_NAME.rtf; \
  35. done
  36. dir:
  37. mkdir -p $(OUT_DIR)
  38. clean:
  39. rm -f $(OUT_DIR)/*