Makefile 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. .DEFAULT_GOAL := help
  2. ifndef TAG
  3. TAG=alpine
  4. endif
  5. PORT ?= 8080
  6. PHP := $(shell sh -c 'which php')
  7. ifeq ($(findstring alpine,$(TAG)),alpine)
  8. DOCKERFILE=Dockerfile-Alpine
  9. else ifeq ($(findstring arm,$(TAG)),arm)
  10. DOCKERFILE=Dockerfile-QEMU-ARM
  11. else
  12. DOCKERFILE=Dockerfile
  13. endif
  14. ############
  15. ## Docker ##
  16. ############
  17. .PHONY: build
  18. build: ## Build a Docker image
  19. docker build \
  20. --pull \
  21. --tag freshrss/freshrss:$(TAG) \
  22. --file Docker/$(DOCKERFILE) .
  23. .PHONY: start
  24. start: ## Start the development environment (use Docker)
  25. docker run \
  26. --rm \
  27. --volume $(shell pwd):/var/www/FreshRSS:z \
  28. --publish $(PORT):80 \
  29. --env FRESHRSS_ENV=development \
  30. --name freshrss-dev \
  31. freshrss/freshrss:$(TAG)
  32. .PHONY: stop
  33. stop: ## Stop FreshRSS container if any
  34. docker stop freshrss-dev
  35. ##########
  36. ## I18N ##
  37. ##########
  38. .PHONY: i18n-format
  39. i18n-format: ## Format I18N files
  40. @$(PHP) ./cli/manipulate.translation.php -a format
  41. @echo Files formatted.
  42. .PHONY: i18n-add-language
  43. i18n-add-language: ## Add a new supported language
  44. ifndef lang
  45. @echo To add a new language, you need to provide one in the "lang" variable.
  46. @exit 10
  47. endif
  48. @$(PHP) ./cli/manipulate.translation.php -a add -l $(lang)
  49. @echo Language added.
  50. .PHONY: i18n-add-key
  51. i18n-add-key: ## Add a translation key to all supported languages
  52. ifndef key
  53. @echo To add a key, you need to provide one in the "key" variable.
  54. @exit 10
  55. endif
  56. ifndef value
  57. @echo To add a key, you need to provide its value in the "value" variable.
  58. @exit 10
  59. endif
  60. @$(PHP) ./cli/manipulate.translation.php -a add -k $(key) -v "$(value)"
  61. @echo Key added.
  62. .PHONY: i18n-remove-key
  63. i18n-remove-key: ## Remove a translation key from all supported languages
  64. ifndef key
  65. @echo To remove a key, you need to provide one in the "key" variable.
  66. @exit 10
  67. endif
  68. @$(PHP) ./cli/manipulate.translation.php -a delete -k $(key)
  69. @echo Key removed.
  70. .PHONY: i18n-ignore-key
  71. i18n-ignore-key: ## Ignore a translation key for the selected language
  72. ifndef lang
  73. @echo To ignore a key, you need to provide a language in the "lang" variable.
  74. @exit 10
  75. endif
  76. ifndef key
  77. @echo To ignore a key, you need to provide one in the "key" variable.
  78. @exit 10
  79. endif
  80. @$(PHP) ./cli/manipulate.translation.php -a ignore -k $(key) -l $(lang)
  81. @echo Key ignored.
  82. ##########
  83. ## HELP ##
  84. ##########
  85. .PHONY: help
  86. help:
  87. @grep --extended-regexp '^[a-zA-Z0-9_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'