From: Bruno Haible Date: Wed, 17 Oct 2018 12:55:58 +0000 (+0200) Subject: examples: Fix 'make' failures in VPATH builds. X-Git-Tag: v0.20~342 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=36b6d1cd8afade3dd5fc3695dfe4636c7863fae5;p=thirdparty%2Fgettext.git examples: Fix 'make' failures in VPATH builds. * gettext-tools/examples/hello-java*/Makefile.am (hello_RESOURCES, MAINTAINERCLEANFILES): Remove variables. (hello.jar): Use two jar commands, to combine .class files from the build dir with .properties files from the source dir. * gettext-tools/examples/hello-java*/po/Makefile.am (update-properties, update-classes): Reference the .pot file in the source dir, not in the build dir. (echo-catalogs): Include the fallback catalog. * gettext-tools/examples/hello-pascal/Makefile.am (hello_SOURCES): Add $(srcdir) prefix. (hello$(EXEEXT)): Use -o option to specify where the object file and the executable file shall be created. --- diff --git a/gettext-tools/examples/hello-java-awt/Makefile.am b/gettext-tools/examples/hello-java-awt/Makefile.am index 2281fbde3..2b9c71d1b 100644 --- a/gettext-tools/examples/hello-java-awt/Makefile.am +++ b/gettext-tools/examples/hello-java-awt/Makefile.am @@ -23,13 +23,6 @@ hello_MAINCLASS = Hello # The link dependencies of the 'hello' program. hello_JAVALIBS = @LIBINTL_JAR@ -# The resources of the 'hello' program, excluding message catalogs, but -# including the fallback message catalog. -hello_RESOURCES = hello-java-awt.properties - -# Resources that are generated from PO files. -MAINTAINERCLEANFILES = hello-java-awt*.properties - # Additional files to be distributed. EXTRA_DIST = autogen.sh autoclean.sh @@ -56,9 +49,9 @@ all-local: hello.jar hello.sh hello.jar: $(hello_CLASSES) { echo "Manifest-Version: 1.0"; echo "Main-Class: $(hello_MAINCLASS)"; echo 'Class-Path: @LIBINTL_JAR@'; } > Manifest.mf - catalogs=`MAKEFLAGS= $(MAKE) -s -C po echo-catalogs`; \ - $(JAR) cfm $@ Manifest.mf Hello*.class $(hello_RESOURCES) $$catalogs + $(JAR) cfm $@ Manifest.mf Hello*.class rm -f Manifest.mf + abs_jar=`pwd`/$@; (cd po && $(MAKE)) && catalogs=`GNUMAKEFLAGS=--no-print-directory $(MAKE) -s -C po echo-catalogs`; test -n "$$catalogs" && (cd $(srcdir) && $(JAR) uf "$$abs_jar" $$catalogs) || { rm -f $@ jartmp*; exit 1; } Hello.class: $(srcdir)/Hello.java CLASSPATH=.@CLASSPATH_SEPARATOR@$(hello_JAVALIBS) $(JAVACOMP) -d . $(srcdir)/Hello.java diff --git a/gettext-tools/examples/hello-java-awt/po/Makefile.am b/gettext-tools/examples/hello-java-awt/po/Makefile.am index b8cf04bfe..2ac2a415f 100644 --- a/gettext-tools/examples/hello-java-awt/po/Makefile.am +++ b/gettext-tools/examples/hello-java-awt/po/Makefile.am @@ -245,9 +245,9 @@ update-po: Makefile $(DUMMYPOFILES): -update-properties: Makefile $(DOMAIN).pot $(POFILES) - @echo "$(MSGINIT) -i $(DOMAIN).pot --no-translator -l en --properties-output -o $(top_srcdir)/$(DOMAIN).properties"; \ - $(MSGINIT) -i $(DOMAIN).pot --no-translator -l en --properties-output -o $(top_srcdir)/$(DOMAIN).properties || { rm -f $(top_srcdir)/$(DOMAIN).properties; exit 1; } +update-properties: Makefile $(srcdir)/$(DOMAIN).pot $(POFILES) + @echo "$(MSGINIT) -i $(srcdir)/$(DOMAIN).pot --no-translator -l en --properties-output -o $(top_srcdir)/$(DOMAIN).properties"; \ + $(MSGINIT) -i $(srcdir)/$(DOMAIN).pot --no-translator -l en --properties-output -o $(top_srcdir)/$(DOMAIN).properties || { rm -f $(top_srcdir)/$(DOMAIN).properties; exit 1; } @for f in $(POFILES); do \ lang=`echo $$f | sed -e 's,.*/,,' -e 's,\.po$$,,'`; \ echo "$(GMSGFMT) -c --statistics --verbose -o /dev/null $(srcdir)/$${lang}.po"; \ @@ -258,9 +258,9 @@ update-properties: Makefile $(DOMAIN).pot $(POFILES) done # Alternatively, we could create classes instead of properties files. -update-classes: Makefile $(DOMAIN).pot $(POFILES) - @echo "$(MSGINIT) -i $(DOMAIN).pot --no-translator -l en --properties-output -o $(top_srcdir)/$(DOMAIN).properties"; \ - $(MSGINIT) -i $(DOMAIN).pot --no-translator -l en --properties-output -o $(top_srcdir)/$(DOMAIN).properties || { rm -f $(top_srcdir)/$(DOMAIN).properties; exit 1; } +update-classes: Makefile $(srcdir)/$(DOMAIN).pot $(POFILES) + @echo "$(MSGINIT) -i $(srcdir)/$(DOMAIN).pot --no-translator -l en --properties-output -o $(top_srcdir)/$(DOMAIN).properties"; \ + $(MSGINIT) -i $(srcdir)/$(DOMAIN).pot --no-translator -l en --properties-output -o $(top_srcdir)/$(DOMAIN).properties || { rm -f $(top_srcdir)/$(DOMAIN).properties; exit 1; } @for f in $(POFILES); do \ lang=`echo $$f | sed -e 's,.*/,,' -e 's,\.po$$,,'`; \ echo "$(GMSGFMT) -c --statistics --verbose -j -d $(top_srcdir) -r $(DOMAIN) -l $${lang} $(srcdir)/$${lang}.po"; \ @@ -268,4 +268,5 @@ update-classes: Makefile $(DOMAIN).pot $(POFILES) done echo-catalogs: - @echo $(CATALOGS) +# When packaging the catalogs for installation, include the fallback catalog always. + @echo $(DOMAIN).properties $(CATALOGS) diff --git a/gettext-tools/examples/hello-java-qtjambi/Makefile.am b/gettext-tools/examples/hello-java-qtjambi/Makefile.am index 58e07c2bf..8fcc70921 100644 --- a/gettext-tools/examples/hello-java-qtjambi/Makefile.am +++ b/gettext-tools/examples/hello-java-qtjambi/Makefile.am @@ -23,13 +23,6 @@ hello_MAINCLASS = Hello # The link dependencies of the 'hello' program. hello_JAVALIBS = @LIBINTL_JAR@ -# The resources of the 'hello' program, excluding message catalogs, but -# including the fallback message catalog. -hello_RESOURCES = hello-java-qtjambi.properties - -# Resources that are generated from PO files. -MAINTAINERCLEANFILES = hello-java-qtjambi*.properties - # Additional files to be distributed. EXTRA_DIST = autogen.sh autoclean.sh @@ -56,9 +49,9 @@ all-local: hello.jar hello.sh hello.jar: $(hello_CLASSES) { echo "Manifest-Version: 1.0"; echo "Main-Class: $(hello_MAINCLASS)"; echo 'Class-Path: @LIBINTL_JAR@'; } > Manifest.mf - catalogs=`MAKEFLAGS= $(MAKE) -s -C po echo-catalogs`; \ - $(JAR) cfm $@ Manifest.mf Hello*.class $(hello_RESOURCES) $$catalogs + $(JAR) cfm $@ Manifest.mf Hello*.class rm -f Manifest.mf + abs_jar=`pwd`/$@; (cd po && $(MAKE)) && catalogs=`GNUMAKEFLAGS=--no-print-directory $(MAKE) -s -C po echo-catalogs`; test -n "$$catalogs" && (cd $(srcdir) && $(JAR) uf "$$abs_jar" $$catalogs) || { rm -f $@ jartmp*; exit 1; } Hello.class: $(srcdir)/Hello.java CLASSPATH=.@CLASSPATH_SEPARATOR@$(hello_JAVALIBS)@CLASSPATH_SEPARATOR@$$CLASSPATH $(JAVACOMP) -d . $(srcdir)/Hello.java diff --git a/gettext-tools/examples/hello-java-qtjambi/po/Makefile.am b/gettext-tools/examples/hello-java-qtjambi/po/Makefile.am index b8cf04bfe..2ac2a415f 100644 --- a/gettext-tools/examples/hello-java-qtjambi/po/Makefile.am +++ b/gettext-tools/examples/hello-java-qtjambi/po/Makefile.am @@ -245,9 +245,9 @@ update-po: Makefile $(DUMMYPOFILES): -update-properties: Makefile $(DOMAIN).pot $(POFILES) - @echo "$(MSGINIT) -i $(DOMAIN).pot --no-translator -l en --properties-output -o $(top_srcdir)/$(DOMAIN).properties"; \ - $(MSGINIT) -i $(DOMAIN).pot --no-translator -l en --properties-output -o $(top_srcdir)/$(DOMAIN).properties || { rm -f $(top_srcdir)/$(DOMAIN).properties; exit 1; } +update-properties: Makefile $(srcdir)/$(DOMAIN).pot $(POFILES) + @echo "$(MSGINIT) -i $(srcdir)/$(DOMAIN).pot --no-translator -l en --properties-output -o $(top_srcdir)/$(DOMAIN).properties"; \ + $(MSGINIT) -i $(srcdir)/$(DOMAIN).pot --no-translator -l en --properties-output -o $(top_srcdir)/$(DOMAIN).properties || { rm -f $(top_srcdir)/$(DOMAIN).properties; exit 1; } @for f in $(POFILES); do \ lang=`echo $$f | sed -e 's,.*/,,' -e 's,\.po$$,,'`; \ echo "$(GMSGFMT) -c --statistics --verbose -o /dev/null $(srcdir)/$${lang}.po"; \ @@ -258,9 +258,9 @@ update-properties: Makefile $(DOMAIN).pot $(POFILES) done # Alternatively, we could create classes instead of properties files. -update-classes: Makefile $(DOMAIN).pot $(POFILES) - @echo "$(MSGINIT) -i $(DOMAIN).pot --no-translator -l en --properties-output -o $(top_srcdir)/$(DOMAIN).properties"; \ - $(MSGINIT) -i $(DOMAIN).pot --no-translator -l en --properties-output -o $(top_srcdir)/$(DOMAIN).properties || { rm -f $(top_srcdir)/$(DOMAIN).properties; exit 1; } +update-classes: Makefile $(srcdir)/$(DOMAIN).pot $(POFILES) + @echo "$(MSGINIT) -i $(srcdir)/$(DOMAIN).pot --no-translator -l en --properties-output -o $(top_srcdir)/$(DOMAIN).properties"; \ + $(MSGINIT) -i $(srcdir)/$(DOMAIN).pot --no-translator -l en --properties-output -o $(top_srcdir)/$(DOMAIN).properties || { rm -f $(top_srcdir)/$(DOMAIN).properties; exit 1; } @for f in $(POFILES); do \ lang=`echo $$f | sed -e 's,.*/,,' -e 's,\.po$$,,'`; \ echo "$(GMSGFMT) -c --statistics --verbose -j -d $(top_srcdir) -r $(DOMAIN) -l $${lang} $(srcdir)/$${lang}.po"; \ @@ -268,4 +268,5 @@ update-classes: Makefile $(DOMAIN).pot $(POFILES) done echo-catalogs: - @echo $(CATALOGS) +# When packaging the catalogs for installation, include the fallback catalog always. + @echo $(DOMAIN).properties $(CATALOGS) diff --git a/gettext-tools/examples/hello-java-swing/Makefile.am b/gettext-tools/examples/hello-java-swing/Makefile.am index a0de172fa..2b9c71d1b 100644 --- a/gettext-tools/examples/hello-java-swing/Makefile.am +++ b/gettext-tools/examples/hello-java-swing/Makefile.am @@ -23,13 +23,6 @@ hello_MAINCLASS = Hello # The link dependencies of the 'hello' program. hello_JAVALIBS = @LIBINTL_JAR@ -# The resources of the 'hello' program, excluding message catalogs, but -# including the fallback message catalog. -hello_RESOURCES = hello-java-swing.properties - -# Resources that are generated from PO files. -MAINTAINERCLEANFILES = hello-java-swing*.properties - # Additional files to be distributed. EXTRA_DIST = autogen.sh autoclean.sh @@ -56,9 +49,9 @@ all-local: hello.jar hello.sh hello.jar: $(hello_CLASSES) { echo "Manifest-Version: 1.0"; echo "Main-Class: $(hello_MAINCLASS)"; echo 'Class-Path: @LIBINTL_JAR@'; } > Manifest.mf - catalogs=`MAKEFLAGS= $(MAKE) -s -C po echo-catalogs`; \ - $(JAR) cfm $@ Manifest.mf Hello*.class $(hello_RESOURCES) $$catalogs + $(JAR) cfm $@ Manifest.mf Hello*.class rm -f Manifest.mf + abs_jar=`pwd`/$@; (cd po && $(MAKE)) && catalogs=`GNUMAKEFLAGS=--no-print-directory $(MAKE) -s -C po echo-catalogs`; test -n "$$catalogs" && (cd $(srcdir) && $(JAR) uf "$$abs_jar" $$catalogs) || { rm -f $@ jartmp*; exit 1; } Hello.class: $(srcdir)/Hello.java CLASSPATH=.@CLASSPATH_SEPARATOR@$(hello_JAVALIBS) $(JAVACOMP) -d . $(srcdir)/Hello.java diff --git a/gettext-tools/examples/hello-java-swing/po/Makefile.am b/gettext-tools/examples/hello-java-swing/po/Makefile.am index b8cf04bfe..2ac2a415f 100644 --- a/gettext-tools/examples/hello-java-swing/po/Makefile.am +++ b/gettext-tools/examples/hello-java-swing/po/Makefile.am @@ -245,9 +245,9 @@ update-po: Makefile $(DUMMYPOFILES): -update-properties: Makefile $(DOMAIN).pot $(POFILES) - @echo "$(MSGINIT) -i $(DOMAIN).pot --no-translator -l en --properties-output -o $(top_srcdir)/$(DOMAIN).properties"; \ - $(MSGINIT) -i $(DOMAIN).pot --no-translator -l en --properties-output -o $(top_srcdir)/$(DOMAIN).properties || { rm -f $(top_srcdir)/$(DOMAIN).properties; exit 1; } +update-properties: Makefile $(srcdir)/$(DOMAIN).pot $(POFILES) + @echo "$(MSGINIT) -i $(srcdir)/$(DOMAIN).pot --no-translator -l en --properties-output -o $(top_srcdir)/$(DOMAIN).properties"; \ + $(MSGINIT) -i $(srcdir)/$(DOMAIN).pot --no-translator -l en --properties-output -o $(top_srcdir)/$(DOMAIN).properties || { rm -f $(top_srcdir)/$(DOMAIN).properties; exit 1; } @for f in $(POFILES); do \ lang=`echo $$f | sed -e 's,.*/,,' -e 's,\.po$$,,'`; \ echo "$(GMSGFMT) -c --statistics --verbose -o /dev/null $(srcdir)/$${lang}.po"; \ @@ -258,9 +258,9 @@ update-properties: Makefile $(DOMAIN).pot $(POFILES) done # Alternatively, we could create classes instead of properties files. -update-classes: Makefile $(DOMAIN).pot $(POFILES) - @echo "$(MSGINIT) -i $(DOMAIN).pot --no-translator -l en --properties-output -o $(top_srcdir)/$(DOMAIN).properties"; \ - $(MSGINIT) -i $(DOMAIN).pot --no-translator -l en --properties-output -o $(top_srcdir)/$(DOMAIN).properties || { rm -f $(top_srcdir)/$(DOMAIN).properties; exit 1; } +update-classes: Makefile $(srcdir)/$(DOMAIN).pot $(POFILES) + @echo "$(MSGINIT) -i $(srcdir)/$(DOMAIN).pot --no-translator -l en --properties-output -o $(top_srcdir)/$(DOMAIN).properties"; \ + $(MSGINIT) -i $(srcdir)/$(DOMAIN).pot --no-translator -l en --properties-output -o $(top_srcdir)/$(DOMAIN).properties || { rm -f $(top_srcdir)/$(DOMAIN).properties; exit 1; } @for f in $(POFILES); do \ lang=`echo $$f | sed -e 's,.*/,,' -e 's,\.po$$,,'`; \ echo "$(GMSGFMT) -c --statistics --verbose -j -d $(top_srcdir) -r $(DOMAIN) -l $${lang} $(srcdir)/$${lang}.po"; \ @@ -268,4 +268,5 @@ update-classes: Makefile $(DOMAIN).pot $(POFILES) done echo-catalogs: - @echo $(CATALOGS) +# When packaging the catalogs for installation, include the fallback catalog always. + @echo $(DOMAIN).properties $(CATALOGS) diff --git a/gettext-tools/examples/hello-java/Makefile.am b/gettext-tools/examples/hello-java/Makefile.am index 86af010d2..b8505f470 100644 --- a/gettext-tools/examples/hello-java/Makefile.am +++ b/gettext-tools/examples/hello-java/Makefile.am @@ -23,13 +23,6 @@ hello_MAINCLASS = Hello # The link dependencies of the 'hello' program. hello_JAVALIBS = @LIBINTL_JAR@ -# The resources of the 'hello' program, excluding message catalogs, but -# including the fallback message catalog. -hello_RESOURCES = hello-java.properties - -# Resources that are generated from PO files. -MAINTAINERCLEANFILES = hello-java*.properties - # Additional files to be distributed. EXTRA_DIST = autogen.sh autoclean.sh @@ -57,9 +50,9 @@ all-local: hello.jar hello.sh hello.jar: $(hello_CLASSES) { echo "Manifest-Version: 1.0"; echo "Main-Class: $(hello_MAINCLASS)"; echo 'Class-Path: @LIBINTL_JAR@'; } > Manifest.mf - catalogs=`MAKEFLAGS= $(MAKE) -s -C po echo-catalogs`; \ - $(JAR) cfm $@ Manifest.mf Hello*.class $(hello_RESOURCES) $$catalogs + $(JAR) cfm $@ Manifest.mf Hello*.class rm -f Manifest.mf + abs_jar=`pwd`/$@; (cd po && $(MAKE)) && catalogs=`GNUMAKEFLAGS=--no-print-directory $(MAKE) -s -C po echo-catalogs`; test -n "$$catalogs" && (cd $(srcdir) && $(JAR) uf "$$abs_jar" $$catalogs) || { rm -f $@ jartmp*; exit 1; } Hello.class: $(srcdir)/Hello.java CLASSPATH=.@CLASSPATH_SEPARATOR@$(hello_JAVALIBS) $(JAVACOMP) -d . $(srcdir)/Hello.java diff --git a/gettext-tools/examples/hello-java/po/Makefile.am b/gettext-tools/examples/hello-java/po/Makefile.am index b8cf04bfe..2ac2a415f 100644 --- a/gettext-tools/examples/hello-java/po/Makefile.am +++ b/gettext-tools/examples/hello-java/po/Makefile.am @@ -245,9 +245,9 @@ update-po: Makefile $(DUMMYPOFILES): -update-properties: Makefile $(DOMAIN).pot $(POFILES) - @echo "$(MSGINIT) -i $(DOMAIN).pot --no-translator -l en --properties-output -o $(top_srcdir)/$(DOMAIN).properties"; \ - $(MSGINIT) -i $(DOMAIN).pot --no-translator -l en --properties-output -o $(top_srcdir)/$(DOMAIN).properties || { rm -f $(top_srcdir)/$(DOMAIN).properties; exit 1; } +update-properties: Makefile $(srcdir)/$(DOMAIN).pot $(POFILES) + @echo "$(MSGINIT) -i $(srcdir)/$(DOMAIN).pot --no-translator -l en --properties-output -o $(top_srcdir)/$(DOMAIN).properties"; \ + $(MSGINIT) -i $(srcdir)/$(DOMAIN).pot --no-translator -l en --properties-output -o $(top_srcdir)/$(DOMAIN).properties || { rm -f $(top_srcdir)/$(DOMAIN).properties; exit 1; } @for f in $(POFILES); do \ lang=`echo $$f | sed -e 's,.*/,,' -e 's,\.po$$,,'`; \ echo "$(GMSGFMT) -c --statistics --verbose -o /dev/null $(srcdir)/$${lang}.po"; \ @@ -258,9 +258,9 @@ update-properties: Makefile $(DOMAIN).pot $(POFILES) done # Alternatively, we could create classes instead of properties files. -update-classes: Makefile $(DOMAIN).pot $(POFILES) - @echo "$(MSGINIT) -i $(DOMAIN).pot --no-translator -l en --properties-output -o $(top_srcdir)/$(DOMAIN).properties"; \ - $(MSGINIT) -i $(DOMAIN).pot --no-translator -l en --properties-output -o $(top_srcdir)/$(DOMAIN).properties || { rm -f $(top_srcdir)/$(DOMAIN).properties; exit 1; } +update-classes: Makefile $(srcdir)/$(DOMAIN).pot $(POFILES) + @echo "$(MSGINIT) -i $(srcdir)/$(DOMAIN).pot --no-translator -l en --properties-output -o $(top_srcdir)/$(DOMAIN).properties"; \ + $(MSGINIT) -i $(srcdir)/$(DOMAIN).pot --no-translator -l en --properties-output -o $(top_srcdir)/$(DOMAIN).properties || { rm -f $(top_srcdir)/$(DOMAIN).properties; exit 1; } @for f in $(POFILES); do \ lang=`echo $$f | sed -e 's,.*/,,' -e 's,\.po$$,,'`; \ echo "$(GMSGFMT) -c --statistics --verbose -j -d $(top_srcdir) -r $(DOMAIN) -l $${lang} $(srcdir)/$${lang}.po"; \ @@ -268,4 +268,5 @@ update-classes: Makefile $(DOMAIN).pot $(POFILES) done echo-catalogs: - @echo $(CATALOGS) +# When packaging the catalogs for installation, include the fallback catalog always. + @echo $(DOMAIN).properties $(CATALOGS) diff --git a/gettext-tools/examples/hello-pascal/Makefile.am b/gettext-tools/examples/hello-pascal/Makefile.am index f987b6953..851d495e2 100644 --- a/gettext-tools/examples/hello-pascal/Makefile.am +++ b/gettext-tools/examples/hello-pascal/Makefile.am @@ -14,7 +14,7 @@ SUBDIRS = m4 . po bin_PASCALPROGRAMS = hello # The source files of the 'hello' program. -hello_SOURCES = hello.pas +hello_SOURCES = $(srcdir)/hello.pas # Additional files to be distributed. EXTRA_DIST = autogen.sh autoclean.sh @@ -25,7 +25,7 @@ all-local: hello$(EXEEXT) # How to build the 'hello' program. hello$(EXEEXT) hello.rsj: $(hello_SOURCES) - LOCALEDIR='@localedir@' $(PPC) $(hello_SOURCES) + LOCALEDIR='@localedir@' $(PPC) -o./hello$(EXEEXT) $(hello_SOURCES) install-exec-local: all-local $(MKDIR_P) $(DESTDIR)$(bindir)