Makefile 3.2 KB

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