aboutsummaryrefslogtreecommitdiff
path: root/Makefile
blob: cb5938de167f9b859a3f5ca85473e9e132309c0f (plain)
  1. CFLAGS=-ggdb3 -O0 -Wall -Wextra -std=c99 -Isrc $(OPTFLAGS)
  2. LDFLAGS=-ggdb3 -O0 -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. narrative.html: narrative.md template.html
  16. pandoc --template template.html -s -S $< -o $@
  17. spec.pdf: spec.md template.tex specfilter.hs
  18. pandoc -s $< --template template.tex \
  19. --filter ./specfilter.hs -o $@ --latex-engine=xelatex --toc \
  20. --number-sections -V documentclass=report -V tocdepth=2 \
  21. -V classoption=twosides
  22. oldtests:
  23. make -C oldtests --quiet clean all
  24. test: spec.txt
  25. perl runtests.pl $< $(PROG)
  26. testjs: spec.txt
  27. node js/test.js
  28. # perl runtests.pl js/markdown $<
  29. benchjs:
  30. node js/bench.js ${BENCHINP}
  31. $(PROG): $(SRCDIR)/main.c $(SRCDIR)/inlines.o $(SRCDIR)/buffer.o $(SRCDIR)/blocks.o $(SRCDIR)/scanners.c $(SRCDIR)/print.o $(SRCDIR)/html.o $(SRCDIR)/utf8.o
  32. $(CC) $(LDFLAGS) -o $@ $^
  33. $(SRCDIR)/scanners.c: $(SRCDIR)/scanners.re
  34. re2c --case-insensitive -bis $< > $@ || (rm $@ && false)
  35. $(SRCDIR)/case_fold_switch.inc $(DATADIR)/CaseFolding-3.2.0.txt
  36. perl mkcasefold.pl < $< > $@
  37. .PHONY: leakcheck clean fuzztest dingus upload
  38. dingus:
  39. cd js && echo "Starting dingus server at http://localhost:9000" && python -m SimpleHTTPServer 9000
  40. leakcheck: $(PROG)
  41. cat oldtests/*/*.markdown | valgrind --leak-check=full --dsymutil=yes $(PROG)
  42. operf: $(PROG)
  43. operf $(PROG) <bench.md >/dev/null
  44. fuzztest:
  45. for i in `seq 1 10`; do \
  46. time cat /dev/urandom | head -c 100000 | iconv -f latin1 -t utf-8 | $(PROG) >/dev/null; done
  47. update-site: spec.html narrative.html
  48. cp spec.html _site/
  49. cp narrative.html _site/index.html
  50. cp -r js/* _site/js/
  51. (cd _site ; git pull ; git commit -a -m "Updated site for latest spec, narrative, js" ; git push; cd ..)
  52. clean:
  53. -rm -f test $(SRCDIR)/*.o $(SRCDIR)/scanners.c
  54. -rm -rf *.dSYM
  55. -rm -f README.html
  56. -rm -f spec.md fuzz.txt spec.html