Revert 11e6aa8d97fe, "Bug 944, SMB: Fix leaks and libsmbclient 3.0.10 compatibility."
[elinks.git] / po / Makefile
blob77d62fccd25aa546f916cb703628b2382c135e2d
1 top_builddir=..
2 include $(top_builddir)/Makefile.config
4 # Where to install the catalog files.
5 localedir = $(datadir)/locale
7 # These are for some reason not added magically to the Makefile.
8 MSGMERGE = msgmerge
9 PERL = perl
11 # Name of the file containing the list of files to translate (used by
12 # xgettext)
13 POTFILES_ABS_LIST = potfiles.list
15 POTFILES_REL = $(shell find $(top_srcdir)/src/ -name '*.[ch]' -o -name options.inc -o -name 'actions-*.inc' | sort)
17 quiet_cmd_gmsgfmt = ' [$(PO_COLOR)GMSGFMT$(END_COLOR)] $(RELPATH)$(@)'
18 cmd_gmsgfmt = rm -f -- "$@" && $(GMSGFMT) --statistics -o "$@" -- "$<"
21 # Distributed elinks-*.tar.gz packages include po/*.gmo files, so that
22 # users can install ELinks even if they don't have a msgfmt program.
23 # However, if srcdir != builddir, then this Makefile ignores the *.gmo
24 # files in the srcdir and builds new ones in the builddir.
25 %.gmo: $(srcdir)%.po
26 $(call ecmd,gmsgfmt)
29 ### The default rule
31 # Note: Target `all-local' must not depend on target '$(srcdir)$(PACKAGE).pot',
32 # otherwise packages like GCC can not be built if only parts of the source have
33 # been downloaded.
35 # Note 2: We aren't gcc, we are ELinks. And I want that dependency ;-). --pasky
37 # Note 3: I changed my mind, it is really annoying if you just insert one line
38 # and suddenly you have tons of changes in all the .po files updating the line
39 # informations. --pasky
41 # $(CATALOGS) is empty if --disable-nls. Beats using *-(yes|no) targets.
43 all-local: $(CATALOGS)
46 ### Creating the template po template file
48 # This pulls in _all_ .c and .h files in the src directory. Even files that has
49 # not been added to the git repo. Beware of junk entries!
51 $(srcdir)$(POTFILES_ABS_LIST): $(POTFILES_REL)
52 @( cd $(top_srcdir); \
53 find src/ -type f -name '*.[ch]' -o -name options.inc -o -name 'actions-*.inc' | sort ) \
54 > $(srcdir)$(POTFILES_ABS_LIST)
56 $(srcdir)$(PACKAGE).pot: $(srcdir)$(POTFILES_ABS_LIST) $(srcdir)perl/gather-accelerator-contexts.pl
57 $(XGETTEXT) --default-domain=$(PACKAGE) \
58 --directory=$(top_srcdir) \
59 --add-comments --language=C \
60 --keyword=_ --keyword=N_ --keyword=n_:1,2 --keyword=N__ -f $(srcdir)$(POTFILES_ABS_LIST) \
61 && test -f $(PACKAGE).po \
62 && $(PERL) -I"$(srcdir)perl" $(srcdir)perl/gather-accelerator-contexts.pl -S"$(top_srcdir)" $(PACKAGE).po \
63 && mv -f $(PACKAGE).po $(srcdir)$(PACKAGE).pot
66 ### Updating po and gmo files
68 # Update by merging all .po files with the .po template master file.
70 # It is possible to update only a single .po file by setting the PO variable to
71 # either <lang> or <lang>.po when calling make. Example: make update-po PO=is
73 update-po: Makefile $(srcdir)$(PACKAGE).pot
74 @$(foreach lang,$(basename $(if $(strip $(PO)),$(PO),$(GMOFILES))), \
75 echo -n "$(lang): "; \
76 if $(MSGMERGE) $(srcdir)$(lang).po $(srcdir)$(PACKAGE).pot -o $(lang).new.po; then \
77 mv -f $(lang).new.po $(srcdir)$(lang).po; \
78 else \
79 echo "msgmerge failed!"; \
80 rm -f $(lang).new.po; \
81 fi; \
83 $(MAKE) update-gmo
85 update-gmo: Makefile $(GMOFILES)
89 ### Check single or all po files
92 check-po:
93 @-$(foreach lang,$(basename $(if $(strip $(PO)),$(PO),$(GMOFILES))), \
94 echo -n "$(lang): "; \
95 $(GMSGFMT) --check --check-accelerators="~" --verbose --statistics -o /dev/null $(srcdir)$(lang).po; \
96 $(PERL) -I"$(srcdir)perl" $(srcdir)perl/check-accelerator-conflicts.pl $(srcdir)$(lang).po; \
99 ### Installation and distribution
101 # Use *-local targets to place and remove .gmo files.
103 install-local: all-local
104 $(MKINSTALLDIRS) $(DESTDIR)$(localedir)
105 @$(foreach lang,$(basename $(if $(strip $(PO)),$(PO),$(CATALOGS))), \
106 $(MKINSTALLDIRS) $(DESTDIR)$(localedir)/$(lang)/LC_MESSAGES; \
107 $(call ncmd,installdata,$(lang).gmo,$(DESTDIR)$(localedir)/$(lang)/LC_MESSAGES/$(PACKAGE).mo); \
110 uninstall-local:
111 @$(foreach lang,$(basename $(if $(strip $(PO)),$(PO),$(CATALOGS))), \
112 $(call ncmd,uninstall,$(PACKAGE).mo,$(DESTDIR)$(localedir)/$(lang)/LC_MESSAGES); \
115 clean-local:
116 @rm -f $(PACKAGE).po *.new.po $(srcdir)$(POTFILES_ABS_LIST)
118 include $(top_srcdir)/Makefile.lib