Makefile 3.1 KB

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