Module: wine Branch: master Commit: 34618113f4e5f97bc7e5dab6b46e297944aad01a URL: http://source.winehq.org/git/?p=wine.git;a=commit;h=34618113f4e5f97bc7e5dab6...
Author: Alexandre Julliard julliard@winehq.org Date: Mon Aug 28 11:57:10 2006 +0200
tools: Added make_makefiles tool that updates the list in configure.ac and runs make_dlls and make_progs.
---
dlls/make_dlls | 37 ++--------------- programs/make_progs | 33 +--------------- tools/make_makefiles | 106 ++++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 113 insertions(+), 63 deletions(-) create mode 100755 tools/make_makefiles
diff --git a/dlls/make_dlls b/dlls/make_dlls index 339e28c..4046193 100755 --- a/dlls/make_dlls +++ b/dlls/make_dlls @@ -62,9 +62,10 @@ sub update_file($) # if we are inside the dlls dir, go up one level if (! -f "configure.ac" && -f "../configure.ac") { chdir(".."); }
-my $makefiles = `find dlls -name Makefile.in -print`; +my @args = @ARGV; +if (!@args) { @args = split /\s/, `find dlls -name Makefile.in -print`; }
-foreach my $i (split(/\s/,$makefiles)) +foreach my $i (@args) { if ($i =~ /dlls/(.*)/tests/Makefile.in/) { @@ -72,7 +73,7 @@ foreach my $i (split(/\s/,$makefiles)) next; }
- open MAKE,$i; + open MAKE, $i or die "cannot open $i\n";
my $module = undef; my $dir = $i; @@ -365,8 +366,6 @@ check test:: $(BUILDSUBDIRS:%=%/__test_
crosstest:: $(BUILDSUBDIRS:%=%/__crosstest__)
-checklink:: $(BUILDSUBDIRS:%=%/__checklink__) - ### Dependencies: EOF
@@ -409,31 +408,3 @@ print GITIGNORE join("\n", sort @ignores
close GITIGNORE; update_file("dlls/.gitignore"); - -################################################################ -# configure.ac file - -open OLD_CONFIG, "configure.ac" or die "cannot open configure.ac"; -open NEW_CONFIG, ">configure.ac.new" or die "cannot create configure.ac.new"; - -while (<OLD_CONFIG>) -{ - print NEW_CONFIG $_; - last if /^dlls/Makefile/; -} - -foreach my $dir (sort (values %directories, values %staticlib_dirs, values %testdirs)) -{ - print NEW_CONFIG "dlls/$dir/Makefile\n"; -} - -my $skip=1; -while (<OLD_CONFIG>) -{ - $skip = 0 unless /^dlls//; - print NEW_CONFIG $_ unless $skip; -} - -close OLD_CONFIG; -close NEW_CONFIG; -update_file("configure.ac"); diff --git a/programs/make_progs b/programs/make_progs index 01788d4..10edb18 100755 --- a/programs/make_progs +++ b/programs/make_progs @@ -71,9 +71,10 @@ sub update_file($) # if we are inside the programs dir, go up one level if (! -f "configure.ac" && -f "../configure.ac") { chdir(".."); }
-my $makefiles = `find programs -name Makefile.in -print`; +my @args = @ARGV; +if (!@args) { @args = split /\s/, `find programs -name Makefile.in -print`; }
-foreach my $i (split(/\s/,$makefiles)) +foreach my $i (@args) { my $module;
@@ -225,31 +226,3 @@ print GITIGNORE join("\n", sort @ignores
close GITIGNORE; update_file("programs/.gitignore"); - -################################################################ -# configure.ac file - -open OLD_CONFIG, "configure.ac" or die "cannot open configure.ac"; -open NEW_CONFIG, ">configure.ac.new" or die "cannot create configure.ac.new"; - -while (<OLD_CONFIG>) -{ - print NEW_CONFIG $_; - last if /^programs/Makefile/; -} - -foreach my $dir (sort values %directories) -{ - print NEW_CONFIG "programs/$dir/Makefile\n"; -} - -my $skip=1; -while (<OLD_CONFIG>) -{ - $skip = 0 unless /^programs//; - print NEW_CONFIG $_ unless $skip; -} - -close OLD_CONFIG; -close NEW_CONFIG; -update_file("configure.ac"); diff --git a/tools/make_makefiles b/tools/make_makefiles new file mode 100755 index 0000000..83411bb --- /dev/null +++ b/tools/make_makefiles @@ -0,0 +1,106 @@ +#!/usr/bin/perl -w +# +# Build the auto-generated parts of the Wine makefiles. +# +# Copyright 2006 Alexandre Julliard +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA +# + +# update a file if changed +sub update_file($) +{ + my $file = shift; + my $ret = system "cmp $file $file.new >/dev/null"; + if (!$ret) + { + unlink "$file.new"; + print "$file is unchanged\n"; + } + else + { + rename "$file.new", "$file"; + print "$file updated\n"; + } + return $ret; +} + +# replace some lines in a file between two markers +sub replace_in_file($$$@) +{ + my $file = shift; + my $start = shift; + my $end = shift; + + open OLD_FILE, "$file" or die "cannot open $file"; + open NEW_FILE, ">$file.new" or die "cannot create $file.new"; + + while (<OLD_FILE>) + { + last if /$start/; + print NEW_FILE $_; + } + + print NEW_FILE @_; + + if (defined($end)) + { + my $skip=1; + while (<OLD_FILE>) + { + print NEW_FILE $_ unless $skip; + $skip = 0 if /$end/; + } + } + + close OLD_FILE; + close NEW_FILE; + return update_file($file); +} + +my (@makefiles, @makerules); + +if (-d ".git") +{ + @makefiles = map { s/.in$//; $_; } split /\s/, `git ls-files -c Makefile.in \*/Makefile.in`; + @makerules = map { s/.in$//; $_; } split /\s/, `git ls-files -c Make\*rules.in \*/Make\*rules.in`; +} +else +{ + @makefiles = map { s/^./(.*).in/$1/; $_; } split(/\s/,`find . -name Makefile.in -print`); + @makerules = map { s/^./(.*).in/$1/; $_; } split(/\s/,`find . -name Make\*.rules.in -print`); +} + + +################################################################ +# update the makefile list in configure.ac + +replace_in_file( "configure.ac", '^AC_CONFIG_FILES(', '])$', + "AC_CONFIG_FILES([\n", + join ("\n", (sort @makerules), (sort @makefiles) ), "])\n" ); + + +################################################################ +# update dlls/Makefile.in + +my @dll_makefiles = grep /^dlls//, @makefiles; +system "dlls/make_dlls", @dll_makefiles; + + +################################################################ +# update programs/Makefile.in + +my @prog_makefiles = grep /^programs//, @makefiles; +system "programs/make_progs", @prog_makefiles;