2005-10-19 22:00:35 -04:00
|
|
|
top_builddir=..
|
|
|
|
include $(top_builddir)/Makefile.config
|
2005-09-15 09:58:31 -04:00
|
|
|
|
|
|
|
# Where to install the catalog files.
|
|
|
|
localedir = $(datadir)/locale
|
|
|
|
|
|
|
|
# These are for some reason not added magically to the Makefile.
|
|
|
|
MSGMERGE = msgmerge
|
2006-01-01 16:32:42 -05:00
|
|
|
PERL = perl
|
2005-09-15 09:58:31 -04:00
|
|
|
|
2005-10-19 05:09:41 -04:00
|
|
|
# Name of the file containing the list of files to translate (used by
|
|
|
|
# xgettext)
|
|
|
|
POTFILES_ABS_LIST = potfiles.list
|
2005-09-15 09:58:31 -04:00
|
|
|
|
2006-01-03 08:04:25 -05:00
|
|
|
POTFILES_REL = $(shell find $(top_srcdir)/src/ -name '*.[ch]' -o -name options.inc -o -name 'actions-*.inc' | sort)
|
|
|
|
|
2005-12-26 13:17:47 -05:00
|
|
|
quiet_cmd_gmsgfmt = ' [$(PO_COLOR)GMSGFMT$(END_COLOR)] $(RELPATH)$(@)'
|
|
|
|
cmd_gmsgfmt = rm -f -- "$@" && $(GMSGFMT) --statistics -o "$@" -- "$<"
|
|
|
|
|
2005-09-15 09:58:31 -04:00
|
|
|
|
2005-12-10 11:03:41 -05:00
|
|
|
# Distributed elinks-*.tar.gz packages include po/*.gmo files, so that
|
|
|
|
# users can install ELinks even if they don't have a msgfmt program.
|
|
|
|
# However, if srcdir != builddir, then this Makefile ignores the *.gmo
|
|
|
|
# files in the srcdir and builds new ones in the builddir.
|
2005-12-26 13:17:47 -05:00
|
|
|
%.gmo: $(srcdir)%.po
|
|
|
|
$(call ecmd,gmsgfmt)
|
2005-09-15 09:58:31 -04:00
|
|
|
|
|
|
|
|
|
|
|
### The default rule
|
|
|
|
#
|
2006-01-01 11:34:12 -05:00
|
|
|
# Note: Target `all-local' must not depend on target '$(srcdir)$(PACKAGE).pot',
|
2005-09-15 09:58:31 -04:00
|
|
|
# otherwise packages like GCC can not be built if only parts of the source have
|
|
|
|
# been downloaded.
|
|
|
|
#
|
|
|
|
# Note 2: We aren't gcc, we are ELinks. And I want that dependency ;-). --pasky
|
|
|
|
#
|
|
|
|
# Note 3: I changed my mind, it is really annoying if you just insert one line
|
|
|
|
# and suddenly you have tons of changes in all the .po files updating the line
|
|
|
|
# informations. --pasky
|
|
|
|
#
|
|
|
|
# $(CATALOGS) is empty if --disable-nls. Beats using *-(yes|no) targets.
|
|
|
|
|
2005-09-27 15:11:28 -04:00
|
|
|
all-local: $(CATALOGS)
|
2005-09-15 09:58:31 -04:00
|
|
|
|
|
|
|
|
|
|
|
### Creating the template po template file
|
|
|
|
#
|
|
|
|
# This pulls in _all_ .c and .h files in the src directory. Even files that has
|
2005-10-19 05:09:41 -04:00
|
|
|
# not been added to the git repo. Beware of junk entries!
|
2005-09-15 09:58:31 -04:00
|
|
|
|
2006-01-03 08:04:25 -05:00
|
|
|
$(srcdir)$(POTFILES_ABS_LIST): $(POTFILES_REL)
|
2005-10-19 05:09:41 -04:00
|
|
|
@( cd $(top_srcdir); \
|
|
|
|
find src/ -type f -name '*.[ch]' -o -name options.inc -o -name 'actions-*.inc' | sort ) \
|
2006-01-01 11:34:12 -05:00
|
|
|
> $(srcdir)$(POTFILES_ABS_LIST)
|
2005-10-19 05:09:41 -04:00
|
|
|
|
2007-07-17 07:32:07 -04:00
|
|
|
$(srcdir)$(PACKAGE).pot: $(srcdir)$(POTFILES_ABS_LIST) $(srcdir)perl/msgaccel-prepare
|
2005-09-15 09:58:31 -04:00
|
|
|
$(XGETTEXT) --default-domain=$(PACKAGE) \
|
|
|
|
--directory=$(top_srcdir) \
|
|
|
|
--add-comments --language=C \
|
2007-03-11 05:25:11 -04:00
|
|
|
--keyword=_ --keyword=N_ --keyword=n_:1,2 --keyword=N__ \
|
|
|
|
--flag=msg_text:2:c-format --flag=die:1:c-format \
|
|
|
|
--flag=secure_fprintf:2:c-format \
|
|
|
|
--flag=DBG:1:c-format --flag=elinks_debug:1:c-format \
|
|
|
|
--flag=WDBG:1:c-format --flag=elinks_wdebug:1:c-format \
|
|
|
|
--flag=ERROR:1:c-format --flag=elinks_error:1:c-format \
|
|
|
|
--flag=INTERNAL:1:c-format --flag=elinks_internal:1:c-format \
|
|
|
|
--flag=usrerror:1:c-format --flag=elinks_log:4:c-format \
|
|
|
|
--flag=LOG_ERR:1:c-format --flag=LOG_WARN:1:c-format \
|
|
|
|
--flag=LOG_INFO:1:c-format --flag=LOG_DBG:1:c-format \
|
|
|
|
--flag=assertm:2:c-format --flag=elinks_assertm:2:c-format \
|
|
|
|
--flag=add_format_to_string:2:c-format \
|
|
|
|
--flag=elinks_vsnprintf:3:c-format --flag=elinks_snprintf:3:c-format \
|
|
|
|
--flag=elinks_vasprintf:2:c-format --flag=elinks_asprintf:2:c-format \
|
|
|
|
--flag=vasprintfa:1:c-format --flag=asprintfa:1:c-format \
|
2007-03-11 06:33:34 -04:00
|
|
|
--flag=_:1:pass-c-format --flag=N_:1:pass-c-format \
|
|
|
|
--flag=n_:1:pass-c-format --flag=n_:2:pass-c-format \
|
|
|
|
--flag=N__:1:pass-c-format \
|
2007-03-11 05:25:11 -04:00
|
|
|
-f $(srcdir)$(POTFILES_ABS_LIST) \
|
2005-10-19 05:09:41 -04:00
|
|
|
&& test -f $(PACKAGE).po \
|
2007-07-17 07:32:07 -04:00
|
|
|
&& $(PERL) -I"$(srcdir)perl" $(srcdir)perl/msgaccel-prepare -S"$(top_srcdir)" $(PACKAGE).po \
|
2006-01-01 16:55:02 -05:00
|
|
|
&& mv -f $(PACKAGE).po $(srcdir)$(PACKAGE).pot
|
2005-09-15 09:58:31 -04:00
|
|
|
|
|
|
|
|
|
|
|
### Updating po and gmo files
|
|
|
|
#
|
|
|
|
# Update by merging all .po files with the .po template master file.
|
|
|
|
#
|
|
|
|
# It is possible to update only a single .po file by setting the PO variable to
|
|
|
|
# either <lang> or <lang>.po when calling make. Example: make update-po PO=is
|
|
|
|
|
2006-01-01 11:34:12 -05:00
|
|
|
update-po: Makefile $(srcdir)$(PACKAGE).pot
|
2005-10-18 06:14:38 -04:00
|
|
|
@$(foreach lang,$(basename $(if $(strip $(PO)),$(PO),$(GMOFILES))), \
|
|
|
|
echo -n "$(lang): "; \
|
2006-01-01 11:34:12 -05:00
|
|
|
if $(MSGMERGE) $(srcdir)$(lang).po $(srcdir)$(PACKAGE).pot -o $(lang).new.po; then \
|
|
|
|
mv -f $(lang).new.po $(srcdir)$(lang).po; \
|
2005-09-15 09:58:31 -04:00
|
|
|
else \
|
2005-10-18 06:11:55 -04:00
|
|
|
echo "msgmerge failed!"; \
|
2005-10-18 06:14:38 -04:00
|
|
|
rm -f $(lang).new.po; \
|
2005-09-15 09:58:31 -04:00
|
|
|
fi; \
|
2005-10-18 06:11:55 -04:00
|
|
|
)
|
2005-09-15 09:58:31 -04:00
|
|
|
$(MAKE) update-gmo
|
|
|
|
|
|
|
|
update-gmo: Makefile $(GMOFILES)
|
|
|
|
@:
|
|
|
|
|
|
|
|
|
|
|
|
### Check single or all po files
|
|
|
|
#
|
|
|
|
|
|
|
|
check-po:
|
2006-01-14 05:24:32 -05:00
|
|
|
@-$(foreach lang,$(basename $(if $(strip $(PO)),$(PO),$(GMOFILES))), \
|
2005-10-18 06:14:38 -04:00
|
|
|
echo -n "$(lang): "; \
|
2006-01-01 11:34:12 -05:00
|
|
|
$(GMSGFMT) --check --check-accelerators="~" --verbose --statistics -o /dev/null $(srcdir)$(lang).po; \
|
2007-07-17 07:32:07 -04:00
|
|
|
$(PERL) -I"$(srcdir)perl" $(srcdir)perl/msgaccel-check $(srcdir)$(lang).po; \
|
2005-10-18 05:52:29 -04:00
|
|
|
)
|
2005-09-15 09:58:31 -04:00
|
|
|
|
2005-09-15 19:07:31 -04:00
|
|
|
### Installation and distribution
|
2005-09-15 09:58:31 -04:00
|
|
|
#
|
2005-09-27 15:11:28 -04:00
|
|
|
# Use *-local targets to place and remove .gmo files.
|
2005-09-15 09:58:31 -04:00
|
|
|
|
2005-10-30 02:07:03 -05:00
|
|
|
install-local: all-local
|
2005-09-23 03:08:47 -04:00
|
|
|
$(MKINSTALLDIRS) $(DESTDIR)$(localedir)
|
2005-10-18 06:16:12 -04:00
|
|
|
@$(foreach lang,$(basename $(if $(strip $(PO)),$(PO),$(CATALOGS))), \
|
2005-10-18 06:14:38 -04:00
|
|
|
$(MKINSTALLDIRS) $(DESTDIR)$(localedir)/$(lang)/LC_MESSAGES; \
|
|
|
|
$(call ncmd,installdata,$(lang).gmo,$(DESTDIR)$(localedir)/$(lang)/LC_MESSAGES/$(PACKAGE).mo); \
|
2005-10-18 05:18:05 -04:00
|
|
|
)
|
2005-09-15 09:58:31 -04:00
|
|
|
|
2006-09-03 03:27:21 -04:00
|
|
|
uninstall-local:
|
|
|
|
@$(foreach lang,$(basename $(if $(strip $(PO)),$(PO),$(CATALOGS))), \
|
|
|
|
$(call ncmd,uninstall,$(PACKAGE).mo,$(DESTDIR)$(localedir)/$(lang)/LC_MESSAGES); \
|
|
|
|
)
|
|
|
|
|
2005-10-02 14:32:31 -04:00
|
|
|
clean-local:
|
2006-01-01 11:34:12 -05:00
|
|
|
@rm -f $(PACKAGE).po *.new.po $(srcdir)$(POTFILES_ABS_LIST)
|
2005-09-15 19:07:31 -04:00
|
|
|
|
2005-10-19 19:11:47 -04:00
|
|
|
include $(top_srcdir)/Makefile.lib
|