Makefile 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136
  1. # -*- coding: utf-8; mode: makefile-gmake -*-
  2. export GIT_URL=https://github.com/asciimoo/searx
  3. export SEARX_URL=https://searx.me
  4. export DOCS_URL=https://asciimoo.github.io/searx
  5. PYOBJECTS = searx
  6. DOC = docs
  7. PY_SETUP_EXTRAS ?= \[test\]
  8. PYDIST=./dist/py
  9. PYBUILD=./build/py
  10. include utils/makefile.include
  11. include utils/makefile.python
  12. include utils/makefile.sphinx
  13. all: clean install
  14. PHONY += help
  15. help:
  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 ' themes - re-build build the source of the themes'
  26. @echo ' docker - build Docker image'
  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. # update project files
  59. # --------------------
  60. PHONY += project engines-languages searx.brand
  61. project: searx/data/engines_languages.json searx.brand
  62. engines-languages: pyenvinstall
  63. $(PY_ENV_ACT); python utils/fetch_languages.py
  64. mv engines_languages.json searx/data/engines_languages.json
  65. mv languages.py searx/languages.py
  66. searx.brand:
  67. $(Q)echo "build searx/brand.py"
  68. $(Q)echo "GIT_URL = '$(GIT_URL)'" > searx/brand.py
  69. $(Q)echo "SEARX_URL = '$(SEARX_URL)'" >> searx/brand.py
  70. $(Q)echo "DOCS_URL = '$(DOCS_URL)'" >> searx/brand.py
  71. $(Q)echo "PUBLIC_INSTANCES = 'https://searx.space'" >> searx/brand.py
  72. # build themes
  73. # ------------
  74. PHONY += themes themes.oscar themes.simple
  75. themes: themes.oscar themes.simple
  76. themes.oscar:
  77. $(Q)echo '[!] Grunt build : oscar theme'
  78. $(Q)grunt --gruntfile "searx/static/themes/oscar/gruntfile.js"
  79. themes.simple:
  80. $(Q)echo '[!] Grunt build : simple theme'
  81. $(Q)grunt --gruntfile "searx/static/themes/simple/gruntfile.js"
  82. # docker
  83. # ------
  84. PHONY += docker
  85. docker:
  86. $(Q)./manage.sh docker_build
  87. # test
  88. # ----
  89. PHONY += test test.pylint test.pep8 test.unit test.robot
  90. test: test.pylint test.pep8 test.unit test.robot
  91. # TODO: balance linting with pylint
  92. test.pylint: pyenvinstall
  93. $(call cmd,pylint,searx/preferences.py)
  94. $(call cmd,pylint,searx/testing.py)
  95. test.pep8: pyenvinstall
  96. $(PY_ENV_ACT); ./manage.sh pep8_check
  97. test.unit: pyenvinstall
  98. $(PY_ENV_ACT); ./manage.sh unit_tests
  99. test.robot: pyenvinstall
  100. $(PY_ENV_ACT); ./manage.sh install_geckodriver
  101. $(PY_ENV_ACT); ./manage.sh robot_tests
  102. .PHONY: $(PHONY)