aboutsummaryrefslogtreecommitdiff
path: root/Makefile
blob: 89ec68cd4662c8959f072bb51afd5a768837a20f (plain)
  1. CFLAGS=-ggdb3 -O0 -Wall -Wextra -Wno-unused-variable -std=c99 -Isrc $(OPTFLAGS)
  2. LDFLAGS=-ggdb3 -O0 -Wall -Wno-unused-variable # -Werror
  3. SRCDIR=src
  4. DATADIR=data
  5. PROG=./stmd
  6. .PHONY: all oldtests test spec benchjs testjs
  7. all: $(SRCDIR)/case_fold_switch.inc $(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. HTML_OBJ=$(SRCDIR)/html/html.o $(SRCDIR)/html/houdini_href_e.o $(SRCDIR)/html/houdini_html_e.o
  32. STMD_OBJ=$(SRCDIR)/inlines.o $(SRCDIR)/buffer.o $(SRCDIR)/blocks.o $(SRCDIR)/scanners.c $(SRCDIR)/print.o $(SRCDIR)/utf8.o
  33. $(PROG): $(SRCDIR)/main.c $(HTML_OBJ) $(STMD_OBJ)
  34. $(CC) $(LDFLAGS) -o $@ $^
  35. $(SRCDIR)/scanners.c: $(SRCDIR)/scanners.re
  36. re2c --case-insensitive -bis $< > $@ || (rm $@ && false)
  37. $(SRCDIR)/case_fold_switch.inc: $(DATADIR)/CaseFolding-3.2.0.txt
  38. perl mkcasefold.pl < $< > $@
  39. .PHONY: leakcheck clean fuzztest dingus upload
  40. dingus:
  41. cd js && echo "Starting dingus server at http://localhost:9000" && python -m SimpleHTTPServer 9000
  42. leakcheck: $(PROG)
  43. cat oldtests/*/*.markdown | valgrind --leak-check=full --dsymutil=yes $(PROG)
  44. operf: $(PROG)
  45. operf $(PROG) <bench.md >/dev/null
  46. fuzztest:
  47. for i in `seq 1 10`; do \
  48. time cat /dev/urandom | head -c 100000 | iconv -f latin1 -t utf-8 | $(PROG) >/dev/null; done
  49. update-site: spec.html narrative.html
  50. cp spec.html _site/
  51. cp narrative.html _site/index.html
  52. cp -r js/* _site/js/
  53. (cd _site ; git pull ; git commit -a -m "Updated site for latest spec, narrative, js" ; git push; cd ..)
  54. clean:
  55. -rm -f test $(SRCDIR)/*.o $(SRCDIR)/scanners.c $(SRCDIR)/html/*.o
  56. -rm -rf *.dSYM
  57. -rm -f README.html
  58. -rm -f spec.md fuzz.txt spec.html