aboutsummaryrefslogtreecommitdiff
path: root/Makefile
blob: 98d0c450e46df45581302f1fc2c06ec04661814c (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. spec: test spec.html
  9. spec.md: spec.txt
  10. perl spec2md.pl < $< > $@
  11. spec.html: spec.md template.html
  12. pandoc --no-highlight --number-sections --template template.html -s --toc -S $< > $@ # | perl -pe 's/␣/<span class="space"> <\/span>/g' > $@
  13. spec.pdf: spec.md template.tex specfilter.hs
  14. pandoc -s $< --template template.tex \
  15. --filter ./specfilter.hs -o $@ --latex-engine=xelatex --toc \
  16. --number-sections -V documentclass=report -V tocdepth=2 \
  17. -V classoption=twosides
  18. oldtests:
  19. make -C oldtests --quiet clean all
  20. test: spec.txt
  21. perl runtests.pl $(PROG) $<
  22. testjs: spec.txt
  23. node js/test.js
  24. # perl runtests.pl js/markdown $<
  25. benchjs:
  26. node js/bench.js
  27. $(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
  28. $(CC) $(LDFLAGS) -o $@ $^
  29. $(SRCDIR)/scanners.c: $(SRCDIR)/scanners.re
  30. re2c --case-insensitive -bis $< > $@
  31. $(SRCDIR)/case_fold_switch.c: $(DATADIR)/CaseFolding-3.2.0.txt
  32. perl mkcasefold.pl < $< > $@
  33. .PHONY: leakcheck clean fuzztest dingus
  34. dingus:
  35. cd js && echo "Starting dingus server at http://localhost:9000" && python -m SimpleHTTPServer 9000
  36. leakcheck: $(PROG)
  37. cat oldtests/*/*.markdown | valgrind --leak-check=full --dsymutil=yes $(PROG)
  38. fuzztest:
  39. for i in `seq 1 10`; do \
  40. time cat /dev/urandom | head -c 100000 | iconv -f latin1 -t utf-8 | $(PROG) >/dev/null; done
  41. clean:
  42. -rm test $(SRCDIR)/*.o $(SRCDIR)/scanners.c
  43. -rm -r *.dSYM
  44. -rm spec.md fuzz.txt spec.html