Makefile 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. # Force Bash
  2. SHELL := /bin/bash
  3. ifeq ($(DESTDIR),)
  4. DESTDIR := /
  5. endif
  6. ifeq ($(PREFIX),)
  7. PREFIX := usr/
  8. endif
  9. LC_SRC = ./locale
  10. # Locale .po sources
  11. LC_SOURCES := $(shell find $(LC_SRC) -name '*.po')
  12. # Locale .mo bins
  13. LC_OBJECTS := $(shell find $(LC_SRC) -name '*.mo')
  14. LC_INSTALL := $(patsubst $(LC_SRC)/%,%,$(LC_OBJECTS))
  15. # Theme .qrc icon sources
  16. QRC_SOURCES := $(shell find ./themes -name '*.qrc')
  17. # Docs
  18. DOC_INSTALL += "README.md" "COPYING" "CHANGELOG.md" "docs/index.html" \
  19. "docs/index.rst" "docs/style.css"
  20. DOC_IMG_INSTALL := $(foreach dir,docs, $(wildcard $(dir)/images/*.png))
  21. # Schema files
  22. SCHEMA_INSTALL = "data/schema/searxng_config.json" \
  23. "data/schema/searxng_query.json" \
  24. "data/schema/searx_space_instances.json"
  25. .PHONY : all
  26. all: wheel locale themes
  27. .PHONY : wheel
  28. wheel: $(LC_SOURCES)
  29. @python3 -m build --wheel --no-isolation
  30. .PHONY : locale
  31. locale: $(LC_SOURCES)
  32. @utils/locale_tool.sh -m all
  33. .PHONY : themes
  34. themes: $(QRC_SOURCES)
  35. @python3 utils/themes_tool.py make all
  36. .PHONY : install
  37. install:
  38. # INSTALL: The Searx-Qt Python package
  39. @python3 -m installer --destdir $(DESTDIR) dist/*.whl
  40. # INSTALL: Locales
  41. @for lc in $(LC_INSTALL) ; do \
  42. pathname=$$(dirname $$lc); \
  43. mkdir -p "$(DESTDIR)/$(PREFIX)/share/locale/$$pathname"; \
  44. cp "$(LC_SRC)/$$lc" "$(DESTDIR)/$(PREFIX)/share/locale/$$pathname"; \
  45. done
  46. # INSTALL: Themes
  47. @themes=$$(python3 utils/themes_tool.py list); \
  48. for theme in $${themes[@]} ; do \
  49. themepath="$(DESTDIR)/$(PREFIX)/share/searx-qt/themes/$${theme}"; \
  50. mkdir -p "$${themepath}"; \
  51. files=$$(python3 utils/themes_tool.py files $${theme}); \
  52. for file in $${files} ; do \
  53. cp "$${file}" "$${themepath}"; \
  54. done; \
  55. done
  56. # INSTALL: Docs
  57. @docdir="$(DESTDIR)/$(PREFIX)/share/doc/searx-qt"; \
  58. mkdir -p "$${docdir}"; \
  59. for file in $(DOC_INSTALL) ; do \
  60. cp "$${file}" "$${docdir}"; \
  61. done; \
  62. mkdir -p "$${docdir}/images"; \
  63. for file in $(DOC_IMG_INSTALL) ; do \
  64. cp "$${file}" "$${docdir}/images"; \
  65. done
  66. # INSTALL: Bin
  67. @mkdir -p "$(DESTDIR)/$(PREFIX)/bin/"
  68. @cp bin/searx-qt "$(DESTDIR)/$(PREFIX)/bin/"
  69. # INSTALL: Desktop
  70. @mkdir -p "$(DESTDIR)/$(PREFIX)/share/applications/"
  71. @cp share/searx-qt.desktop "$(DESTDIR)/$(PREFIX)/share/applications/"
  72. # INSTALL: Schemas
  73. @schemadir="$(DESTDIR)/$(PREFIX)/share/searx-qt/schema"; \
  74. mkdir -p "$${schemadir}"; \
  75. for file in $(SCHEMA_INSTALL) ; do \
  76. cp "$${file}" "$${schemadir}"; \
  77. done
  78. .PHONY : clean
  79. clean: dist build
  80. @rm -rf dist
  81. @rm -rf build