2017-09-15 23:39:32 +02:00
|
|
|
|
2017-10-13 14:50:22 +02:00
|
|
|
FILES = ../fdroid $(wildcard ../fdroidserver/*.py) \
|
|
|
|
$(wildcard /usr/lib/python3.*/argparse.py) \
|
|
|
|
$(wildcard /usr/lib/python3.*/optparse.py) \
|
|
|
|
$(wildcard /usr/lib/python3.*/getopt.py)
|
2017-09-15 23:39:32 +02:00
|
|
|
|
|
|
|
# these are the supported languages
|
2021-01-16 15:12:01 +01:00
|
|
|
ALL_LINGUAS = $(shell sed -En 's,include locale/([^/]+)/.*,\1,p' ../MANIFEST.in)
|
2017-10-17 17:41:20 +02:00
|
|
|
POFILES = $(wildcard */LC_MESSAGES/fdroidserver.po)
|
2017-09-15 23:39:32 +02:00
|
|
|
MOFILES = $(ALL_LINGUAS:=/LC_MESSAGES/fdroidserver.mo)
|
|
|
|
|
|
|
|
TEMPLATE = fdroidserver.pot
|
|
|
|
|
|
|
|
VERSION = $(shell git describe)
|
|
|
|
|
2021-01-29 16:13:52 +01:00
|
|
|
OPTS = --no-wrap --sort-output --add-location=file
|
|
|
|
|
2018-09-20 11:35:07 +02:00
|
|
|
default:
|
|
|
|
@printf "Build the translation files using: ./setup.py compile_catalog\n\n"
|
|
|
|
|
|
|
|
message:
|
|
|
|
@printf "\nYou probably want to use this instead: ./setup.py compile_catalog\n\n"
|
|
|
|
|
2017-10-19 18:02:00 +02:00
|
|
|
# refresh everything from the source code
|
|
|
|
update: $(POFILES)
|
|
|
|
|
2017-09-15 23:39:32 +02:00
|
|
|
# generate .mo files from the .po files
|
2018-09-20 11:35:07 +02:00
|
|
|
compile: message $(MOFILES)
|
2017-09-15 23:39:32 +02:00
|
|
|
|
2017-10-19 18:02:00 +02:00
|
|
|
clean:
|
2017-09-15 23:39:32 +02:00
|
|
|
-rm -f -- $(MOFILES)
|
|
|
|
-rm -f -- $(POFILES:=~)
|
|
|
|
|
|
|
|
$(TEMPLATE): $(FILES)
|
|
|
|
xgettext --join-existing --from-code=UTF-8 \
|
|
|
|
--language=Python --keyword=_ \
|
2021-01-29 16:13:52 +01:00
|
|
|
$(OPTS) --output=$(TEMPLATE) \
|
2017-09-15 23:39:32 +02:00
|
|
|
--package-name="fdroidserver" --package-version=$(VERSION) \
|
|
|
|
--foreign-user \
|
|
|
|
--msgid-bugs-address=https://gitlab.com/fdroid/fdroidserver/issues \
|
|
|
|
$(FILES)
|
2021-01-29 16:13:52 +01:00
|
|
|
msguniq $(OPTS) --use-first \
|
|
|
|
--output-file=$(TEMPLATE) $(TEMPLATE)
|
2017-09-15 23:39:32 +02:00
|
|
|
sed -i 's,CHARSET,UTF-8,' $(TEMPLATE)
|
|
|
|
|
2017-10-17 17:41:20 +02:00
|
|
|
%.po: $(TEMPLATE)
|
2021-01-29 16:20:42 +01:00
|
|
|
msgattrib $(OPTS) --no-obsolete --output-file=$@ $@
|
2021-01-29 16:13:52 +01:00
|
|
|
msguniq $(OPTS) --use-first --output-file=$@ $@
|
|
|
|
msgmerge $(OPTS) --update $@ $(TEMPLATE)
|
2017-10-17 17:41:20 +02:00
|
|
|
|
2017-09-15 23:39:32 +02:00
|
|
|
%/LC_MESSAGES/fdroidserver.mo: %/LC_MESSAGES/fdroidserver.po
|
|
|
|
msgfmt --check -o $@ $(@:mo=po)
|
|
|
|
|
|
|
|
|
2017-10-19 18:02:00 +02:00
|
|
|
.PHONY = compile clean update
|