aboutsummaryrefslogtreecommitdiff
path: root/Makefile
blob: 1357c3fc9a25078380cee18521278c84e09c1133 (plain)
  1. CFLAGS=--O3 -Wall -Wextra -std=c99 -Isrc $(OPTFLAGS)
  2. LDFLAGS=-g -O3 -Wall -Werror
  3. SRCDIR=src
  4. DATADIR=data
  5. PROG=./stmd
  6. .PHONY: all oldtests test spec benchjs testjs
  7. all: $(SRCDIR)/case_fold_switch.c $(PROG)
  8. README.html: README.md template.html
  9. pandoc --template template.html -S -s -t html5 -o $@ $<
  10. spec: test spec.html
  11. spec.md: spec.txt
  12. perl spec2md.pl < $< > $@
  13. spec.html: spec.md template.html
  14. pandoc --no-highlight --number-sections --template template.html -s --toc -S $< > $@ # | perl -pe 's/␣/<span class="space"> <\/span>/g' > $@
  15. spec.pdf: spec.md template.tex specfilter.hs
  16. pandoc -s $< --template template.tex \
  17. --filter ./specfilter.hs -o $@ --latex-engine=xelatex --toc \
  18. --number-sections -V documentclass=report -V tocdepth=2 \
  19. -V classoption=twosides
  20. oldtests:
  21. make -C oldtests --quiet clean all
  22. test: spec.txt
  23. perl runtests.pl $(PROG) $<
  24. testjs: spec.txt
  25. node js/test.js
  26. # perl runtests.pl js/markdown $<
  27. benchjs:
  28. node js/bench.js
  29. $(PROG): $(SRCDIR)/main.c $(SRCDIR)/inlines.o $(SRCDIR)/blocks.o $(SRCDIR)/detab.o $(SRCDIR)/bstrlib.o $(SRCDIR)/scanners.o $(SRCDIR)/print.o $(SRCDIR)/html.o $(SRCDIR)/utf8.o
  30. $(CC) $(LDFLAGS) -o $@ $^
  31. $(SRCDIR)/scanners.c: $(SRCDIR)/scanners.re
  32. re2c --case-insensitive -bis $< > $@
  33. $(SRCDIR)/case_fold_switch.c: $(DATADIR)/CaseFolding-3.2.0.txt
  34. perl mkcasefold.pl < $< > $@
  35. .PHONY: leakcheck clean fuzztest dingus upload
  36. dingus:
  37. cd js && echo "Starting dingus server at http://localhost:9000" && python -m SimpleHTTPServer 9000
  38. leakcheck: $(PROG)
  39. cat oldtests/*/*.markdown | valgrind --leak-check=full --dsymutil=yes $(PROG)
  40. fuzztest:
  41. for i in `seq 1 10`; do \
  42. time cat /dev/urandom | head -c 100000 | iconv -f latin1 -t utf-8 | $(PROG) >/dev/null; done
  43. update-site: README.html spec.html
  44. cp spec.html _site/
  45. cp -r js/* _site/js/
  46. upload: spec.html spec.pdf
  47. scp spec.html spec.pdf js/stmd.js js/index.html website:html/markdown/
  48. clean:
  49. -rm test $(SRCDIR)/*.o $(SRCDIR)/scanners.c
  50. -rm -r *.dSYM
  51. -rm README.html
  52. -rm spec.md fuzz.txt spec.html