kopia lustrzana https://gitlab.com/sane-project/backends
153 wiersze
4.2 KiB
Makefile
153 wiersze
4.2 KiB
Makefile
# po/Makefile.in
|
|
# See po/README for documentation.
|
|
SHELL = /bin/sh
|
|
all: check-mo
|
|
|
|
# Create one line per backend with all files containing translatable text:
|
|
epson.*.po: ../backend/epson.c ../backend/epson.h
|
|
matsushita.*.po: ../backend/matsushita.c ../backend/matsushita.h
|
|
mustek.*.po: ../backend/mustek.c
|
|
mustek_usb.*.po: ../backend/mustek_usb.c
|
|
plustek.*.po: ../backend/plustek.c ../backend/plustek.h
|
|
pnm.*.po: ../backend/pnm.c
|
|
teco1.*.po: ../backend/teco1.c ../backend/teco1.h
|
|
umax.*.po: ../backend/umax.c
|
|
umax_pp.*.po: ../backend/umax_pp.c
|
|
sceptre.*.po: ../backend/sceptre.c ../backend/sceptre.h
|
|
snapscan.*.po: ../backend/snapscan.c
|
|
|
|
# end of configuration
|
|
|
|
prefix = @prefix@
|
|
exec_prefix = @exec_prefix@
|
|
datadir = @datadir@
|
|
localedir = $(datadir)/locale
|
|
gnulocaledir = $(prefix)/share/locale
|
|
top_srcdir = @top_srcdir@
|
|
srcdir = @srcdir@
|
|
|
|
PACKAGE = @PACKAGE@
|
|
VERSION = @VERSION@
|
|
distdir = $(top_srcdir)/$(PACKAGE)-$(VERSION)
|
|
|
|
INSTALL_TRANSLATIONS = @INSTALL_TRANSLATIONS@
|
|
ifeq ($(INSTALL_TRANSLATIONS),install-translations)
|
|
UNINSTALL_TRANSLATIONS = uninstall-translations
|
|
UPDATE_MO = update-mo
|
|
endif
|
|
|
|
MKDIR = $(top_srcdir)/mkinstalldirs
|
|
INSTALL = @INSTALL@
|
|
INSTALL_PROGRAM = @INSTALL_PROGRAM@
|
|
INSTALL_DATA = @INSTALL_DATA@
|
|
|
|
MSGFMT = msgfmt
|
|
XGETTEXT = xgettext
|
|
MSGMERGE = msgmerge
|
|
|
|
TMP_FILE_DIR = .tmp
|
|
|
|
ALL_POS = $(wildcard *.po)
|
|
ALL_BACKENDS = $(sort $(basename $(basename $(ALL_POS))))
|
|
ALL_POTS = $(addsuffix .pot,$(ALL_BACKENDS))
|
|
ALL_MOS = $(filter-out saneopts.%.mo,$(addsuffix .mo,$(basename $(ALL_POS))))
|
|
ALL_LINGUAS = $(sort $(subst .,,$(suffix $(basename $(ALL_POS)))))
|
|
|
|
DISTCLEAN_FILES = @DISTCLEAN_FILES@
|
|
|
|
DISTFILES = Makefile.in README epson.de.po mustek.de.po matsushita.fr.po \
|
|
mustek_usb.de.po plustek.de.po plustek.es.po pnm.de.po saneopts.de.po \
|
|
saneopts.fr.po saneopts.es.po sceptre.fr.po teco1.fr.po umax.de.po \
|
|
umax.fr.po umax_pp.fr.po snapscan.de.po umax_pp.de.po
|
|
|
|
.PHONY: all clean depend dist distclean install install-translations \
|
|
uninstall update-mo update-po generate-%
|
|
|
|
.SUFFIXES: .po .mo
|
|
|
|
saneopts.*.po: ../include/sane/saneopts.h
|
|
|
|
# backend.lang.po -> backend.lang.mo; include saneopts.??.po while removing
|
|
# its msgid "" to avoid msgfmt errors
|
|
.po.mo:
|
|
@lang=$(subst .,,$(suffix $(basename $(subst install-,,$@)))) ; \
|
|
echo generating $@ from $< and saneopts.$${lang}.po ; \
|
|
(cat $< ; \
|
|
awk 'BEGIN {empty_msgid = 0; empty_line = 0}; \
|
|
/^msgid ""/ {empty_msgid = 1}; \
|
|
{if (empty_msgid == 1) {if (/^$$/) {empty_line = 1}}} ; \
|
|
{if (empty_line != 1) {sub(/^/, "#")} ; \
|
|
print}' \
|
|
saneopts.$${lang}.po ; \
|
|
)| $(MSGFMT) -o $@ -
|
|
|
|
|
|
# Sourcefiles -> backend.lang.po (updating po)
|
|
$(foreach lang,$(ALL_LINGUAS),%.$(lang).po):
|
|
@echo -n "updating $@ from $^ "
|
|
@rm -rf $(TMP_FILE_DIR)
|
|
@mkdir $(TMP_FILE_DIR) && \
|
|
for file in $^ ; do \
|
|
sed < $${file} -e 's/#define//g' \
|
|
> $(TMP_FILE_DIR)/`basename $${file}` ; \
|
|
done
|
|
@$(XGETTEXT) -d$* -kSANE_I18N $(TMP_FILE_DIR)/*.*
|
|
@mv $*.po $*.pot
|
|
@cp $@ $@.old
|
|
@$(MSGMERGE) $@.old $*.pot -o $@
|
|
@rm -f $@.old
|
|
|
|
# Generate new po file
|
|
%-gen:
|
|
@if test ! -e $* ; then \
|
|
touch $* -d "1980-01-01" ; \
|
|
echo created new file: $* ; \
|
|
$(MAKE) $* ; \
|
|
fi
|
|
|
|
update-po: $(ALL_POS)
|
|
|
|
update-mo: $(ALL_MOS)
|
|
|
|
check-mo: $(UPDATE_MO)
|
|
|
|
$(addprefix install-,$(ALL_MOS)):
|
|
@mo_file=$(subst install-,,$@) ; \
|
|
backend=$(basename $(basename $(subst install-,,$@))) ; \
|
|
lang=$(subst .,,$(suffix $(basename $(subst install-,,$@)))) ; \
|
|
dir=$(gnulocaledir)/$${lang}/LC_MESSAGES ; \
|
|
echo installing $${mo_file} to $${dir}/sane-$${backend}.mo... ; \
|
|
$(MKDIR) $(DESTDIR)$${dir} && \
|
|
$(INSTALL_DATA) $${mo_file} $(DESTDIR)$${dir}/sane-$${backend}.mo ;
|
|
|
|
install-translations: $(addprefix install-,$(ALL_MOS))
|
|
|
|
install: $(INSTALL_TRANSLATIONS)
|
|
|
|
uninstall-translations:
|
|
@for lang in $(ALL_LINGUAS) ; do \
|
|
dir=$(gnulocaledir)/$${lang}/LC_MESSAGES ; \
|
|
echo removing $${dir}/sane-*.mo ; \
|
|
rm -f $${dir}/sane-*.mo ; \
|
|
done
|
|
|
|
uninstall: $(UNINSTALL_TRANSLATIONS)
|
|
|
|
clean:
|
|
rm -f *.mo
|
|
rm -f *.old
|
|
|
|
distclean: clean
|
|
rm -f $(DISTCLEAN_FILES)
|
|
rm -f Makefile
|
|
rm -f *.pot
|
|
rm -rf $(TMP_FILE_DIR)
|
|
|
|
depend:
|
|
|
|
dist: $(DISTFILES)
|
|
for file in $(DISTFILES); do \
|
|
ln $$file $(distdir)/po 2> /dev/null \
|
|
|| cp -p $$file $(distdir)/po ; \
|
|
done
|