Makefile 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  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
  12. help:
  13. @echo ' test - run developer tests'
  14. @echo ' docs - build documentation'
  15. @echo ' docs-live - autobuild HTML documentation while editing'
  16. @echo ' run - run developer instance'
  17. @echo ' install - developer install (./local)'
  18. @echo ' uninstall - uninstall (./local)'
  19. @echo ' gh-pages - build docs & deploy on gh-pages branch'
  20. @echo ' clean - drop builds and environments'
  21. @echo ' project - re-build generic files of the searx project'
  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) -e -s -f utils/makefile.include make-help
  29. @echo ''
  30. @$(MAKE) -e -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 docs-clean
  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 prebuild-includes
  52. $(call cmd,sphinx,html,docs,docs)
  53. PHONY += docs-live
  54. docs-live: pyenvinstall sphinx-live prebuild-includes
  55. $(call cmd,sphinx_autobuild,html,docs,docs)
  56. prebuild-includes:
  57. @mkdir -p $(DOCS_BUILD)/includes
  58. @./utils/searx.sh doc | cat > $(DOCS_BUILD)/includes/searx.rst
  59. @./utils/filtron.sh doc | cat > $(DOCS_BUILD)/includes/filtron.rst
  60. @./utils/morty.sh doc | cat > $(DOCS_BUILD)/includes/morty.rst
  61. $(GH_PAGES)::
  62. @echo "doc available at --> $(DOCS_URL)"
  63. # update project files
  64. # --------------------
  65. PHONY += project engines-languages
  66. project: searx/data/engines_languages.json
  67. searx/data/engines_languages.json: pyenvinstall
  68. $(PY_ENV_ACT); python utils/fetch_languages.py
  69. mv engines_languages.json searx/data/engines_languages.json
  70. mv languages.py searx/languages.py
  71. # test
  72. # ----
  73. PHONY += test test.sh test.pylint test.pep8 test.unit test.robot
  74. test: test.pylint test.pep8 test.unit test.robot
  75. # TODO: balance linting with pylint
  76. test.pylint: pyenvinstall
  77. $(call cmd,pylint,searx/preferences.py)
  78. $(call cmd,pylint,searx/testing.py)
  79. # ubu1604: uses shellcheck v0.3.7 (from 04/2015), no longer supported!
  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)