aboutsummaryrefslogtreecommitdiff
path: root/Makefile
blob: 55b6645e09fb538108662d66eab5bdc0913b2b93 (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. 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)/blocks.o $(SRCDIR)/detab.o $(SRCDIR)/bstrlib.o $(SRCDIR)/scanners.o $(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.c: $(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. fuzztest:
  43. for i in `seq 1 10`; do \
  44. time cat /dev/urandom | head -c 100000 | iconv -f latin1 -t utf-8 | $(PROG) >/dev/null; done
  45. update-site: spec.html narrative.html
  46. cp spec.html _site/
  47. cp narrative.html _site/index.html
  48. cp -r js/* _site/js/
  49. (cd _site ; git pull ; git commit -a -m "Updated site for latest spec, narrative, js" ; git push; cd ..)
  50. clean:
  51. -rm test $(SRCDIR)/*.o $(SRCDIR)/scanners.c
  52. -rm -r *.dSYM
  53. -rm README.html
  54. -rm spec.md fuzz.txt spec.html