kopia lustrzana https://gitlab.com/sane-project/backends
Made Makefile more intelligent. Targets are only updated if necessary.
No manual copying necessary. Henning Meier-Geinitz <henning@meier-geinitz.de>DEVEL_2_0_BRANCH-1
rodzic
0bc2ba30e3
commit
5f8db0838e
|
@ -2,14 +2,14 @@
|
|||
INSTALL_TRANSLATIONS = @INSTALL_TRANSLATIONS@
|
||||
all: $(if $(INSTALL_TRANSLATIONS),update-mo)
|
||||
|
||||
# Add backends to ALL_BACKENDS:
|
||||
ALL_BACKENDS = epson mustek mustek_usb umax
|
||||
# See po/README for documentation.
|
||||
|
||||
# Create one line per backend with all files containing translatable text:
|
||||
epson.pot: ../backend/epson.c ../backend/epson.h
|
||||
mustek.pot: ../backend/mustek.c
|
||||
mustek_usb.pot: ../backend/mustek_usb.c
|
||||
umax.pot: ../backend/umax.c
|
||||
epson.*.po: ../backend/epson.c ../backend/epson.h
|
||||
mustek.*.po: ../backend/mustek.c
|
||||
mustek_usb.*.po: ../backend/mustek_usb.c
|
||||
pnm.*.po: ../backend/pnm.c
|
||||
umax.*.po: ../backend/umax.c
|
||||
|
||||
# end of configuration
|
||||
|
||||
|
@ -30,9 +30,18 @@ INSTALL = @INSTALL@
|
|||
INSTALL_PROGRAM = @INSTALL_PROGRAM@
|
||||
INSTALL_DATA = @INSTALL_DATA@
|
||||
|
||||
MSGFMT = msgfmt
|
||||
XGETTEXT = xgettext
|
||||
MSGMERGE = msgmerge
|
||||
|
||||
OPTS = ../include/sane/saneopts.h
|
||||
TMP_FILE_DIR = .tmp
|
||||
ALL_POTS =$(foreach be,$(ALL_BACKENDS),$(addprefix $(be),.pot))
|
||||
|
||||
ALL_POS = $(wildcard *.po)
|
||||
ALL_BACKENDS = $(sort $(basename $(basename $(ALL_POS))))
|
||||
ALL_POTS = $(addsuffix .pot,$(ALL_BACKENDS))
|
||||
ALL_MOS = $(addsuffix .mo,$(basename $(ALL_POS)))
|
||||
ALL_LINGUAS = $(sort $(subst .,,$(suffix $(basename $(ALL_POS)))))
|
||||
|
||||
INSTALL_TRANSLATIONS = @INSTALL_TRANSLATIONS@
|
||||
|
||||
|
@ -40,57 +49,61 @@ DISTFILES = Makefile.in README epson.de.po mustek.de.po \
|
|||
mustek_usb.de.po umax.de.po
|
||||
|
||||
.PHONY: all clean depend dist distclean install install-translations \
|
||||
uninstall update-mo update-po update-pot
|
||||
uninstall update-mo update-po generate-%
|
||||
|
||||
.SUFFIXES: .po .mo
|
||||
|
||||
# backend.lang.po -> backend.lang.mo
|
||||
.po.mo:
|
||||
msgfmt -o $@ $<
|
||||
@echo generating $@ from $<
|
||||
@$(MSGFMT) -o $@ $<
|
||||
|
||||
%.pot: $(OPTS)
|
||||
# Sourcefiles -> backend.lang.po (updating po)
|
||||
$(foreach lang,$(ALL_LINGUAS),%.$(lang).po): $(OPTS)
|
||||
@echo -n "updating $@ from $^ "
|
||||
@rm -rf $(TMP_FILE_DIR)
|
||||
@mkdir $(TMP_FILE_DIR) && \
|
||||
for file in $^ ; do \
|
||||
echo parsing $${file} ; \
|
||||
sed < $${file} -e 's/#define//g' \
|
||||
> $(TMP_FILE_DIR)/`basename $${file}` ; \
|
||||
done && \
|
||||
xgettext -d$* -kSANE_I18N $(TMP_FILE_DIR)/*.* && \
|
||||
mv $*.po $*.pot
|
||||
> $(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
|
||||
|
||||
update-pot: $(ALL_POTS)
|
||||
# Generate new po file
|
||||
%-gen:
|
||||
@if test ! -e $* ; then \
|
||||
touch $* -d "1980-01-01" ; \
|
||||
echo created new file: $* ; \
|
||||
$(MAKE) $* ; \
|
||||
fi
|
||||
|
||||
update-po: $(ALL_POTS)
|
||||
@pots="$(subst .pot,,$^)" ; \
|
||||
for po_file in *.po ; do \
|
||||
backend=`echo "$${po_file}" | sed -e "s/\..*$$//"` && \
|
||||
echo updating $${po_file} from $${backend}.pot && \
|
||||
cp $${po_file} $${po_file}.old && \
|
||||
msgmerge $${po_file}.old $${backend}.pot -o $${po_file} && \
|
||||
rm $${po_file}.old ; \
|
||||
done
|
||||
update-po: $(ALL_POS)
|
||||
|
||||
update-mo: update-po
|
||||
@for po_file in *.po ; do \
|
||||
mo_file=`echo $${po_file} | sed -e "s/\.po$$/.mo/"` ; \
|
||||
$(MAKE) $${mo_file} ; \
|
||||
done
|
||||
update-mo: $(ALL_MOS)
|
||||
|
||||
install-translations:
|
||||
@for mo_file in *.mo ; do \
|
||||
lang=`echo $${mo_file} | sed -e "s/\.mo$$//" -e "s/^.*\.//" ` ; \
|
||||
backend=`echo $${mo_file} | sed -e "s/\..*$$//"` ; \
|
||||
dir=$(gnulocaledir)/$${lang}/LC_MESSAGES ; \
|
||||
echo installing $${mo_file} to $${dir}/sane-$${backend}.mo ; \
|
||||
$(MKDIR) $${dir} ; \
|
||||
$(INSTALL_DATA) $${mo_file} $${dir}/sane-$${backend}.mo ; \
|
||||
done
|
||||
$(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) $${dir} && \
|
||||
$(INSTALL_DATA) $${mo_file} $${dir}/sane-$${backend}.mo ;
|
||||
|
||||
install: $(if $(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
|
||||
|
||||
# fixme
|
||||
uninstall:
|
||||
uninstall: $(if $(INSTALL_TRANSLATIONS),uninstall-translations)
|
||||
|
||||
clean:
|
||||
rm -f *.mo
|
||||
|
@ -98,8 +111,8 @@ clean:
|
|||
|
||||
distclean: clean
|
||||
rm -f Makefile
|
||||
rm -f *~
|
||||
rm -f *.pot
|
||||
rm -f *~
|
||||
rm -rf $(TMP_FILE_DIR)
|
||||
|
||||
depend:
|
||||
|
|
24
po/README
24
po/README
|
@ -1,8 +1,9 @@
|
|||
2002-01-08
|
||||
2002-01-10
|
||||
|
||||
This directory contains translations for the options of the SANE backends.
|
||||
They are only used if configure is called with option --enable-translations.
|
||||
Currently these translations are only used by XSane.
|
||||
You will nee GNU gettext: xgettext, msgfmt and msgmerge. Currently these
|
||||
translations are only used by XSane.
|
||||
|
||||
What do you need to do if you want to:
|
||||
|
||||
|
@ -12,12 +13,12 @@ What do you need to do if you want to:
|
|||
|
||||
- Update existing translations when the source code has changed
|
||||
* cd po ; make
|
||||
* Edit backend.lang.po, add/change translations.
|
||||
* make install
|
||||
* Edit backend.lang.po, add/change translations. (with lang = your
|
||||
language, e.g. "de", and backend = your backend, e.g. mustek)
|
||||
* make ; make install
|
||||
|
||||
- Add a new language
|
||||
* cd po ; make
|
||||
* cp backend.pot backend.lang.pot (with lang = your language, e.g. "de")
|
||||
- Add a new language to an existing backend
|
||||
* cd po ; make backend.lang.po-gen
|
||||
* Edit backend-lang.po, enter translations. Don't forget to edit the header.
|
||||
* make ; make install
|
||||
|
||||
|
@ -28,11 +29,10 @@ What do you need to do if you want to:
|
|||
Do NOT mark macros. Especially you don't need to mark standard option
|
||||
strings like SANE_TITLE_NUM_OPTIONS as this is already done in saneopts.h.
|
||||
Example: s->opt[5].title = SANE_I18N("Enhancement");
|
||||
* Edit Makefile.in. Add your backend to ALL_BACKENDS and add a line
|
||||
"backend.pot: yourfiles" where yourfiles is a list of all your files
|
||||
containing translatable text.
|
||||
* cd po ; make
|
||||
* cp backend.pot backend.lang.pot (with lang = your language, e.g. "de")
|
||||
* Edit Makefile.in. Add a line "backend.*.po: yourfiles" where yourfiles is
|
||||
a space-separated list of all your files containing translatable text.
|
||||
* ./configure --enable-translations
|
||||
* cd po ; make backend.lang.po-gen
|
||||
* Edit backend-lang.po, enter translations. Don't forget to edit the header.
|
||||
* make ; make install
|
||||
|
||||
|
|
Ładowanie…
Reference in New Issue