aboutsummaryrefslogtreecommitdiff
path: root/Makefile
blob: 40758bc1f34295ce7003288d471121a6fd220d13 (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 README.html _site/index.html
  45. cp spec.html _site/
  46. cp -r js/* _site/js/
  47. upload: spec.html spec.pdf
  48. scp spec.html spec.pdf js/stmd.js js/index.html website:html/markdown/
  49. clean:
  50. -rm test $(SRCDIR)/*.o $(SRCDIR)/scanners.c
  51. -rm -r *.dSYM
  52. -rm README.html
  53. -rm spec.md fuzz.txt spec.html