From 7c2a4bf25eb2269094897d3b4a4911c9b3243d94 Mon Sep 17 00:00:00 2001
From: Alexandre Julliard <julliard@winehq.org>
Date: Tue, 4 Jan 2011 16:55:54 +0100
Subject: [PATCH] makefiles: Add dependencies on all po files for po-translated
 resources.

---
 Make.rules.in              |  1 +
 Make.vars.in               |  2 ++
 configure                  | 42 ++++++++++++++++++++++++++++++++++++++
 configure.ac               | 40 ++++++++++++++++++++++++++++++++++++
 programs/clock/Makefile.in |  1 +
 tools/make_makefiles       | 17 +++++++++++++--
 6 files changed, 101 insertions(+), 2 deletions(-)

diff --git a/Make.rules.in b/Make.rules.in
index 34ee6fc8bc3..090a06e065e 100644
--- a/Make.rules.in
+++ b/Make.rules.in
@@ -181,6 +181,7 @@ $(MC_SRCS:.mc=.mc.rc): $(WMC)
 $(IDL_GEN_HEADERS) $(IDL_GEN_C_SRCS) $(IDL_TLB_SRCS:.idl=.tlb) $(IDL_R_SRCS:.idl=_r.res): $(WIDL)
 
 $(RC_SRCS:.rc=.res) $(MC_SRCS:.mc=.mc.res): $(WRC)
+$(PO_SRCS:.rc=.res): $(ALL_PO_FILES)
 
 dummy:
 
diff --git a/Make.vars.in b/Make.vars.in
index f04a0881592..93eec22efc1 100644
--- a/Make.vars.in
+++ b/Make.vars.in
@@ -53,6 +53,8 @@ RSVG            = @RSVG@
 CONVERT         = @CONVERT@
 ICOTOOL         = @ICOTOOL@
 CROSSTARGET     = @CROSSTARGET@
+LINGUAS         = @LINGUAS@
+ALL_PO_FILES    = $(LINGUAS:%=@top_srcdir@/po/%.po)
 CROSSAR         = $(CROSSTARGET)-ar
 CROSSRANLIB     = $(CROSSTARGET)-ranlib
 MKINSTALLDIRS   = $(top_srcdir)/tools/mkinstalldirs -m 755
diff --git a/configure b/configure
index 25b85333e3d..2074d3b0b8a 100755
--- a/configure
+++ b/configure
@@ -596,6 +596,7 @@ ac_includes_default="\
 
 ac_subst_vars='LTLIBOBJS
 LIBOBJS
+LINGUAS
 ALL_TEST_BINARIES
 ALL_WINETEST_DEPENDS
 LDAPLIBS
@@ -15454,6 +15455,47 @@ wine_fn_config_tool tools/winegcc
 wine_fn_config_tool tools/wmc
 wine_fn_config_tool tools/wrc
 
+LINGUAS="\
+cs \
+da \
+de \
+en_US \
+eo \
+es \
+fi \
+fr \
+he \
+hi \
+hu \
+it \
+ja \
+ko \
+lt \
+ml \
+nb_NO \
+nl \
+or \
+pa \
+pl \
+pt_BR \
+pt_PT \
+ro \
+ru \
+sk \
+sl \
+sr_Latn_SP \
+sr_SP \
+sv \
+te \
+th \
+tr \
+uk \
+wa \
+zh_CN \
+zh_TW"
+
+
+
 ac_config_commands="$ac_config_commands Makefile"
 
 
diff --git a/configure.ac b/configure.ac
index 9ed1a5d456d..f27659dc8b7 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2940,6 +2940,46 @@ WINE_CONFIG_TOOL(tools/winedump)
 WINE_CONFIG_TOOL(tools/winegcc)
 WINE_CONFIG_TOOL(tools/wmc)
 WINE_CONFIG_TOOL(tools/wrc)
+
+AC_SUBST([LINGUAS],["\
+cs \
+da \
+de \
+en_US \
+eo \
+es \
+fi \
+fr \
+he \
+hi \
+hu \
+it \
+ja \
+ko \
+lt \
+ml \
+nb_NO \
+nl \
+or \
+pa \
+pl \
+pt_BR \
+pt_PT \
+ro \
+ru \
+sk \
+sl \
+sr_Latn_SP \
+sr_SP \
+sv \
+te \
+th \
+tr \
+uk \
+wa \
+zh_CN \
+zh_TW"])
+
 dnl End of auto-generated output commands
 
 AC_CONFIG_COMMANDS([Makefile], [wine_fn_output_makefile Makefile],
diff --git a/programs/clock/Makefile.in b/programs/clock/Makefile.in
index c085893bfc8..a9c4b72e80a 100644
--- a/programs/clock/Makefile.in
+++ b/programs/clock/Makefile.in
@@ -8,5 +8,6 @@ C_SRCS = \
 	winclock.c
 
 RC_SRCS = clock.rc
+PO_SRCS = clock.rc
 
 @MAKE_PROG_RULES@
diff --git a/tools/make_makefiles b/tools/make_makefiles
index bee12f8ee7f..08e7dd2626c 100755
--- a/tools/make_makefiles
+++ b/tools/make_makefiles
@@ -170,7 +170,7 @@ my %ignored_source_files = (
     "programs/winetest/dist.rc" => 1,
 );
 
-my (@makefiles, %makefiles);
+my (@linguas, @makefiles, %makefiles);
 
 sub dirname($)
 {
@@ -472,6 +472,8 @@ sub update_makefiles(@)
         }
     }
 
+    push @lines, "\nAC_SUBST([LINGUAS],[\"\\\n", join( " \\\n", sort @linguas ), "\"])\n\n";
+
     # update the source variables in all the makefiles
 
     foreach my $file (sort @_)
@@ -563,10 +565,20 @@ sub update_gitignore(@)
 }
 
 
+################################################################
+# update the LINGUAS file
+
+sub update_linguas(@)
+{
+    replace_in_file( "po/LINGUAS", undef, undef, join("\n", sort @_), "\n" );
+}
+
+
 die "needs to be run from a git checkout" unless -d ".git";
 
 my @all_files = split /\0/, `git ls-files -c -z`;
-@makefiles = map { my $ret = $_; $ret =~ s/\.in$//; $ret; } grep /Makefile.in$/, @all_files;
+@linguas = map { (my $ret = $_) =~ s/^po\/(.*)\.po/$1/; $ret; } grep /^po\/.*\.po$/, @all_files;
+@makefiles = map { (my $ret = $_) =~ s/\.in$//; $ret; } grep /Makefile.in$/, @all_files;
 
 foreach my $file (sort values %makerules, @makefiles)
 {
@@ -575,6 +587,7 @@ foreach my $file (sort values %makerules, @makefiles)
 }
 
 assign_sources_to_makefiles( @all_files );
+update_linguas( @linguas );
 update_makefiles( @makefiles );
 push @ignores, update_ignores( @makefiles );
 update_gitignore( @ignores );
-- 
GitLab