Files
koreader/make/gettext.mk
T
Benoit Pierre 620c73a7af make: fix mo rules (#15813)
Avoid an infinite recursive loop when using an empty sparse checkout.
2026-08-05 23:18:56 +02:00

38 lines
884 B
Makefile

PHONY += mo mo-clean po pot
SELF := $(lastword $(MAKEFILE_LIST))
DOMAIN = koreader
TEMPLATE_DIR = l10n/templates
MSGFMT_BIN = msgfmt
XGETTEXT_BIN = xgettext
PO_FILES = $(wildcard l10n/*/*.po)
MO_FILES = $(PO_FILES:%.po=%.mo)
%.mo: %.po
@$(MSGFMT_BIN) --no-hash -o $@ $<
mo:
ifneq (,$(MO_FILES))
$(MAKE) $(if $(PARALLEL_JOBS),--jobs=$(PARALLEL_JOBS)) $(if $(PARALLEL_LOAD),--load-average=$(PARALLEL_LOAD)) --silent --file=$(SELF) $(MO_FILES)
endif
mo-clean:
ifneq (,$(MO_FILES))
rm -f $(MO_FILES)
endif
pot: po
mkdir -p $(TEMPLATE_DIR)
$(XGETTEXT_BIN) --from-code=utf-8 \
--keyword=C_:1c,2 --keyword=N_:1,2 --keyword=NC_:1c,2,3 \
--add-comments=@translators \
reader.lua `find frontend -iname "*.lua" | sort` \
`find plugins -iname "*.lua" | sort` \
`find tools -iname "*.lua" | sort` \
-o $(TEMPLATE_DIR)/$(DOMAIN).pot
po:
git submodule update --remote l10n