advapi32/tests: Add some GetOldestEventLogRecord tests.
[wine/multimedia.git] / tools / make_makefiles
blob28c1e1cde1383d4e314651095d01a558ed4ef0f2
1 #!/usr/bin/perl -w
3 # Build the auto-generated parts of the Wine makefiles.
5 # Copyright 2006 Alexandre Julliard
7 # This library is free software; you can redistribute it and/or
8 # modify it under the terms of the GNU Lesser General Public
9 # License as published by the Free Software Foundation; either
10 # version 2.1 of the License, or (at your option) any later version.
12 # This library is distributed in the hope that it will be useful,
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 # Lesser General Public License for more details.
17 # You should have received a copy of the GNU Lesser General Public
18 # License along with this library; if not, write to the Free Software
19 # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
22 use strict;
24 # Make rules files
25 my %makerules =
27 "MAKE_RULES" => "Make.rules",
28 "MAKE_DLL_RULES" => "dlls/Makedll.rules",
29 "MAKE_IMPLIB_RULES" => "dlls/Makeimplib.rules",
30 "MAKE_TEST_RULES" => "dlls/Maketest.rules",
31 "MAKE_PROG_RULES" => "programs/Makeprog.rules",
34 # Programs that we want to install in the bin directory too
35 my %bin_install =
37 "msiexec" => 1,
38 "notepad" => 1,
39 "regedit" => 1,
40 "regsvr32" => 1,
41 "wineboot" => 1,
42 "winecfg" => 1,
43 "wineconsole" => 1,
44 "winedbg" => 1,
45 "winefile" => 1,
46 "winemine" => 1,
47 "winepath" => 1,
50 # Programs that we don't want to install at all
51 my %dont_install =
53 "cmdlgtst" => 1,
54 "view" => 1,
55 "winetest" => 1,
58 # Default patterns for top-level .gitignore
59 my @ignores = (
60 "*.[oa]",
61 "*.fake",
62 "*.ok",
63 "*.res",
64 "*.so",
65 "/autom4te.cache",
66 "/config.cache",
67 "/config.log",
68 "/config.status",
69 "/configure.lineno",
70 "/TAGS",
71 "/tags",
72 "Makefile",
73 "dlldata.c",
74 "dlls/*/*.def",
75 "dlls/*/tests/*crosstest.exe",
76 "dlls/*/tests/testlist.c",
77 "include/config.h",
78 "include/stamp-h",
79 "programs/winetest/*_test.exe",
80 "programs/winetest/*_test.rc",
81 "programs/winetest/build.rc",
84 # Source files and their resulting target to ignore
85 my @ignore_srcs = (
86 [ 'BISON_SRCS', '\.y', '.tab.c' ],
87 [ 'BISON_SRCS', '\.y', '.tab.h' ],
88 [ 'LEX_SRCS', '\.l', '.yy.c' ],
89 [ 'MC_SRCS', '\.mc', '.mc.rc' ],
90 [ 'IDL_TLB_SRCS', '\.idl', '.tlb' ],
91 [ 'IDL_H_SRCS', '\.idl', '.h' ],
92 [ 'IDL_C_SRCS', '\.idl', '.h' ],
93 [ 'IDL_I_SRCS', '\.idl', '.h' ],
94 [ 'IDL_P_SRCS', '\.idl', '.h' ],
95 [ 'IDL_S_SRCS', '\.idl', '.h' ],
96 [ 'IDL_C_SRCS', '\.idl', '_c.c' ],
97 [ 'IDL_I_SRCS', '\.idl', '_i.c' ],
98 [ 'IDL_P_SRCS', '\.idl', '_p.c' ],
99 [ 'IDL_S_SRCS', '\.idl', '_s.c' ],
102 my %exported_wine_headers = (
103 "wine/debug.h" => 1,
104 "wine/exception.h" => 1,
105 "wine/library.h" => 1,
106 "wine/unicode.h" => 1,
107 "wine/itss.idl" => 1,
108 "wine/svcctl.idl" => 1,
111 my %private_idl_headers = (
112 "access.idl" => 1,
113 "axcore.idl" => 1,
114 "axextend.idl" => 1,
115 "binres.idl" => 1,
116 "cmdbas.idl" => 1,
117 "cmdtxt.idl" => 1,
118 "crtrow.idl" => 1,
119 "dbccmd.idl" => 1,
120 "dbcses.idl" => 1,
121 "dbdsad.idl" => 1,
122 "dbinit.idl" => 1,
123 "dbprop.idl" => 1,
124 "dbs.idl" => 1,
125 "devenum.idl" => 1,
126 "dyngraph.idl" => 1,
127 "opnrst.idl" => 1,
128 "rstbas.idl" => 1,
129 "rstinf.idl" => 1,
130 "rstloc.idl" => 1,
131 "sesprp.idl" => 1,
132 "vmrender.idl" => 1,
133 "wine/wined3d.idl" => 1,
134 "wine/winedxgi.idl" => 1,
137 my %ignored_source_files = (
138 "dlls/wineps.drv/afm2c.c" => 1,
139 "dlls/wineps.drv/mkagl.c" => 1,
140 "programs/winetest/dist.rc" => 1,
143 my (@all_files, @makefiles, %makefiles);
145 sub dirname($)
147 my $ret = shift;
148 return "" unless $ret =~ /\//;
149 $ret =~ s!/[^/]*$!!;
150 return $ret;
153 # update a file if changed
154 sub update_file($)
156 my $file = shift;
157 my $ret = !(-f $file) || system "cmp $file $file.new >/dev/null";
158 if (!$ret)
160 unlink "$file.new";
162 else
164 rename "$file.new", "$file";
165 print "$file updated\n";
166 if ($file eq "configure.ac")
168 system "autoconf";
169 print "configure updated\n";
172 return $ret;
175 # replace some lines in a file between two markers
176 sub replace_in_file($$$@)
178 my $file = shift;
179 my $start = shift;
180 my $end = shift;
182 open NEW_FILE, ">$file.new" or die "cannot create $file.new";
184 if (defined($start))
186 open OLD_FILE, "$file" or die "cannot open $file";
187 while (<OLD_FILE>)
189 last if /$start/;
190 print NEW_FILE $_;
194 print NEW_FILE @_;
196 if (defined($end))
198 my $skip=1;
199 while (<OLD_FILE>)
201 print NEW_FILE $_ unless $skip;
202 $skip = 0 if /$end/;
206 close OLD_FILE if defined($start);
207 close NEW_FILE;
208 return update_file($file);
211 # replace a variable in a makefile
212 sub replace_makefile_variable($$)
214 my ($file, $var) = @_;
215 my $make = $makefiles{$file};
217 return unless defined ${$make}{"=$var"};
219 my @values = @{${$make}{"=$var"}};
220 ${$make}{$var} = \@values;
222 open NEW_FILE, ">$file.in.new" or die "cannot create $file.in.new";
224 open OLD_FILE, "$file.in" or die "cannot open $file.in";
225 while (<OLD_FILE>)
227 if (/^\s*($var\s+)=/)
229 # try to preserve formatting
230 my $prefix = $1;
231 my $multiline = /\\$/ || (@values > 1);
232 while (/\\$/)
234 $_ = <OLD_FILE>;
235 last unless $_;
237 if ($multiline)
239 print NEW_FILE "$var = \\\n\t" . join(" \\\n\t", sort @values) . "\n";
241 else
243 print NEW_FILE "$prefix= @values\n";
245 next;
247 print NEW_FILE $_;
249 close OLD_FILE;
250 close NEW_FILE;
251 return update_file("$file.in");
254 # parse the specified makefile to identify the rules file
255 sub parse_makefile($)
257 my $file = shift;
258 my %make;
260 ($make{"=dir"} = $file) =~ s/[^\/]+$//;
262 open MAKE, "$file.in" or die "cannot open $file.in\n";
264 while (<MAKE>)
266 chomp;
267 next if (/^\s*#/);
268 while (/\\$/) { chop; $_ .= <MAKE>; chomp; } # merge continued lines
269 next if (/^\s*$/);
271 if (/^\@(MAKE.*RULES)\@/)
273 my $var = $1;
274 $make{"=rules"} = $makerules{$var};
275 next;
277 if (/^\s*(MODULE|IMPORTLIB|TESTDLL)\s*=\s*(.*)/)
279 $make{$1} = $2;
280 next;
282 if (/^\s*(BISON_SRCS|LEX_SRCS|IDL_[CHIPS]_SRCS|IDL_TLB_SRCS|IMPLIB_SRCS|C_SRCS|MC_SRCS|RC_SRCS|SVG_SRCS|C_SRCS16|RC_SRCS16|SPEC_SRCS16|EXTRA_OBJS16|MANPAGES|PROGRAMS)\s*=\s*(.*)/)
284 my @list = split(/\s+/, $2);
285 $make{$1} = \@list;
286 next;
289 return %make;
292 # assign source files to their respective makefile
293 sub assign_sources_to_makefiles()
295 foreach my $file (@all_files)
297 next if defined $ignored_source_files{$file};
298 my $dir = dirname( $file );
300 while ($dir && !defined $makefiles{"$dir/Makefile"}) { $dir = dirname( $dir ); }
301 next unless $dir;
303 die "no makefile found for $file\n" unless defined $makefiles{"$dir/Makefile"};
305 my $make = $makefiles{"$dir/Makefile"};
306 my $basename = substr( $file, length($dir) + 1 );
308 if ($basename =~ /\.c$/) { push @{${$make}{"=C_SRCS"}}, $basename; }
309 elsif ($basename =~ /\.l$/) { push @{${$make}{"=LEX_SRCS"}}, $basename; }
310 elsif ($basename =~ /\.y$/) { push @{${$make}{"=BISON_SRCS"}}, $basename; }
311 elsif ($basename =~ /\.rc$/) { push @{${$make}{"=RC_SRCS"}}, $basename; }
312 elsif ($basename =~ /\.mc$/) { push @{${$make}{"=MC_SRCS"}}, $basename; }
313 elsif ($basename =~ /\.svg$/) { push @{${$make}{"=SVG_SRCS"}}, $basename; }
317 ################################################################
318 # update the makefile list in configure.ac
320 sub update_makefiles(@)
322 my (@lines);
324 foreach my $var (sort { $makerules{$a} cmp $makerules{$b}; } keys %makerules)
326 my $file = $makerules{$var};
327 my %make = %{$makefiles{$file}};
328 my $rules = $make{"=rules"} ? ",[$make{\"=rules\"}]" : "";
329 push @lines, "WINE_CONFIG_MAKERULES([$file],[$var]$rules)\n";
331 push @lines, "\n";
333 foreach my $file (sort @_)
335 my %make = %{$makefiles{$file}};
336 my $rules = $make{"=rules"};
337 my $args = "";
338 if ($rules eq $makerules{"MAKE_DLL_RULES"})
340 $args = ",[dlls],[ALL_DLL_DIRS]";
341 $args .= ",[enable_win16]" if $make{"MODULE"} =~ /(16|\.vxd)$/;
343 elsif ($rules eq $makerules{"MAKE_IMPLIB_RULES"}) { $args = ",[dlls],[ALL_IMPLIB_DIRS]"; }
344 elsif ($rules eq $makerules{"MAKE_TEST_RULES"}) { $args = ",[dlls],[ALL_TEST_DIRS],[enable_tests]"; }
345 elsif ($rules eq $makerules{"MAKE_PROG_RULES"})
347 (my $name = $file) =~ s/^programs\/(.*)\/Makefile/$1/;
348 $args = ",[programs],[ALL_PROGRAM_DIRS";
349 $args .= ",ALL_PROGRAM_INSTALL_DIRS" unless $dont_install{$name};
350 $args .= ",ALL_PROGRAM_BIN_INSTALL_DIRS" if $bin_install{$name};
351 $args .= "]";
352 $args .= ",[enable_win16]" if $make{"MODULE"} =~ /16$/;
354 elsif ($file =~ /^[^\/]*\/Makefile$/) { $args = ",[],[ALL_TOP_DIRS]"; }
355 push @lines, "WINE_CONFIG_MAKEFILE([$file],[$rules]$args)\n";
358 # update the source variables in all the makefiles
360 foreach my $file (sort @_)
362 my %make = %{$makefiles{$file}};
364 replace_makefile_variable( $file, "LEX_SRCS" );
365 replace_makefile_variable( $file, "BISON_SRCS" );
366 replace_makefile_variable( $file, "MC_SRCS" );
367 replace_makefile_variable( $file, "SVG_SRCS" );
368 replace_makefile_variable( $file, "C_SRCS" ) unless defined $make{"C_SRCS16"};
369 replace_makefile_variable( $file, "RC_SRCS" ) unless defined $make{"RC_SRCS16"};
372 push @lines, "\ndnl Build dependencies for test files compiled into winetest\n";
373 replace_in_file( "configure.ac", '^WINE_CONFIG_MAKERULES', '^dnl Build dependencies for test files compiled into winetest$', @lines);
377 ################################################################
378 # process ignore targets for generic source files
380 sub update_ignores(@)
382 my @ignores;
384 foreach my $file (sort @_)
386 my %makefile = %{$makefiles{$file}};
387 my @list;
389 foreach my $src (@ignore_srcs)
391 my @pattern = @{$src};
392 next unless defined $makefile{$pattern[0]};
393 push @list, map { (my $ret = $_) =~ s/$pattern[1]$/$pattern[2]/; $ret; } @{$makefile{$pattern[0]}};
395 foreach my $f (@list)
397 push @ignores, $makefile{"=dir"} . $f unless $f =~ /\$\(.*\)/; # skip make variables
400 return @ignores;
403 ################################################################
404 # update dlls/Makefile.in
406 sub update_dlls(@)
408 my (%directories, %importlibs, %static_implibs, %staticlib_dirs, %altnames);
409 my $text = "";
410 my @ignores = ();
412 foreach my $make (@_)
414 my %makefile = %{$makefiles{$make}};
415 next if ($makefile{"=rules"} eq $makerules{"MAKE_TEST_RULES"});
417 next unless defined $makefile{"MODULE"};
418 my $module = $makefile{"MODULE"};
419 (my $dir = $makefile{"=dir"}) =~ s/^dlls\/(.*)\//$1/;
421 if ($makefile{"=rules"} eq $makerules{"MAKE_IMPLIB_RULES"})
423 $staticlib_dirs{$module} = $dir;
424 die "invalid module $module in dir $staticlib_dirs{$module}\n" if "$staticlib_dirs{$module}" ne $module;
426 else
428 die "invalid module $module" unless $module =~ /\./;
429 (my $mod = $module) =~ s/\.dll$//;
430 die "invalid directory $dir for module $module\n" unless $mod eq $dir;
431 $directories{$module} = $dir;
434 if (defined $makefile{"IMPORTLIB"})
436 if ($makefile{"IMPORTLIB"} =~ /^([a-zA-Z0-9_.]+)/)
438 $importlibs{$module} = $1;
440 else
442 die "invalid importlib name $makefile{IMPORTLIB} in $make";
446 $static_implibs{$module} = 1 if defined $makefile{"IMPLIB_SRCS"};
448 if (defined $makefile{"SPEC_SRCS16"})
450 my @list = map { $_ =~ s/\.spec$//; $_ .= ".dll" unless $_ =~ /\./; $_; } @{$makefile{"SPEC_SRCS16"}};
451 $altnames{$module} = \@list;
453 if (defined $makefile{"EXTRA_OBJS16"})
455 foreach my $obj (@{$makefile{"EXTRA_OBJS16"}})
457 if ($obj =~ /^(.*\.(exe|mod))\.o/) { push @{$altnames{$module}}, $1; }
462 # output the list of 16-bit files
464 my @targets16 = ();
465 foreach my $mod (sort keys %directories)
467 next unless defined $altnames{$mod};
468 foreach my $i (sort @{$altnames{$mod}})
470 push @targets16, $i . "16";
473 $text .= "# 16-bit dlls\n\n";
474 $text .= "WIN16_FILES = \\\n";
475 $text .= "\t" . join( " \\\n\t", sort @targets16 ) . "\n\n";
476 $text .= "\@MAKE_RULES\@\n\n";
478 # output the all: target
480 $text .= "# Main target\n\n";
481 $text .= "all: \$(BUILDSUBDIRS) \@WIN16_FILES\@\n\n";
483 # output the lib name -> directory rules
485 $text .= "# Placeholders for 16-bit libraries\n\n";
486 foreach my $mod (sort keys %directories)
488 next unless defined $altnames{$mod};
489 $text .= sprintf "%s:\n", join(" ", map { $_ . "16"; } sort @{$altnames{$mod}});
490 $text .= sprintf "\techo \"%s\" >\$\@\n\n", $mod;
493 # output the import libraries rules
495 $text .= "# Import libraries\n\n";
496 $text .= "STATIC_IMPLIBEXT = \$(IMPLIBEXT:def=def.a)\n\n";
498 my @lib_symlinks = ();
499 foreach my $mod (sort keys %importlibs)
501 my $dir = $directories{$mod};
502 my $lib = $importlibs{$mod};
503 if ($lib ne $dir) { push @lib_symlinks, $mod; }
505 $text .= "IMPORT_SYMLINKS =";
506 foreach my $mod (sort @lib_symlinks)
508 $text .= sprintf " \\\n\tlib%s.\$(IMPLIBEXT)", $importlibs{$mod};
511 $text .= "\n\nIMPORT_LIBS = \\\n\t\$(IMPORT_SYMLINKS)";
512 foreach my $mod (sort keys %staticlib_dirs)
514 $text .= sprintf " \\\n\t%s/lib%s.a", $staticlib_dirs{$mod}, $mod;
516 foreach my $mod (sort keys %importlibs)
518 $text .= " \\\n\t$directories{$mod}/lib$importlibs{$mod}.\$(IMPLIBEXT)";
519 next unless defined $static_implibs{$mod};
520 $text .= " \\\n\t$directories{$mod}/lib$importlibs{$mod}.\$(STATIC_IMPLIBEXT)";
522 $text .= "\n\nCROSS_IMPLIBS =";
523 foreach my $mod (sort @lib_symlinks)
525 $text .= sprintf " \\\n\tlib%s.a", $importlibs{$mod};
527 foreach my $mod (sort keys %importlibs)
529 next if defined $static_implibs{$mod};
530 $text .= " \\\n\t$directories{$mod}/lib$importlibs{$mod}.a";
532 $text .= "\n\n";
533 $text .= "\$(TESTSUBDIRS:%=%/__crosstest__): \$(CROSS_IMPLIBS)\n\n";
534 $text .= "implib: \$(IMPORT_LIBS)\n\n";
535 $text .= "testsubdirs: \$(TESTSUBDIRS)\n\n";
536 $text .= ".PHONY: implib testsubdirs\n\n";
538 foreach my $mod (sort keys %importlibs)
540 my $dir = $directories{$mod};
541 my $lib = $importlibs{$mod};
542 my $spec = $mod;
543 $spec =~ s/\.dll$//;
544 if (defined($static_implibs{$mod}))
546 $text .= sprintf "%s/lib%s.def: %s/%s.spec \$(WINEBUILD)\n", $dir, $lib, $dir, $spec;
547 $text .= sprintf "\t\@cd %s && \$(MAKE) lib%s.def\n\n", $dir, $lib;
548 $text .= sprintf "%s/lib%s.\$(STATIC_IMPLIBEXT): dummy\n", $dir, $lib, $dir, $spec;
549 $text .= sprintf "\t\@cd %s && \$(MAKE) lib%s.\$(STATIC_IMPLIBEXT)\n\n", $dir, $lib;
551 else
553 $text .= sprintf "%s/lib%s.def %s/lib%s.a: %s/%s.spec \$(WINEBUILD)\n",
554 $dir, $lib, $dir, $lib, $dir, $spec;
555 $text .= sprintf "\t\@cd %s && \$(MAKE) `basename \$\@`\n\n", $dir;
558 foreach my $mod (sort @lib_symlinks)
560 my $dir = $directories{$mod};
561 my $lib = "lib" . $importlibs{$mod};
562 $text .= sprintf "%s.a: %s/%s.a\n", $lib, $dir, $lib;
563 $text .= sprintf "\t\$(RM) \$@ && \$(LN_S) %s/%s.a \$@\n\n", $dir, $lib;
564 $text .= sprintf "%s.def: %s/%s.def\n", $lib, $dir, $lib;
565 $text .= sprintf "\t\$(RM) \$@ && \$(LN_S) %s/%s.def \$@\n\n", $dir, $lib;
568 $text .= "\$(BUILDSUBDIRS): \$(IMPORT_LIBS)\n";
569 $text .= "\$(INSTALLSUBDIRS:%=%/__install__) \$(INSTALLSUBDIRS:%=%/__install-lib__): \$(IMPORT_LIBS)\n\n";
571 # output the inter-dll dependencies and rules
573 $text .= "# Map library name to the corresponding directory\n\n";
575 foreach my $mod (sort keys %staticlib_dirs)
577 $text .= sprintf "%s/lib%s.a: %s\n", $staticlib_dirs{$mod}, $mod, $staticlib_dirs{$mod};
579 $text .= "\n# Misc rules\n";
581 replace_in_file( "dlls/Makefile.in",
582 '^# 16-bit dlls',
583 '^# Misc rules',
584 $text );
586 # .gitignore file
588 foreach my $mod (sort @lib_symlinks)
590 push @ignores, "dlls/lib$importlibs{$mod}.def";
592 foreach my $mod (sort keys %directories)
594 next unless defined $altnames{$mod};
595 push @ignores, map { "dlls/" . $_ . "16"; } @{$altnames{$mod}};
598 return @ignores;
602 ################################################################
603 # update include/Makefile.in
605 sub update_includes()
607 my (@h_srcs, @private_idl_srcs, @public_idl_srcs, @tlb_srcs, %subdirs);
608 my @includes = map { (my $ret = $_) =~ s/^include\///; $ret; } grep /^include\//, @all_files;
609 foreach my $incl (@includes)
611 if ($incl =~ /(.*)\//) { $subdirs{$1} = 1; }
612 next if ($incl =~ /\.in$/);
613 if ($incl =~ /^wine\// && !$exported_wine_headers{$incl})
615 if ($private_idl_headers{$incl}) { push @private_idl_srcs, $incl; }
616 next;
618 if ($incl =~ /stdole2\.idl$/) { push @tlb_srcs, $incl; }
619 elsif ($private_idl_headers{$incl}) { push @h_srcs, $incl; }
620 elsif ($incl =~ /\.h$/) { push @h_srcs, $incl; }
621 elsif ($incl =~ /\.rh$/) { push @h_srcs, $incl; }
622 elsif ($incl =~ /\.inl$/) { push @h_srcs, $incl; }
623 elsif ($incl =~ /\.idl$/) { push @public_idl_srcs, $incl; }
624 else { die "unknown file $incl in include dir"; }
626 replace_in_file( "include/Makefile.in", '^PRIVATE_IDL_H_SRCS\s*=', '^INSTALLDIRS',
627 "PRIVATE_IDL_H_SRCS = \\\n\t",
628 join( " \\\n\t", sort @private_idl_srcs ),
629 "\n\nPUBLIC_IDL_H_SRCS = \\\n\t",
630 join( " \\\n\t", sort @public_idl_srcs ),
631 "\n\nIDL_TLB_SRCS = \\\n\t",
632 join( " \\\n\t", sort @tlb_srcs ),
633 "\n\nSRCDIR_INCLUDES = \\\n\t\$(IDL_TLB_SRCS) \\\n\t\$(PUBLIC_IDL_H_SRCS) \\\n\t",
634 join( " \\\n\t", sort @h_srcs ),
635 "\n\nEXTRASUBDIRS = ",
636 join( " ", sort keys %subdirs ),
637 "\n\nINSTALLDIRS = \\\n" );
638 return map { s/(.*)\.idl$/include\/$1.h/; $_; } @public_idl_srcs, @private_idl_srcs;
642 ################################################################
643 # update the main .gitignore
645 sub update_gitignore(@)
647 my @ignores = values %makerules;
649 foreach my $make (@makefiles)
651 my %makefile = %{$makefiles{$make}};
652 my $dir = $makefile{"=dir"};
653 if (defined $makefile{"MANPAGES"})
655 push @ignores, map { $dir . $_; } @{$makefile{"MANPAGES"}};
657 if (defined $makefile{"PROGRAMS"})
659 push @ignores, map { s/\$\(EXEEXT\)//; $dir . $_; } @{$makefile{"PROGRAMS"}};
663 # prepend a slash to paths that don't have one
664 @ignores = map { $_ =~ s/^([^\/]+)$/\/$1/; $_; } @ignores;
666 # get rid of duplicates
667 my %ignores = ();
668 foreach my $i (@ignores, @_) { $ignores{$i} = 1; }
670 replace_in_file( ".gitignore", undef, undef,
671 "# Automatically generated by make_makefiles; DO NOT EDIT!!\n",
672 join("\n", sort keys %ignores), "\n" );
676 die "needs to be run from a git checkout" unless -d ".git";
678 @all_files = split /\0/, `git ls-files -c -z`;
679 @makefiles = map { my $ret = $_; $ret =~ s/\.in$//; $ret; } grep /Makefile.in$/, @all_files;
681 foreach my $file (sort values %makerules, @makefiles)
683 my %make = parse_makefile( $file );
684 $makefiles{$file} = \%make;
687 assign_sources_to_makefiles();
688 update_makefiles( @makefiles );
689 push @ignores, update_includes();
690 push @ignores, update_ignores( @makefiles );
691 push @ignores, update_dlls( sort grep /^dlls\//, @makefiles );
692 update_gitignore( @ignores );