ld message translation for emultempl and emulparams

Message ID 20180226001819.GR3812@bubble.grove.modra.org
State New
Headers show
Series
  • ld message translation for emultempl and emulparams
Related show

Commit Message

Alan Modra Feb. 26, 2018, 12:18 a.m.
Most of the emultempl/*.em error/warning messages do not currently
appear in ld.pot, and fixing that is not simply a matter of adding
missing files to POTFILES.  The difficulty is the shell-script
quoting, for example aarch64elf.em:PARSE_AND_LIST_OPTIONS "Don'\''t".
I suppose you could avoid contractions like "don't" but I'm unsure as
to whether gettext could handle everything in the emulparams scripts.

The right thing to do is feed the generated C files to gettext, as
this patch does.  The patch just copies what is already done in bfd/
for generated files.

	* Makefile.am (EMULATION_FILES, POTFILES): Delete.
	(SRC_POTFILES, BLD_POTFILES): Define.
	(po/POTFILES.in): Delete rule.
	(po/SRC-POTFILES.in, po/BLD-POTFILES.in): New rules.
	* configure.ac: Add AC_CONFIG_COMMANDS to create po/Makefile.
	* po/Make-in (DISTFILES): Remove POTFILES.in, add SRC-POTFILES.in
	and BLD-POTFILES.in.
	(POTFILES): Delete.
	(SRC-POTFILES, BLD-POTFILES): Define place marker.
	(ld.pot): Build from SRC-POTFILES plus BLD-POTFILES.
	(distclean, maintainer-clean): Tidy up new files.
	(POTFILES, POTFILES.in): Delete rules.
	(SRC-POTFILES, BLD-POTFILES, SRC-POTFILES.in, BLD-POTFILES.in):
	New rules.
	(Makefile): Depend on SRC-POTFILES and BLD-POTFILES.
	* po/SRC-POTFILES.in: Rename from po/POTFILES.in.
	* po/BLD-POTFILES.in: New file.
	* Makefile.in: Regenerate.
	* configure: Regenerate.


-- 
Alan Modra
Australia Development Lab, IBM

Patch

diff --git a/ld/Makefile.am b/ld/Makefile.am
index 6243c12..d94fce7 100644
--- a/ld/Makefile.am
+++ b/ld/Makefile.am
@@ -590,15 +590,16 @@  endif
 	$(COMPILE) -c `test -f deffilep.c || echo $(srcdir)/`deffilep.c $(NO_WERROR)
 endif
 
-# At the moment this is just a list of those emulation template files
-# that contain internationalised strings.
-EMULATION_FILES = emultempl/pe.em emultempl/armcoff.em
+SRC_POTFILES = $(CFILES) $(HFILES)
+BLD_POTFILES = $(ALL_EMULATION_SOURCES) $(ALL_64_EMULATION_SOURCES)
 
-POTFILES = $(CFILES) $(HFILES) $(EMULATION_FILES)
+po/SRC-POTFILES.in: @MAINT@ Makefile
+	for f in $(SRC_POTFILES); do echo $$f; done | LC_ALL=C sort > $@-tmp \
+	  && mv $@-tmp $(srcdir)/po/SRC-POTFILES.in
 
-po/POTFILES.in: @MAINT@ Makefile
-	for f in $(POTFILES); do echo $$f; done | LC_ALL=C sort > tmp \
-	  && mv tmp $(srcdir)/po/POTFILES.in
+po/BLD-POTFILES.in: @MAINT@ Makefile $(BLD_POTFILES)
+	for f in $(BLD_POTFILES); do echo $$f; done | LC_ALL=C sort > $@-tmp \
+	  && mv $@-tmp $(srcdir)/po/BLD-POTFILES.in
 
 ldmain.@OBJEXT@: ldmain.c config.status
 if am__fastdepCC
diff --git a/ld/configure.ac b/ld/configure.ac
index bada1b5..6da8c8e 100644
--- a/ld/configure.ac
+++ b/ld/configure.ac
@@ -491,6 +491,26 @@  if test x${EXTRA_SHLIB_EXTENSION} != x ; then
    [Additional extension a shared object might have.])
 fi
 
+AC_CONFIG_COMMANDS([default],
+[[
+case "$srcdir" in
+  .) srcdirpre= ;;
+  *) srcdirpre='$(srcdir)/' ;;
+esac
+POFILES=
+GMOFILES=
+for lang in dummy $OBSOLETE_ALL_LINGUAS; do
+  if test $lang != dummy; then
+    POFILES="$POFILES $srcdirpre$lang.po"
+    GMOFILES="$GMOFILES $srcdirpre$lang.gmo"
+  fi
+done
+sed -e '/^SRC-POTFILES =/r po/SRC-POTFILES' \
+    -e '/^BLD-POTFILES =/r po/BLD-POTFILES' \
+    -e "s,@POFILES@,$POFILES," \
+    -e "s,@GMOFILES@,$GMOFILES," \
+    po/Makefile.in > po/Makefile]],[[]])
+
 dnl Required by html, pdf, install-pdf and install-html
 AC_SUBST(datarootdir)
 AC_SUBST(docdir)
diff --git a/ld/po/BLD-POTFILES.in b/ld/po/BLD-POTFILES.in
new file mode 100644
index 0000000..dc16636
--- /dev/null
+++ b/ld/po/BLD-POTFILES.in
@@ -0,0 +1,362 @@ 
+eaarch64cloudabi.c
+eaarch64cloudabib.c
+eaarch64elf.c
+eaarch64elf32.c
+eaarch64elf32b.c
+eaarch64elfb.c
+eaarch64fbsd.c
+eaarch64fbsdb.c
+eaarch64linux.c
+eaarch64linux32.c
+eaarch64linux32b.c
+eaarch64linuxb.c
+eaix5ppc.c
+eaix5rs6.c
+eaixppc.c
+eaixrs6.c
+ealpha.c
+ealphavms.c
+earcelf.c
+earcelf_prof.c
+earclinux.c
+earclinux_nps.c
+earclinux_prof.c
+earcv2elf.c
+earcv2elfx.c
+earm_epoc_pe.c
+earm_wince_pe.c
+earmaoutb.c
+earmaoutl.c
+earmcoff.c
+earmelf.c
+earmelf_fbsd.c
+earmelf_fuchsia.c
+earmelf_linux.c
+earmelf_linux_eabi.c
+earmelf_nacl.c
+earmelf_nbsd.c
+earmelf_phoenix.c
+earmelf_vxworks.c
+earmelfb.c
+earmelfb_fbsd.c
+earmelfb_fuchsia.c
+earmelfb_linux.c
+earmelfb_linux_eabi.c
+earmelfb_nacl.c
+earmelfb_nbsd.c
+earmnbsd.c
+earmnto.c
+earmpe.c
+earmsymbian.c
+eavr1.c
+eavr2.c
+eavr25.c
+eavr3.c
+eavr31.c
+eavr35.c
+eavr4.c
+eavr5.c
+eavr51.c
+eavr6.c
+eavrtiny.c
+eavrxmega1.c
+eavrxmega2.c
+eavrxmega3.c
+eavrxmega4.c
+eavrxmega5.c
+eavrxmega6.c
+eavrxmega7.c
+ecoff_i860.c
+ecoff_sparc.c
+ecrisaout.c
+ecriself.c
+ecrislinux.c
+ed10velf.c
+ed30v_e.c
+ed30v_o.c
+ed30velf.c
+edelta68.c
+eelf32_dlx.c
+eelf32_i860.c
+eelf32_i960.c
+eelf32_sparc.c
+eelf32_sparc_sol2.c
+eelf32_sparc_vxworks.c
+eelf32_spu.c
+eelf32_tic6x_be.c
+eelf32_tic6x_elf_be.c
+eelf32_tic6x_elf_le.c
+eelf32_tic6x_le.c
+eelf32_tic6x_linux_be.c
+eelf32_tic6x_linux_le.c
+eelf32_x86_64.c
+eelf32_x86_64_nacl.c
+eelf32am33lin.c
+eelf32b4300.c
+eelf32bfin.c
+eelf32bfinfd.c
+eelf32bmip.c
+eelf32bmipn32.c
+eelf32bsmip.c
+eelf32btsmip.c
+eelf32btsmip_fbsd.c
+eelf32btsmipn32.c
+eelf32btsmipn32_fbsd.c
+eelf32cr16.c
+eelf32cr16c.c
+eelf32crx.c
+eelf32ebmip.c
+eelf32ebmipvxworks.c
+eelf32elmip.c
+eelf32elmipvxworks.c
+eelf32epiphany.c
+eelf32epiphany_4x4.c
+eelf32fr30.c
+eelf32frv.c
+eelf32frvfd.c
+eelf32ft32.c
+eelf32i370.c
+eelf32ip2k.c
+eelf32iq10.c
+eelf32iq2000.c
+eelf32l4300.c
+eelf32lm32.c
+eelf32lm32fd.c
+eelf32lmip.c
+eelf32lppc.c
+eelf32lppc_fbsd.c
+eelf32lppclinux.c
+eelf32lppcnto.c
+eelf32lppcsim.c
+eelf32lr5900.c
+eelf32lr5900n32.c
+eelf32lriscv.c
+eelf32lsmip.c
+eelf32ltsmip.c
+eelf32ltsmip_fbsd.c
+eelf32ltsmipn32.c
+eelf32ltsmipn32_fbsd.c
+eelf32m32c.c
+eelf32mb_linux.c
+eelf32mbel_linux.c
+eelf32mcore.c
+eelf32mep.c
+eelf32metag.c
+eelf32microblaze.c
+eelf32microblazeel.c
+eelf32mipswindiss.c
+eelf32moxie.c
+eelf32mt.c
+eelf32or1k.c
+eelf32or1k_linux.c
+eelf32ppc.c
+eelf32ppc_fbsd.c
+eelf32ppclinux.c
+eelf32ppcnto.c
+eelf32ppcsim.c
+eelf32ppcvxworks.c
+eelf32ppcwindiss.c
+eelf32rl78.c
+eelf32rx.c
+eelf32tilegx.c
+eelf32tilegx_be.c
+eelf32tilepro.c
+eelf32vax.c
+eelf32visium.c
+eelf32xc16x.c
+eelf32xc16xl.c
+eelf32xc16xs.c
+eelf32xstormy16.c
+eelf32xtensa.c
+eelf64_aix.c
+eelf64_ia64.c
+eelf64_ia64_fbsd.c
+eelf64_ia64_vms.c
+eelf64_s390.c
+eelf64_sparc.c
+eelf64_sparc_fbsd.c
+eelf64_sparc_sol2.c
+eelf64alpha.c
+eelf64alpha_fbsd.c
+eelf64alpha_nbsd.c
+eelf64bmip.c
+eelf64btsmip.c
+eelf64btsmip_fbsd.c
+eelf64hppa.c
+eelf64lppc.c
+eelf64lppc_fbsd.c
+eelf64lriscv.c
+eelf64ltsmip.c
+eelf64ltsmip_fbsd.c
+eelf64mmix.c
+eelf64ppc.c
+eelf64ppc_fbsd.c
+eelf64rdos.c
+eelf64tilegx.c
+eelf64tilegx_be.c
+eelf_i386.c
+eelf_i386_be.c
+eelf_i386_chaos.c
+eelf_i386_fbsd.c
+eelf_i386_ldso.c
+eelf_i386_nacl.c
+eelf_i386_sol2.c
+eelf_i386_vxworks.c
+eelf_iamcu.c
+eelf_k1om.c
+eelf_k1om_fbsd.c
+eelf_l1om.c
+eelf_l1om_fbsd.c
+eelf_s390.c
+eelf_x86_64.c
+eelf_x86_64_cloudabi.c
+eelf_x86_64_fbsd.c
+eelf_x86_64_nacl.c
+eelf_x86_64_sol2.c
+egld960.c
+egld960coff.c
+eh8300.c
+eh8300elf.c
+eh8300elf_linux.c
+eh8300h.c
+eh8300helf.c
+eh8300helf_linux.c
+eh8300hn.c
+eh8300hnelf.c
+eh8300s.c
+eh8300self.c
+eh8300self_linux.c
+eh8300sn.c
+eh8300snelf.c
+eh8300sx.c
+eh8300sxelf.c
+eh8300sxelf_linux.c
+eh8300sxn.c
+eh8300sxnelf.c
+eh8500.c
+eh8500b.c
+eh8500c.c
+eh8500m.c
+eh8500s.c
+ehp300bsd.c
+ehp3hpux.c
+ehppa64linux.c
+ehppaelf.c
+ehppalinux.c
+ehppanbsd.c
+ehppaobsd.c
+ei386aout.c
+ei386beos.c
+ei386bsd.c
+ei386coff.c
+ei386go32.c
+ei386linux.c
+ei386lynx.c
+ei386mach.c
+ei386moss.c
+ei386msdos.c
+ei386nbsd.c
+ei386nto.c
+ei386nw.c
+ei386pe.c
+ei386pe_posix.c
+ei386pep.c
+elnk960.c
+em32relf.c
+em32relf_linux.c
+em32rlelf.c
+em32rlelf_linux.c
+em68hc11elf.c
+em68hc11elfb.c
+em68hc12elf.c
+em68hc12elfb.c
+em68k4knbsd.c
+em68kaout.c
+em68kaux.c
+em68kcoff.c
+em68kelf.c
+em68kelfnbsd.c
+em68klinux.c
+em68knbsd.c
+em68kpsos.c
+em88kbcs.c
+emcorepe.c
+emmo.c
+emn10200.c
+emn10300.c
+emoxiebox.c
+emsp430X.c
+emsp430elf.c
+ends32belf.c
+ends32belf16m.c
+ends32belf_linux.c
+ends32elf.c
+ends32elf16m.c
+ends32elf_linux.c
+enews.c
+enios2elf.c
+enios2linux.c
+ens32knbsd.c
+epc532macha.c
+epdp11.c
+epjelf.c
+epjlelf.c
+eppclynx.c
+eppcmacos.c
+eppcnw.c
+eppcpe.c
+epruelf.c
+eriscix.c
+escore3_elf.c
+escore7_elf.c
+esh.c
+eshelf.c
+eshelf32.c
+eshelf32_linux.c
+eshelf32_nbsd.c
+eshelf64.c
+eshelf64_nbsd.c
+eshelf_fd.c
+eshelf_linux.c
+eshelf_nbsd.c
+eshelf_nto.c
+eshelf_uclinux.c
+eshelf_vxworks.c
+eshl.c
+eshlelf.c
+eshlelf32.c
+eshlelf32_linux.c
+eshlelf32_nbsd.c
+eshlelf64.c
+eshlelf64_nbsd.c
+eshlelf_fd.c
+eshlelf_linux.c
+eshlelf_nbsd.c
+eshlelf_nto.c
+eshlelf_vxworks.c
+eshlsymbian.c
+eshpe.c
+esparcaout.c
+esparclinux.c
+esparcnbsd.c
+est2000.c
+esun3.c
+esun4.c
+etic30aout.c
+etic30coff.c
+etic3xcoff.c
+etic3xcoff_onchip.c
+etic4xcoff.c
+etic54xcoff.c
+etic80coff.c
+ev850.c
+ev850_rh850.c
+evanilla.c
+evax.c
+evaxnbsd.c
+evsta.c
+ew65.c
+exgateelf.c
+ez80.c
+ez8001.c
+ez8002.c
diff --git a/ld/po/Make-in b/ld/po/Make-in
index 7e38f5d..3f7064f 100644
--- a/ld/po/Make-in
+++ b/ld/po/Make-in
@@ -50,10 +50,12 @@  COMPILE = $(CC) -c $(DEFS) $(INCLUDES) $(CPPFLAGS) $(CFLAGS) $(XCFLAGS)
 SOURCES = cat-id-tbl.c
 POFILES = @POFILES@
 GMOFILES = @GMOFILES@
-DISTFILES = ChangeLog Makefile.in.in POTFILES.in $(PACKAGE).pot \
+DISTFILES = ChangeLog Makefile.in.in SRC-POTFILES.in BLD-POTFILES.in $(PACKAGE).pot \
 stamp-cat-id $(POFILES) $(GMOFILES) $(SOURCES)
 
-POTFILES = \
+SRC-POTFILES = \
+
+BLD-POTFILES = \
 
 CATALOGS = @CATALOGS@
 CATOBJEXT = @CATOBJEXT@
@@ -86,11 +88,16 @@  all: all-@USE_NLS@
 all-yes: $(CATALOGS) @MAINT@ $(PACKAGE).pot
 all-no:
 
-$(srcdir)/$(PACKAGE).pot: $(POTFILES)
+$(srcdir)/$(PACKAGE).pot: $(SRC-POTFILES) $(BLD-POTFILES)
 	$(XGETTEXT) --default-domain=$(PACKAGE) --directory=$(top_srcdir) \
-	  --add-comments -C --keyword=_ --keyword=N_ \
+	  --add-comments --keyword=_ --keyword=N_ \
+	  --msgid-bugs-address=bug-binutils@gnu.org \
+	  --files-from=$(srcdir)/SRC-POTFILES.in
+	$(XGETTEXT) --default-domain=$(PACKAGE) --directory=.. \
+	  --add-comments --keyword=_ --keyword=N_ \
+	  --join-existing \
 	  --msgid-bugs-address=bug-binutils@gnu.org \
-	  --files-from=$(srcdir)/POTFILES.in
+	  --files-from=$(srcdir)/BLD-POTFILES.in
 	rm -f $(srcdir)/$(PACKAGE).pot
 	mv $(PACKAGE).po $(srcdir)/$(PACKAGE).pot
 
@@ -198,12 +205,13 @@  mostlyclean:
 clean: mostlyclean
 
 distclean: clean
-	rm -f Makefile Makefile.in POTFILES *.mo *.msg *.cat *.cat.m
+	rm -f Makefile Makefile.in *.mo *.msg *.cat *.cat.m
+	rm -f SRC-POTFILES BLD-POTFILES
 
 maintainer-clean: distclean
 	@echo "This command is intended for maintainers to use;"
 	@echo "it deletes files that may require special tools to rebuild."
-	rm -f $(GMOFILES)
+	rm -f $(GMOFILES) SRC-POTFILES.in BLD-POTFILES.in
 
 distdir = ../$(PACKAGE)-$(VERSION)/$(subdir)
 dist distdir: update-po $(DISTFILES)
@@ -232,7 +240,7 @@  update-po: Makefile
 	  fi; \
 	done
 
-POTFILES: POTFILES.in
+SRC-POTFILES: SRC-POTFILES.in
 	( if test 'x$(srcdir)' != 'x.'; then \
 	    posrcprefix='$(top_srcdir)/'; \
 	  else \
@@ -245,10 +253,21 @@  POTFILES: POTFILES.in
 	    && chmod a-w $@-t \
 	    && mv $@-t $@ )
 
-POTFILES.in: @MAINT@ ../Makefile
-	cd .. && $(MAKE) po/POTFILES.in
+BLD-POTFILES: BLD-POTFILES.in
+	  rm -f $@-t $@ \
+	  && sed -e '/^#/d' -e '/^[	 ]*$$/d' \
+		 -e "s@.*@	../& \\\\@" < $(srcdir)/$@.in \
+	     | sed -e '$$s/\\$$//' > $@-t \
+	  && chmod a-w $@-t \
+	  && mv $@-t $@
+
+SRC-POTFILES.in: @MAINT@ ../Makefile
+	cd .. && $(MAKE) po/SRC-POTFILES.in
+
+BLD-POTFILES.in: @MAINT@ ../Makefile
+	cd .. && $(MAKE) po/BLD-POTFILES.in
 
-Makefile: Make-in ../config.status POTFILES
+Makefile: Make-in ../config.status SRC-POTFILES BLD-POTFILES
 	cd .. \
 	  && CONFIG_FILES=$(subdir)/Makefile.in:$(subdir)/Make-in \
 	     CONFIG_HEADERS= $(SHELL) ./config.status
diff --git a/ld/po/POTFILES.in b/ld/po/POTFILES.in
deleted file mode 100644
index fcc2894..0000000
--- a/ld/po/POTFILES.in
+++ /dev/null
@@ -1,37 +0,0 @@ 
-deffile.h
-elf-hints-local.h
-emultempl/armcoff.em
-emultempl/pe.em
-ld.h
-ldbuildid.c
-ldbuildid.h
-ldcref.c
-ldctor.c
-ldctor.h
-ldemul.c
-ldemul.h
-ldexp.c
-ldexp.h
-ldfile.c
-ldfile.h
-ldlang.c
-ldlang.h
-ldlex-wrapper.c
-ldlex.h
-ldmain.c
-ldmain.h
-ldmisc.c
-ldmisc.h
-ldver.c
-ldver.h
-ldwrite.c
-ldwrite.h
-lexsup.c
-mri.c
-mri.h
-pe-dll.c
-pe-dll.h
-pep-dll.c
-pep-dll.h
-plugin.c
-plugin.h
diff --git a/ld/po/SRC-POTFILES.in b/ld/po/SRC-POTFILES.in
new file mode 100644
index 0000000..1628826
--- /dev/null
+++ b/ld/po/SRC-POTFILES.in
@@ -0,0 +1,35 @@ 
+deffile.h
+elf-hints-local.h
+ld.h
+ldbuildid.c
+ldbuildid.h
+ldcref.c
+ldctor.c
+ldctor.h
+ldemul.c
+ldemul.h
+ldexp.c
+ldexp.h
+ldfile.c
+ldfile.h
+ldlang.c
+ldlang.h
+ldlex-wrapper.c
+ldlex.h
+ldmain.c
+ldmain.h
+ldmisc.c
+ldmisc.h
+ldver.c
+ldver.h
+ldwrite.c
+ldwrite.h
+lexsup.c
+mri.c
+mri.h
+pe-dll.c
+pe-dll.h
+pep-dll.c
+pep-dll.h
+plugin.c
+plugin.h