Makefile 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. .PHONY: FORCE
  2. .ONESHELL:
  3. -include .env
  4. export
  5. main: pdf
  6. # LaTeX
  7. .PHONY: pdf
  8. pdf:
  9. cd src
  10. latexmk -pdflatex='pdflatex -interaction nonstopmode' -pdf $(document).tex
  11. cp main.pdf ..
  12. .PHONY: publish
  13. publish: pdf
  14. if [ ! -d "published" ]; then mkdir published; fi
  15. cp $(document).pdf published/$(publish).pdf
  16. cp $(document).pdf published/$(publish)_$(shell date --iso-8601=seconds).pdf
  17. .PHONY: watch
  18. watch:
  19. cd src
  20. latexmk -pdflatex='pdflatex -interaction nonstopmode' -pdf -pvc $(document).tex
  21. .PHONY: clean
  22. clean:
  23. latexmk -c
  24. .PHONY: purge
  25. purge:
  26. latexmk -C
  27. .PHONY: init
  28. init: env biblist config dictionary docs
  29. # example
  30. .PHONY: env
  31. env: FORCE
  32. cp examples/.env .env
  33. .PHONY: biblist
  34. biblist: FORCE
  35. cp examples/src/biblist.bib src/biblist.bib
  36. .PHONY: config
  37. config: FORCE
  38. cp examples/src/config.tex src/config.tex
  39. .PHONY: dictionary
  40. dictionary: FORCE
  41. cp examples/src/dictionary.txt src/dictionary.txt
  42. .PHONY: docs
  43. docs: FORCE
  44. cp -rT examples/src/docs/ src/docs
  45. # gitignore
  46. .PHONY: ignore
  47. ignore: acknowledge
  48. echo /.env >> .gitignore
  49. echo /src/biblist.bib >> .gitignore
  50. echo /src/config.tex >> .gitignore
  51. echo /src/dictionary.txt >> .gitignore
  52. echo /src/docs/ >> .gitignore
  53. .PHONY: acknowledge
  54. acknowledge:
  55. sed -i '/^\/.env/d' .gitignore
  56. sed -i "/^\/src\/biblist.bib/d" .gitignore
  57. sed -i "/^\/src\/config.tex/d" .gitignore
  58. sed -i '/^\/src\/dictionary.txt/d' .gitignore
  59. sed -i '/^\/src\/docs\//d' .gitignore
  60. # spell check
  61. .PHONY: textidote
  62. textidote:
  63. java -jar ~/bin/textidote.jar --output html --check $(language) --dict dictionary.txt $(document).tex > textidote.html