Makefile 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133
  1. # -*- coding: utf-8; mode: makefile-gmake -*-
  2. .DEFAULT_GOAL=help
  3. include ./.config.mk
  4. include utils/makefile.include
  5. PYOBJECTS = searx
  6. DOC = docs
  7. PY_SETUP_EXTRAS ?= \[test\]
  8. include utils/makefile.python
  9. include utils/makefile.sphinx
  10. all: clean install
  11. PHONY += help-min help-all help
  12. help: help-min
  13. @echo ''
  14. @echo 'to get more help: make help-all'
  15. help-min:
  16. @echo ' test - run developer tests'
  17. @echo ' docs - build documentation'
  18. @echo ' docs-live - autobuild HTML documentation while editing'
  19. @echo ' run - run developer instance'
  20. @echo ' install - developer install (./local)'
  21. @echo ' uninstall - uninstall (./local)'
  22. @echo ' gh-pages - build docs & deploy on gh-pages branch'
  23. @echo ' clean - drop builds and environments'
  24. @echo ' project - re-build generic files of the searx project'
  25. @echo ''
  26. @echo 'environment'
  27. @echo ' SEARX_URL = $(SEARX_URL)'
  28. @echo ' GIT_URL = $(GIT_URL)'
  29. @echo ' DOCS_URL = $(DOCS_URL)'
  30. @echo ''
  31. @$(MAKE) -e -s make-help
  32. help-all: help-min
  33. @echo ''
  34. @$(MAKE) -e -s python-help
  35. @echo ''
  36. @$(MAKE) -e -s docs-help
  37. PHONY += install
  38. install: pyenvinstall
  39. PHONY += uninstall
  40. uninstall: pyenvuninstall
  41. PHONY += clean
  42. clean: pyclean docs-clean
  43. $(call cmd,common_clean)
  44. PHONY += run
  45. run: pyenvinstall
  46. $(Q) ( \
  47. sed -i -e "s/debug : False/debug : True/g" ./searx/settings.yml ; \
  48. sleep 2 ; \
  49. xdg-open http://127.0.0.1:8888/ ; \
  50. sleep 3 ; \
  51. sed -i -e "s/debug : True/debug : False/g" ./searx/settings.yml ; \
  52. ) &
  53. $(PY_ENV)/bin/python ./searx/webapp.py
  54. # docs
  55. # ----
  56. PHONY += docs
  57. docs: pyenvinstall sphinx-doc prebuild-includes
  58. $(call cmd,sphinx,html,docs,docs)
  59. PHONY += docs-live
  60. docs-live: pyenvinstall sphinx-live prebuild-includes
  61. $(call cmd,sphinx_autobuild,html,docs,docs)
  62. prebuild-includes:
  63. @mkdir -p $(DOCS_BUILD)/includes
  64. @./utils/searx.sh doc | cat > $(DOCS_BUILD)/includes/searx.rst
  65. @./utils/filtron.sh doc | cat > $(DOCS_BUILD)/includes/filtron.rst
  66. @./utils/morty.sh doc | cat > $(DOCS_BUILD)/includes/morty.rst
  67. $(GH_PAGES)::
  68. @echo "doc available at --> $(DOCS_URL)"
  69. # update project files
  70. # --------------------
  71. PHONY += project engines-languages
  72. project: searx/data/engines_languages.json
  73. searx/data/engines_languages.json: pyenvinstall
  74. $(PY_ENV_ACT); python utils/fetch_languages.py
  75. mv engines_languages.json searx/data/engines_languages.json
  76. mv languages.py searx/languages.py
  77. # test
  78. # ----
  79. PHONY += test test.sh test.pylint test.pep8 test.unit test.robot
  80. test: test.pylint test.pep8 test.unit test.robot
  81. # TODO: balance linting with pylint
  82. test.pylint: pyenvinstall
  83. $(call cmd,pylint,searx/preferences.py)
  84. $(call cmd,pylint,searx/testing.py)
  85. # ubu1604: uses shellcheck v0.3.7 (from 04/2015), no longer supported!
  86. test.sh:
  87. shellcheck -x utils/lib.sh
  88. shellcheck -x utils/filtron.sh
  89. shellcheck -x utils/searx.sh
  90. shellcheck -x utils/morty.sh
  91. shellcheck -x utils/lxc.sh
  92. shellcheck -x utils/lxc-searx.env
  93. shellcheck -x .config.sh
  94. test.pep8: pyenvinstall
  95. $(PY_ENV_ACT); ./manage.sh pep8_check
  96. test.unit: pyenvinstall
  97. $(PY_ENV_ACT); ./manage.sh unit_tests
  98. test.robot: pyenvinstall
  99. $(PY_ENV_ACT); ./manage.sh install_geckodriver
  100. $(PY_ENV_ACT); ./manage.sh robot_tests
  101. .PHONY: $(PHONY)