Makefile 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. # -*- coding: utf-8; mode: makefile-gmake -*-
  2. include ./.config.mk
  3. PYOBJECTS = searx
  4. DOC = docs
  5. PY_SETUP_EXTRAS ?= \[test\]
  6. PYDIST=./dist/py
  7. PYBUILD=./build/py
  8. include utils/makefile.include
  9. include utils/makefile.python
  10. include utils/makefile.sphinx
  11. all: clean install
  12. PHONY += help
  13. help:
  14. @echo ' test - run developer tests'
  15. @echo ' docs - build documentation'
  16. @echo ' docs-live - autobuild HTML documentation while editing'
  17. @echo ' run - run developer instance'
  18. @echo ' install - developer install (./local)'
  19. @echo ' uninstall - uninstall (./local)'
  20. @echo ' gh-pages - build docs & deploy on gh-pages branch'
  21. @echo ' clean - drop builds and environments'
  22. @echo ''
  23. @echo 'environment'
  24. @echo ' SEARX_URL = $(SEARX_URL)'
  25. @echo ' GIT_URL = $(GIT_URL)'
  26. @echo ' DOCS_URL = $(DOCS_URL)'
  27. @echo ''
  28. @$(MAKE) -s -f utils/makefile.include make-help
  29. @echo ''
  30. @$(MAKE) -s -f utils/makefile.python python-help
  31. PHONY += install
  32. install: pyenvinstall
  33. PHONY += uninstall
  34. uninstall: pyenvuninstall
  35. PHONY += clean
  36. clean: pyclean
  37. $(call cmd,common_clean)
  38. PHONY += run
  39. run: pyenvinstall
  40. $(Q) ( \
  41. sed -i -e "s/debug : False/debug : True/g" ./searx/settings.yml ; \
  42. sleep 2 ; \
  43. xdg-open http://127.0.0.1:8888/ ; \
  44. sleep 3 ; \
  45. sed -i -e "s/debug : True/debug : False/g" ./searx/settings.yml ; \
  46. ) &
  47. $(PY_ENV)/bin/python ./searx/webapp.py
  48. # docs
  49. # ----
  50. PHONY += docs
  51. docs: pyenvinstall sphinx-doc
  52. $(call cmd,sphinx,html,docs,docs)
  53. PHONY += docs-live
  54. docs-live: pyenvinstall sphinx-live
  55. $(call cmd,sphinx_autobuild,html,docs,docs)
  56. $(GH_PAGES)::
  57. @echo "doc available at --> $(DOCS_URL)"
  58. # test
  59. # ----
  60. PHONY += test test.sh test.pylint test.pep8 test.unit test.robot
  61. test: test.pylint test.pep8 test.unit test.robot
  62. # TODO: balance linting with pylint
  63. test.pylint: pyenvinstall
  64. $(call cmd,pylint,searx/preferences.py)
  65. $(call cmd,pylint,searx/testing.py)
  66. test.sh:
  67. shellcheck -x utils/lib.sh
  68. shellcheck -x utils/filtron.sh
  69. shellcheck -x utils/searx.sh
  70. shellcheck -x utils/morty.sh
  71. shellcheck -x utils/lxc.sh
  72. shellcheck -x utils/lxc.env
  73. shellcheck -x .config.sh
  74. test.pep8: pyenvinstall
  75. $(PY_ENV_ACT); ./manage.sh pep8_check
  76. test.unit: pyenvinstall
  77. $(PY_ENV_ACT); ./manage.sh unit_tests
  78. test.robot: pyenvinstall
  79. $(PY_ENV_ACT); ./manage.sh install_geckodriver
  80. $(PY_ENV_ACT); ./manage.sh robot_tests
  81. .PHONY: $(PHONY)