Makefile 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  1. PYTHON?=python
  2. PYTHON3?=python3.0
  3. TESTFLAGS=-p -v
  4. TESTOPTS=
  5. SETUPFLAGS=
  6. LXMLVERSION=`cat version.txt`
  7. all: inplace
  8. # Build in-place
  9. inplace:
  10. $(PYTHON) setup.py $(SETUPFLAGS) build_ext -i
  11. build:
  12. $(PYTHON) setup.py $(SETUPFLAGS) build
  13. test_build: build
  14. $(PYTHON) test.py $(TESTFLAGS) $(TESTOPTS)
  15. test_inplace: inplace
  16. $(PYTHON) test.py $(TESTFLAGS) $(TESTOPTS)
  17. PYTHONPATH=src:$(PYTHONPATH) $(PYTHON) selftest.py
  18. PYTHONPATH=src:$(PYTHONPATH) $(PYTHON) selftest2.py
  19. test_inplace3: inplace
  20. $(MAKE) clean
  21. $(PYTHON3) setup.py $(SETUPFLAGS) build_ext -i
  22. $(PYTHON3) test.py $(TESTFLAGS) $(TESTOPTS)
  23. PYTHONPATH=src:$(PYTHONPATH) $(PYTHON3) selftest.py
  24. PYTHONPATH=src:$(PYTHONPATH) $(PYTHON3) selftest2.py
  25. valgrind_test_inplace: inplace
  26. valgrind --tool=memcheck --leak-check=full --num-callers=30 --suppressions=valgrind-python.supp \
  27. $(PYTHON) test.py
  28. gdb_test_inplace: inplace
  29. @echo -e "file $(PYTHON)\nrun test.py" > .gdb.command
  30. gdb -x .gdb.command -d src -d src/lxml
  31. bench_inplace: inplace
  32. $(PYTHON) benchmark/bench_etree.py -i
  33. $(PYTHON) benchmark/bench_xpath.py -i
  34. $(PYTHON) benchmark/bench_xslt.py -i
  35. $(PYTHON) benchmark/bench_objectify.py -i
  36. ftest_build: build
  37. $(PYTHON) test.py -f $(TESTFLAGS) $(TESTOPTS)
  38. ftest_inplace: inplace
  39. $(PYTHON) test.py -f $(TESTFLAGS) $(TESTOPTS)
  40. apihtml: inplace
  41. rm -fr doc/html/api
  42. @[ -x "`which epydoc`" ] \
  43. && (cd src && echo "Generating API docs ..." && \
  44. PYTHONPATH=. epydoc -v --docformat "restructuredtext en" \
  45. -o ../doc/html/api --exclude='[.]html[.]tests|[.]_' \
  46. --exclude-introspect='[.]usedoctest' \
  47. --name "lxml API" --url http://codespeak.net/lxml/ lxml/) \
  48. || (echo "not generating epydoc API documentation")
  49. website: inplace
  50. PYTHONPATH=src:$(PYTHONPATH) $(PYTHON) doc/mkhtml.py doc/html . ${LXMLVERSION}
  51. html: inplace website apihtml s5
  52. s5:
  53. $(MAKE) -C doc/s5 slides
  54. apipdf: inplace
  55. rm -fr doc/pdf
  56. mkdir -p doc/pdf
  57. @[ -x "`which epydoc`" ] \
  58. && (cd src && echo "Generating API docs ..." && \
  59. PYTHONPATH=. epydoc -v --latex --docformat "restructuredtext en" \
  60. -o ../doc/pdf --exclude='([.]html)?[.]tests|[.]_' \
  61. --exclude-introspect='html[.]clean|[.]usedoctest' \
  62. --name "lxml API" --url http://codespeak.net/lxml/ lxml/) \
  63. || (echo "not generating epydoc API documentation")
  64. pdf: apipdf
  65. $(PYTHON) doc/mklatex.py doc/pdf . ${LXMLVERSION}
  66. (cd doc/pdf && pdflatex lxmldoc.tex \
  67. && pdflatex lxmldoc.tex \
  68. && pdflatex lxmldoc.tex)
  69. @pdfopt doc/pdf/lxmldoc.pdf doc/pdf/lxmldoc-${LXMLVERSION}.pdf
  70. @echo "PDF available as doc/pdf/lxmldoc-${LXMLVERSION}.pdf"
  71. # Two pdflatex runs are needed to build the correct Table of contents.
  72. test: test_inplace
  73. test3: test_inplace3
  74. valtest: valgrind_test_inplace
  75. gdbtest: gdb_test_inplace
  76. bench: bench_inplace
  77. ftest: ftest_inplace
  78. clean:
  79. find . \( -name '*.o' -o -name '*.so' -o -name '*.py[cod]' -o -name '*.dll' \) -exec rm -f {} \;
  80. rm -rf build
  81. docclean:
  82. $(MAKE) -C doc/s5 clean
  83. rm -f doc/html/*.html
  84. rm -fr doc/html/api
  85. rm -fr doc/pdf
  86. realclean: clean docclean
  87. find . -name '*.c' -exec rm -f {} \;
  88. rm -f TAGS
  89. $(PYTHON) setup.py clean -a