Makefile 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  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 ' project - re-build generic files of the searx project'
  23. @echo ''
  24. @echo 'environment'
  25. @echo ' SEARX_URL = $(SEARX_URL)'
  26. @echo ' GIT_URL = $(GIT_URL)'
  27. @echo ' DOCS_URL = $(DOCS_URL)'
  28. @echo ''
  29. @$(MAKE) -s -f utils/makefile.include make-help
  30. @echo ''
  31. @$(MAKE) -s -f utils/makefile.python python-help
  32. PHONY += install
  33. install: pyenvinstall
  34. PHONY += uninstall
  35. uninstall: pyenvuninstall
  36. PHONY += clean
  37. clean: pyclean
  38. $(call cmd,common_clean)
  39. PHONY += run
  40. run: pyenvinstall
  41. $(Q) ( \
  42. sed -i -e "s/debug : False/debug : True/g" ./searx/settings.yml ; \
  43. sleep 2 ; \
  44. xdg-open http://127.0.0.1:8888/ ; \
  45. sleep 3 ; \
  46. sed -i -e "s/debug : True/debug : False/g" ./searx/settings.yml ; \
  47. ) &
  48. $(PY_ENV)/bin/python ./searx/webapp.py
  49. # docs
  50. # ----
  51. PHONY += docs
  52. docs: pyenvinstall sphinx-doc prebuild-includes
  53. $(call cmd,sphinx,html,docs,docs)
  54. PHONY += docs-live
  55. docs-live: pyenvinstall sphinx-live prebuild-includes
  56. $(call cmd,sphinx_autobuild,html,docs,docs)
  57. prebuild-includes:
  58. @mkdir -p $(DOCS_BUILD)/includes
  59. @./utils/searx.sh doc | cat > $(DOCS_BUILD)/includes/searx.rst
  60. @./utils/filtron.sh doc | cat > $(DOCS_BUILD)/includes/filtron.rst
  61. @./utils/morty.sh doc | cat > $(DOCS_BUILD)/includes/morty.rst
  62. $(GH_PAGES)::
  63. @echo "doc available at --> $(DOCS_URL)"
  64. # update project files
  65. # --------------------
  66. PHONY += project engines-languages
  67. project: searx/data/engines_languages.json
  68. searx/data/engines_languages.json: pyenvinstall
  69. $(PY_ENV_ACT); python utils/fetch_languages.py
  70. mv engines_languages.json searx/data/engines_languages.json
  71. mv languages.py searx/languages.py
  72. # test
  73. # ----
  74. PHONY += test test.sh test.pylint test.pep8 test.unit test.robot
  75. test: test.pylint test.pep8 test.unit test.robot
  76. # TODO: balance linting with pylint
  77. test.pylint: pyenvinstall
  78. $(call cmd,pylint,searx/preferences.py)
  79. $(call cmd,pylint,searx/testing.py)
  80. test.sh:
  81. shellcheck -x utils/lib.sh
  82. shellcheck -x utils/filtron.sh
  83. shellcheck -x utils/searx.sh
  84. shellcheck -x utils/morty.sh
  85. shellcheck -x utils/lxc.sh
  86. shellcheck -x utils/lxc-searx.env
  87. shellcheck -x .config.sh
  88. test.pep8: pyenvinstall
  89. $(PY_ENV_ACT); ./manage.sh pep8_check
  90. test.unit: pyenvinstall
  91. $(PY_ENV_ACT); ./manage.sh unit_tests
  92. test.robot: pyenvinstall
  93. $(PY_ENV_ACT); ./manage.sh install_geckodriver
  94. $(PY_ENV_ACT); ./manage.sh robot_tests
  95. .PHONY: $(PHONY)