2 include $(top_builddir
)/Makefile.config
4 # We prefer the capitalized name for Project-Id-Version.
5 ifeq ($(PACKAGE
), elinks
)
6 PRETTY_PACKAGE
= ELinks
8 PRETTY_PACKAGE
= $(PACKAGE
)
11 # Where to install the catalog files.
12 localedir
= $(datadir)/locale
14 # These are for some reason not added magically to the Makefile.
18 # Name of the file containing the list of files to translate (used by
20 POTFILES_ABS_LIST
= potfiles.list
22 POTFILES_REL
= $(shell find
$(top_srcdir
)/src
/ -name
'*.[ch]' -o
-name options.inc
-o
-name
'actions-*.inc' |
sort)
24 quiet_cmd_gmsgfmt
= ' [$(PO_COLOR)GMSGFMT$(END_COLOR)] $(RELPATH)$(@)'
25 cmd_gmsgfmt
= rm -f
-- "$@" && $(GMSGFMT
) --statistics
-o
"$@" -- "$<"
28 # Distributed elinks-*.tar.gz packages include po/*.gmo files, so that
29 # users can install ELinks even if they don't have a msgfmt program.
30 # However, if srcdir != builddir, then this Makefile ignores the *.gmo
31 # files in the srcdir and builds new ones in the builddir.
38 # Note: Target `all-local' must not depend on target '$(srcdir)$(PACKAGE).pot',
39 # otherwise packages like GCC can not be built if only parts of the source have
42 # Note 2: We aren't gcc, we are ELinks. And I want that dependency ;-). --pasky
44 # Note 3: I changed my mind, it is really annoying if you just insert one line
45 # and suddenly you have tons of changes in all the .po files updating the line
46 # informations. --pasky
48 # $(CATALOGS) is empty if --disable-nls. Beats using *-(yes|no) targets.
50 all-local
: $(CATALOGS
)
53 ### Creating the template po template file
55 # This pulls in _all_ .c and .h files in the src directory. Even files that has
56 # not been added to the git repo. Beware of junk entries!
58 $(POTFILES_ABS_LIST
): $(POTFILES_REL
)
59 @
( cd
$(top_srcdir
); \
60 find src
/ -type f
-name
'*.[ch]' -o
-name options.inc
-o
-name
'actions-*.inc' |
sort ) \
61 > $(POTFILES_ABS_LIST
)
63 # xgettext --flag requires GNU gettext 0.13 or later;
64 # --msgid-bugs-address requires 0.12 or later.
65 $(srcdir)$(PACKAGE
).pot
: $(POTFILES_ABS_LIST
) $(srcdir)perl
/msgaccel-prepare
66 $(XGETTEXT
) --default-domain
=$(PACKAGE
) \
67 --directory
=$(top_srcdir
) \
68 --msgid-bugs-address
=elinks-users@linuxfromscratch.org \
69 --add-comments
--language
=C \
70 --keyword
=_
--keyword
=N_
--keyword
=n_
:1,2 --keyword
=N__ \
71 --flag
=msg_text
:2:c-format
--flag
=die
:1:c-format \
72 --flag
=secure_fprintf
:2:c-format \
73 --flag
=DBG
:1:c-format
--flag
=elinks_debug
:1:c-format \
74 --flag
=WDBG
:1:c-format
--flag
=elinks_wdebug
:1:c-format \
75 --flag
=ERROR
:1:c-format
--flag
=elinks_error
:1:c-format \
76 --flag
=INTERNAL
:1:c-format
--flag
=elinks_internal
:1:c-format \
77 --flag
=usrerror
:1:c-format
--flag
=elinks_log
:4:c-format \
78 --flag
=LOG_ERR
:1:c-format
--flag
=LOG_WARN
:1:c-format \
79 --flag
=LOG_INFO
:1:c-format
--flag
=LOG_DBG
:1:c-format \
80 --flag
=assertm
:2:c-format
--flag
=elinks_assertm
:2:c-format \
81 --flag
=add_format_to_string
:2:c-format \
82 --flag
=elinks_vsnprintf
:3:c-format
--flag
=elinks_snprintf
:3:c-format \
83 --flag
=elinks_vasprintf
:2:c-format
--flag
=elinks_asprintf
:2:c-format \
84 --flag
=vasprintfa
:1:c-format
--flag
=asprintfa
:1:c-format \
85 --flag
=_
:1:pass-c-format
--flag
=N_
:1:pass-c-format \
86 --flag
=n_
:1:pass-c-format
--flag
=n_
:2:pass-c-format \
87 --flag
=N__
:1:pass-c-format \
88 -f
$(POTFILES_ABS_LIST
)
90 $(PERL
) -I
"$(srcdir)perl" $(srcdir)perl
/msgaccel-prepare
-S
"$(top_srcdir)" $(PACKAGE
).po
91 # GNU gettext 0.17 supports xgettext --package-version but is GPLv3+.
92 # This rule already requires Perl so use that instead.
93 $(PERL
) -pi
-e
's/(^"Project-Id-Version: )PACKAGE VERSION/$$1$(PRETTY_PACKAGE) $(VERSION)/i and $$found=1 unless $$found' $(PACKAGE
).po
94 mv
-f
$(PACKAGE
).po
$(srcdir)$(PACKAGE
).pot
97 ### Updating po and gmo files
99 # Update by merging all .po files with the .po template master file.
101 # It is possible to update only a single .po file by setting the PO variable to
102 # either <lang> or <lang>.po when calling make. Example: make update-po PO=is
104 update-po
: Makefile
$(srcdir)$(PACKAGE
).pot
105 @
$(foreach lang
,$(basename $(if
$(strip $(PO
)),$(PO
),$(GMOFILES
))), \
106 echo
-n
"$(lang): "; \
107 if
$(MSGMERGE
) $(srcdir)$(lang
).po
$(srcdir)$(PACKAGE
).pot
-o
$(lang
).new.po
; then \
108 mv
-f
$(lang
).new.po
$(srcdir)$(lang
).po
; \
110 echo
"msgmerge failed!"; \
111 rm -f
$(lang
).new.po
; \
116 update-gmo
: Makefile
$(GMOFILES
)
120 ### Check single or all po files
124 @
-$(foreach lang
,$(basename $(if
$(strip $(PO
)),$(PO
),$(GMOFILES
))), \
125 echo
-n
"$(lang): "; \
126 $(GMSGFMT
) --check --check-accelerators
="~" --verbose
--statistics
-o
/dev
/null
$(srcdir)$(lang
).po
; \
127 $(PERL
) -I
"$(srcdir)perl" $(srcdir)perl
/msgaccel-check
$(srcdir)$(lang
).po
; \
130 ### Installation and distribution
132 # Use *-local targets to place and remove .gmo files.
134 install-local
: all-local
135 $(MKINSTALLDIRS
) $(DESTDIR
)$(localedir
)
136 @
$(foreach lang
,$(basename $(if
$(strip $(PO
)),$(PO
),$(CATALOGS
))), \
137 $(MKINSTALLDIRS
) $(DESTDIR
)$(localedir
)/$(lang
)/LC_MESSAGES
; \
138 $(call ncmd
,installdata
,$(lang
).gmo
,$(DESTDIR
)$(localedir
)/$(lang
)/LC_MESSAGES
/$(PACKAGE
).mo
); \
142 @
$(foreach lang
,$(basename $(if
$(strip $(PO
)),$(PO
),$(CATALOGS
))), \
143 $(call ncmd
,uninstall,$(PACKAGE
).mo
,$(DESTDIR
)$(localedir
)/$(lang
)/LC_MESSAGES
); \
147 @
rm -f
$(PACKAGE
).po
*.new.po
$(POTFILES_ABS_LIST
)
149 include $(top_srcdir
)/Makefile.lib