Makefile 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  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. --variable papersize=A4 \
  13. --output $(OUT_DIR)/$$FILE_NAME.tex $$f > /dev/null; \
  14. context $(OUT_DIR)/$$FILE_NAME.tex \
  15. --result=$(OUT_DIR)/$$FILE_NAME.pdf > $(OUT_DIR)/context_$$FILE_NAME.log 2>&1; \
  16. done
  17. html: dir
  18. for f in $(IN_DIR)/*.md; do \
  19. FILE_NAME=`basename $$f | sed 's/.md//g'`; \
  20. echo $$FILE_NAME.html; \
  21. pandoc --standalone --include-in-header $(STYLES_DIR)/$(STYLE).css \
  22. --from markdown --to html \
  23. --output $(OUT_DIR)/$$FILE_NAME.html $$f; \
  24. done
  25. docx: dir
  26. for f in $(IN_DIR)/*.md; do \
  27. FILE_NAME=`basename $$f | sed 's/.md//g'`; \
  28. echo $$FILE_NAME.docx; \
  29. pandoc --standalone --smart $$f --output $(OUT_DIR)/$$FILE_NAME.docx; \
  30. done
  31. rtf: dir
  32. for f in $(IN_DIR)/*.md; do \
  33. FILE_NAME=`basename $$f | sed 's/.md//g'`; \
  34. echo $$FILE_NAME.rtf; \
  35. pandoc --standalone --smart $$f --output $(OUT_DIR)/$$FILE_NAME.rtf; \
  36. done
  37. dir:
  38. mkdir -p $(OUT_DIR)
  39. clean:
  40. rm -f $(OUT_DIR)/*