make_makefiles: Add more wildcard patterns in .gitignore.
[wine/multimedia.git] / tools / make_makefiles
blobd49b2c1366b18c9f49c9847c0cfd01d9ac25f514
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 # Make rules files
23 my %makerules =
25 "MAKE_RULES" => "Make.rules",
26 "MAKE_DLL_RULES" => "dlls/Makedll.rules",
27 "MAKE_IMPLIB_RULES" => "dlls/Makeimplib.rules",
28 "MAKE_TEST_RULES" => "dlls/Maketest.rules",
29 "MAKE_PROG_RULES" => "programs/Makeprog.rules",
32 # Programs that we want to install in the bin directory too
33 my %bin_install =
35 "msiexec" => 1,
36 "notepad" => 1,
37 "progman" => 1,
38 "regedit" => 1,
39 "regsvr32" => 1,
40 "uninstaller" => 1,
41 "wineboot" => 1,
42 "winebrowser" => 1,
43 "winecfg" => 1,
44 "wineconsole" => 1,
45 "winedbg" => 1,
46 "winefile" => 1,
47 "winemine" => 1,
48 "winepath" => 1,
51 # Programs that we don't want to install at all
52 my %dont_install =
54 "cmdlgtst" => 1,
55 "view" => 1,
56 "winetest" => 1,
59 # Special dlls that can be switched on or off by configure
60 my %special_dlls =
62 "glu32" => "GLU32FILES",
63 "opengl32" => "OPENGLFILES",
64 "winex11.drv" => "XFILES",
65 "winequartz.drv" => "QUARTZFILES"
68 # Default patterns for top-level .gitignore
69 my @ignores = (
70 "*.[oa]",
71 "*.ok",
72 "*.res",
73 "*.so",
74 "/autom4te.cache",
75 "/config.cache",
76 "/config.log",
77 "/config.status",
78 "/TAGS",
79 "/tags",
80 "Makefile",
81 "dlldata.c",
82 "dlls/*/*.def",
83 "dlls/*/tests/*crosstest.exe",
84 "dlls/*/tests/testlist.c",
85 "include/config.h",
86 "include/stamp-h"
89 # Source files and their resulting target to ignore
90 my @ignore_srcs = (
91 [ 'BISON_SRCS', '\.y', '.tab.c' ],
92 [ 'BISON_SRCS', '\.y', '.tab.h' ],
93 [ 'LEX_SRCS', '\.l', '.yy.c' ],
94 [ 'MC_SRCS', '\.mc', '.mc.rc' ],
95 [ 'IDL_TLB_SRCS', '\.idl', '.tlb' ],
96 [ 'IDL_H_SRCS', '\.idl', '.h' ],
97 [ 'IDL_C_SRCS', '\.idl', '.h' ],
98 [ 'IDL_I_SRCS', '\.idl', '.h' ],
99 [ 'IDL_P_SRCS', '\.idl', '.h' ],
100 [ 'IDL_S_SRCS', '\.idl', '.h' ],
101 [ 'IDL_C_SRCS', '\.idl', '_c.c' ],
102 [ 'IDL_I_SRCS', '\.idl', '_i.c' ],
103 [ 'IDL_P_SRCS', '\.idl', '_p.c' ],
104 [ 'IDL_S_SRCS', '\.idl', '_s.c' ],
107 my %private_headers = (
108 "wine/irot.idl" => 1,
109 "wine/list.h" => 1,
110 "wine/mmsystem16.h" => 1,
111 "wine/mscvpdb.h" => 1,
112 "wine/port.h" => 1,
113 "wine/pthread.h" => 1,
114 "wine/rpcfc.h" => 1,
115 "wine/server.h" => 1,
116 "wine/server_protocol.h" => 1,
117 "wine/test.h" => 1,
118 "wine/wgl.h" => 1,
119 "wine/winaspi.h" => 1,
120 "wine/winbase16.h" => 1,
121 "wine/windef16.h" => 1,
122 "wine/wined3d_caps.h" => 1,
123 "wine/wined3d_gl.h" => 1,
124 "wine/wined3d_interface.h" => 1,
125 "wine/wined3d_types.h" => 1,
126 "wine/wingdi16.h" => 1,
127 "wine/winnet16.h" => 1,
128 "wine/winsock16.h" => 1,
129 "wine/winuser16.h" => 1,
130 "wine/wpp.h" => 1
133 my %private_idl_headers = (
134 "axcore.idl" => 1,
135 "axextend.idl" => 1,
136 "dbinit.idl" => 1,
137 "dbprop.idl" => 1,
138 "dbs.idl" => 1,
139 "devenum.idl" => 1,
140 "dyngraph.idl" => 1
143 my (@makefiles, %makefiles);
145 # update a file if changed
146 sub update_file($)
148 my $file = shift;
149 my $ret = !(-f $file) || system "cmp $file $file.new >/dev/null";
150 if (!$ret)
152 unlink "$file.new";
154 else
156 rename "$file.new", "$file";
157 print "$file updated\n";
158 if ($file eq "configure.ac")
160 system "autoconf";
161 print "configure updated\n";
164 return $ret;
167 # replace some lines in a file between two markers
168 sub replace_in_file($$$@)
170 my $file = shift;
171 my $start = shift;
172 my $end = shift;
174 open NEW_FILE, ">$file.new" or die "cannot create $file.new";
176 if (defined($start))
178 open OLD_FILE, "$file" or die "cannot open $file";
179 while (<OLD_FILE>)
181 last if /$start/;
182 print NEW_FILE $_;
186 print NEW_FILE @_;
188 if (defined($end))
190 my $skip=1;
191 while (<OLD_FILE>)
193 print NEW_FILE $_ unless $skip;
194 $skip = 0 if /$end/;
198 close OLD_FILE if defined($start);
199 close NEW_FILE;
200 return update_file($file);
203 # parse the specified makefile to identify the rules file
204 sub parse_makefile($)
206 my $file = shift;
207 my %make;
209 ($make{"=dir"} = $file) =~ s/[^\/]+$//;
211 open MAKE, "$file.in" or die "cannot open $file.in\n";
213 while (<MAKE>)
215 chomp;
216 while (/\\$/) { chop; $_ .= <MAKE>; chomp; } # merge continued lines
218 if (/^\@(MAKE.*RULES)\@/)
220 my $var = $1;
221 $make{"=rules"} = $makerules{$var};
222 next;
224 if (/^(MODULE|IMPORTLIB|TESTDLL)\s*=\s*(.*)/)
226 $make{$1} = $2;
227 next;
229 if (/^(BISON_SRCS|LEX_SRCS|IDL_[CHIPS]_SRCS|IDL_TLB_SRCS|IMPLIB_SRCS|MC_SRCS|RC_SRCS|RC_SRCS16|RC_BINARIES|SPEC_SRCS16|EXTRA_OBJS16|MANPAGES|PROGRAMS)\s*=\s*(.*)/)
231 my @list = split(/\s+/, $2);
232 $make{$1} = \@list;
233 next;
235 if (/^\#\s*MKDLL_SKIP/ || /^\#\s*MKPROG_SKIP/)
237 $make{"=skip"} = 1;
238 next;
241 return %make;
245 ################################################################
246 # update the makefile list in configure.ac
248 sub update_makerules(@)
253 ################################################################
254 # update the tests list in programs/winetest/Makefile.in and programs/winetest/winetest.rc
256 sub update_winetest(@)
258 my (@tests, @lines);
260 foreach my $file (@_)
262 if ($file =~ /^dlls\/(.*)\/tests\/Makefile/) { push @tests, $1; }
264 push @lines, "TESTBINS =";
265 push @lines, map { " \\\n\t" . $_ . "_test.exe"; } sort @tests;
266 push @lines, "\n\n";
268 foreach my $test (sort @tests)
270 push @lines, "${test}_test.exe: \$(DLLDIR)/$test/tests/${test}_test.exe\$(DLLEXT)\n";
271 push @lines, "\tcp \$(DLLDIR)/$test/tests/${test}_test.exe\$(DLLEXT) \$\@ && \$(STRIP) \$\@\n";
273 push @lines, "\n# Special rules\n";
275 replace_in_file( "programs/winetest/Makefile.in", '^TESTBINS\s*=', '^# Special rules', @lines );
277 replace_in_file( "programs/winetest/winetest.rc", ' TESTRES ', undef,
278 map { $_ . "_test.exe TESTRES \"" . $_ . "_test.exe\"\n"; } sort @tests );
280 # return a list of test exe files for .gitignore
281 return map { "programs/winetest/" . $_ . "_test.exe"; } sort @tests;
285 ################################################################
286 # update the makefile list in configure.ac and Makefile.in
288 sub update_makefiles(@)
290 my (@targets, @depends, @lines);
292 foreach my $var (sort { $makerules{$a} cmp $makerules{$b}; } keys %makerules)
294 push @lines, "$var=$makerules{$var}\n";
295 push @lines, "AC_SUBST_FILE($var)\n\n";
298 foreach my $var ((sort values %makerules), (sort @_))
300 push @lines, "AC_CONFIG_FILES([$var])\n";
303 push @lines, "\nAC_OUTPUT\n";
304 replace_in_file( "configure.ac", '^MAKE_RULES', '^AC_OUTPUT$', @lines);
306 foreach my $file (sort values %makerules)
308 push @targets, $file;
309 my %make = %{$makefiles{$file}};
310 if (!defined($make{"=rules"})) { push @depends, "$file: $file.in"; }
311 else { push @depends, "$file: $file.in Make.rules"; }
314 foreach my $file (sort @_)
316 push @targets, $file unless $file eq "Makefile";
317 my %makefile = %{$makefiles{$file}};
318 my $dep = $makefile{"=rules"};
319 push @depends, "$file: $file.in $dep";
323 @lines = ();
324 push @lines, "ALL_MAKEFILES = \\\n\t";
325 push @lines, join (" \\\n\t", @targets ), "\n\n";
326 push @lines, "Makefile \$(ALL_MAKEFILES): config.status\n";
327 push @lines, "\t\@./config.status \$\@\n";
328 push @lines, ".INIT: Makefile\n";
329 push @lines, ".BEGIN: Makefile\n\n";
330 push @lines, "\$(RECURSE_TARGETS) \$(MAKEDEP): \$(ALL_MAKEFILES)\n\n";
331 push @lines, "distclean::\n";
332 push @lines, "\t\$(RM) Makefile \$(ALL_MAKEFILES)\n\n";
333 push @lines, join ("\n", @depends ), "\n";
335 replace_in_file( "Makefile.in", '^ALL_MAKEFILES\s*=', undef, @lines );
339 ################################################################
340 # process ignore targets for generic source files
342 sub update_ignores(@)
344 my @ignores;
346 foreach my $file (sort @_)
348 my %makefile = %{$makefiles{$file}};
349 my @list;
351 foreach my $src (@ignore_srcs)
353 my @pattern = @{$src};
354 next unless defined $makefile{$pattern[0]};
355 push @list, map { (my $ret = $_) =~ s/$pattern[1]$/$pattern[2]/; $ret; } @{$makefile{$pattern[0]}};
357 push @list, @{$makefile{"RC_BINARIES"}} if defined $makefile{"RC_BINARIES"};
358 foreach my $f (@list)
360 push @ignores, $makefile{"=dir"} . $f unless $f =~ /\$\(.*\)/; # skip make variables
363 return @ignores;
366 ################################################################
367 # update dlls/Makefile.in
369 sub update_dlls(@)
371 my (%directories, %testdirs, %importlibs, %static_implibs, %staticlib_dirs, %altnames);
372 my $text = "";
373 my @ignores = ();
375 foreach my $make (@_)
377 my %makefile = %{$makefiles{$make}};
378 next if defined $makefile{"=skip"};
380 if ($make =~ /dlls\/(.*)\/tests\/Makefile/)
382 $testdirs{$1} = "$1/tests";
383 (my $crosstest = $makefile{"TESTDLL"}) =~ s/\.dll$//;
384 next;
387 next unless defined $makefile{"MODULE"};
388 my $module = $makefile{"MODULE"};
389 (my $dir = $makefile{"=dir"}) =~ s/^dlls\/(.*)\//$1/;
391 if ($makefile{"=rules"} eq $makerules{"MAKE_IMPLIB_RULES"})
393 $staticlib_dirs{$module} = $dir;
394 die "invalid module $module in dir $staticlib_dirs{$module}\n" if "$staticlib_dirs{$module}" ne $module;
396 else
398 die "invalid module $module" unless $module =~ /\./;
399 (my $mod = $module) =~ s/\.dll$//;
400 die "invalid directory $dir for module $module\n" unless $mod eq $dir;
401 $directories{$module} = $dir;
404 if (defined $makefile{"IMPORTLIB"})
406 if ($makefile{"IMPORTLIB"} =~ /^([a-zA-Z0-9_.]+)/)
408 $importlibs{$module} = $1;
410 else
412 die "invalid importlib name $makefile{IMPORTLIB} in $make";
416 $static_implibs{$module} = 1 if defined $makefile{"IMPLIB_SRCS"};
418 if (defined $makefile{"SPEC_SRCS16"})
420 my @list = map { $_ =~ s/\.spec$//; $_ .= ".dll" unless $_ =~ /\./; $_; } @{$makefile{"SPEC_SRCS16"}};
421 $altnames{$module} = \@list;
423 if (defined $makefile{"EXTRA_OBJS16"})
425 foreach my $obj (@{$makefile{"EXTRA_OBJS16"}})
427 if ($obj =~ /^(.*\.(exe|mod))\.o/) { push @{$altnames{$module}}, $1; }
432 # output special dlls configure definitions
434 $text .= "# special configure-dependent targets\n\n";
435 my %specials = ();
436 foreach my $mod (sort keys %special_dlls)
438 $specials{$special_dlls{$mod}} .= " " . $mod;
440 foreach my $i (sort keys %specials)
442 $text .= $i . " =" . $specials{$i} . "\n";
444 $text .= "EXTRADIRS =";
445 foreach my $i (sort keys %specials) { $text .= sprintf " \@%s\@", $i; }
446 $text .= "\n\n";
448 # output the subdirs list
450 $text .= "# Subdir list\n\n";
451 $text .= "BASEDIRS =";
452 foreach my $dir (sort values %directories)
454 next if defined($special_dlls{$dir}); # skip special dlls
455 $text .= " \\\n\t" . $dir;
458 $text .= "\n\nIMPLIBSUBDIRS = \\\n\t";
459 $text .= join " \\\n\t", sort values %staticlib_dirs;
461 $text .= "\n\nTESTSUBDIRS = \\\n\t";
462 $text .= join " \\\n\t", sort values %testdirs;
464 $text .= "\n\nSUBDIRS = \\\n\t";
465 $text .= join " \\\n\t", "\$(BASEDIRS)", "\$(IMPLIBSUBDIRS)", "\$(TESTSUBDIRS)", sort keys %special_dlls;
467 $text .= "\n\nBUILDSUBDIRS = \$(BASEDIRS) \$(EXTRADIRS) \$(TESTSUBDIRS)\n";
468 $text .= "INSTALLSUBDIRS = \$(BASEDIRS) \$(EXTRADIRS) \$(IMPLIBSUBDIRS)\n";
469 $text .= "DOCSUBDIRS = \$(BASEDIRS) \$(EXTRADIRS)\n";
471 # output the list of 16-bit files
473 my @targets16 = ();
474 foreach my $mod (sort keys %directories)
476 next unless defined $altnames{$mod};
477 foreach my $i (sort @{$altnames{$mod}})
479 push @targets16, $i . "16";
482 $text .= "\n# 16-bit dlls\n\n";
483 $text .= "WIN16_FILES = \\\n";
484 $text .= "\t" . join( " \\\n\t", sort @targets16 ) . "\n\n";
485 $text .= "\@MAKE_RULES\@\n\n";
487 # output the all: target
489 $text .= "# Main target\n\n";
490 $text .= "all: \$(BUILDSUBDIRS) \@WIN16_FILES\@\n\n";
492 # output the lib name -> directory rules
494 $text .= "# Placeholders for 16-bit libraries\n\n";
495 foreach my $mod (sort keys %directories)
497 next unless defined $altnames{$mod};
498 $text .= sprintf "%s:\n", join(" ", map { $_ . "16"; } sort @{$altnames{$mod}});
499 $text .= sprintf "\techo \"%s\" >\$\@\n\n", $mod;
502 # output the import libraries rules
504 $text .= "# Import libraries\n\n";
505 $text .= "STATIC_IMPLIBEXT = \$(IMPLIBEXT:def=def.a)\n\n";
507 my @lib_symlinks = ();
508 foreach my $mod (sort keys %importlibs)
510 my $dir = $directories{$mod};
511 my $lib = $importlibs{$mod};
512 if ($lib ne $dir) { push @lib_symlinks, $mod; }
514 $text .= "IMPORT_SYMLINKS =";
515 foreach my $mod (sort @lib_symlinks)
517 $text .= sprintf " \\\n\tlib%s.\$(IMPLIBEXT)", $importlibs{$mod};
520 $text .= "\n\nIMPORT_LIBS = \\\n\t\$(IMPORT_SYMLINKS)";
521 foreach my $mod (sort keys %staticlib_dirs)
523 $text .= sprintf " \\\n\t%s/lib%s.a", $staticlib_dirs{$mod}, $mod;
525 foreach my $mod (sort keys %importlibs)
527 $text .= " \\\n\t$directories{$mod}/lib$importlibs{$mod}.\$(IMPLIBEXT)";
528 next unless defined $static_implibs{$mod};
529 $text .= " \\\n\t$directories{$mod}/lib$importlibs{$mod}.\$(STATIC_IMPLIBEXT)";
531 $text .= "\n\n";
532 $text .= "implib: \$(IMPORT_LIBS)\n\n";
533 $text .= ".PHONY: implib\n\n";
535 foreach my $mod (sort keys %importlibs)
537 my $dir = $directories{$mod};
538 my $lib = $importlibs{$mod};
539 my $spec = $mod;
540 $spec =~ s/\.dll$//;
541 if (defined($static_implibs{$mod}))
543 $text .= sprintf "%s/lib%s.def: %s/%s.spec \$(WINEBUILD)\n", $dir, $lib, $dir, $spec;
544 $text .= sprintf "\t\@cd %s && \$(MAKE) lib%s.def\n\n", $dir, $lib;
545 $text .= sprintf "%s/lib%s.\$(STATIC_IMPLIBEXT): dummy\n", $dir, $lib, $dir, $spec;
546 $text .= sprintf "\t\@cd %s && \$(MAKE) lib%s.\$(STATIC_IMPLIBEXT)\n\n", $dir, $lib;
548 else
550 $text .= sprintf "%s/lib%s.\$(IMPLIBEXT): %s/%s.spec \$(WINEBUILD)\n", $dir, $lib, $dir, $spec;
551 $text .= sprintf "\t\@cd %s && \$(MAKE) lib%s.\$(IMPLIBEXT)\n\n", $dir, $lib;
554 foreach my $mod (sort @lib_symlinks)
556 my $dir = $directories{$mod};
557 my $lib = "lib" . $importlibs{$mod} . ".\$(IMPLIBEXT)";
558 $text .= sprintf "%s: %s/%s\n", $lib, $dir, $lib;
559 $text .= sprintf "\t\$(RM) \$@ && \$(LN_S) %s/%s \$@\n\n", $dir, $lib;
562 $text .= "\$(BUILDSUBDIRS): \$(IMPORT_LIBS)\n";
563 $text .= "\$(INSTALLSUBDIRS:%=%/__install__) \$(INSTALLSUBDIRS:%=%/__install-lib__): \$(IMPORT_LIBS)\n\n";
565 # output the inter-dll dependencies and rules
567 $text .= "# Map library name to the corresponding directory\n\n";
569 foreach my $mod (sort keys %staticlib_dirs)
571 $text .= sprintf "%s/lib%s.a: %s\n", $staticlib_dirs{$mod}, $mod, $staticlib_dirs{$mod};
573 $text .= "\n# Misc rules\n";
575 replace_in_file( "dlls/Makefile.in",
576 '^# special configure-dependent targets',
577 '^# Misc rules',
578 $text );
580 # .gitignore file
582 foreach my $mod (sort @lib_symlinks)
584 push @ignores, "dlls/lib$importlibs{$mod}.def";
586 foreach my $mod (sort keys %directories)
588 next unless defined $altnames{$mod};
589 push @ignores, map { "dlls/" . $_ . "16"; } @{$altnames{$mod}};
592 return @ignores;
596 ################################################################
597 # update programs/Makefile.in
599 sub update_progs(@)
601 my (@subdirs, @install_subdirs, @install_progs);
603 my @ignores = ();
605 foreach my $make (@_)
607 my %makefile = %{$makefiles{$make}};
608 my $module = $makefile{"MODULE"};
609 (my $dir = $make) =~ s/^programs\/(.*)\/Makefile$/$1/;
610 die "Invalid module $module in $make" unless "$dir.exe" eq $module;
611 next if defined $makefile{"=skip"};
612 push @subdirs, $dir;
613 push @ignores, "programs/$dir/$dir";
614 push @install_subdirs, $dir unless $dont_install{$dir};
615 push @install_progs, $dir if $bin_install{$dir};
618 replace_in_file( "programs/Makefile.in", '^SUBDIRS\s*=', '^INSTALLDIRS',
619 "SUBDIRS = \\\n\t",
620 join( " \\\n\t", @subdirs ),
621 "\n\n# Sub-directories to run make install into\nINSTALLSUBDIRS = \\\n\t",
622 join( " \\\n\t", @install_subdirs ),
623 "\n\n# Programs to install in bin directory\nINSTALLPROGS = \\\n\t",
624 join( " \\\n\t", @install_progs ),
625 "\n\nINSTALLDIRS = \$(DESTDIR)\$(bindir)\n" );
627 return @ignores;
631 ################################################################
632 # update include/Makefile.in
634 sub update_includes()
636 return unless -d ".git";
637 my (@h_srcs, @idl_srcs, @tlb_srcs, %subdirs);
638 my @includes = map { s/^include\///; $_; } split /\0/, `git ls-files -c -z include`;
639 foreach my $incl (@includes)
641 if ($incl =~ /(.*)\//) { $subdirs{$1} = 1; }
642 next if ($private_headers{$incl});
643 if ($incl =~ /stdole2\.idl$/) { push @tlb_srcs, $incl; }
644 elsif ($private_idl_headers{$incl}) { push @h_srcs, $incl; }
645 elsif ($incl =~ /\.h$/) { push @h_srcs, $incl; }
646 elsif ($incl =~ /\.inl$/) { push @h_srcs, $incl; }
647 elsif ($incl =~ /\.idl$/) { push @idl_srcs, $incl; }
649 replace_in_file( "include/Makefile.in", '^IDL_H_SRCS\s*=', '^INSTALLDIRS',
650 "IDL_H_SRCS = \\\n\t",
651 join( " \\\n\t", sort @idl_srcs ),
652 "\n\nIDL_TLB_SRCS = \\\n\t",
653 join( " \\\n\t", sort @tlb_srcs ),
654 "\n\nSRCDIR_INCLUDES = \\\n\t\$(IDL_TLB_SRCS) \\\n\t\$(IDL_H_SRCS) \\\n\t",
655 join( " \\\n\t", sort @h_srcs ),
656 "\n\nEXTRASUBDIRS = ",
657 join( " ", sort keys %subdirs ),
658 "\n\nINSTALLDIRS = \\\n" );
662 ################################################################
663 # update the main .gitignore
665 sub update_gitignore(@)
667 my @ignores = values %makerules;
669 foreach my $make (@makefiles)
671 my %makefile = %{$makefiles{$make}};
672 my $dir = $makefile{"=dir"};
673 if (defined $makefile{"MANPAGES"})
675 push @ignores, map { $dir . $_; } @{$makefile{"MANPAGES"}};
677 if (defined $makefile{"PROGRAMS"})
679 push @ignores, map { s/\$\(EXEEXT\)//; $dir . $_; } @{$makefile{"PROGRAMS"}};
683 # prepend a slash to paths that don't have one
684 @ignores = map { $_ =~ s/^([^\/]+)$/\/$1/; $_; } @ignores;
686 # get rid of duplicates
687 my %ignores = ();
688 foreach my $i (@ignores, @_) { $ignores{$i} = 1; }
690 replace_in_file( ".gitignore", undef, undef,
691 "# Automatically generated by make_makefiles; DO NOT EDIT!!\n",
692 join("\n", sort keys %ignores), "\n" );
696 if (-d ".git")
698 @makefiles = map { s/\.in$//; $_; } split /\0/, `git ls-files -c -z Makefile.in \\*/Makefile.in`;
700 else
702 @makefiles = map { s/^\.\/(.*)\.in/$1/; $_; } split(/\s/,`find . -name Makefile.in -print`);
705 update_includes();
707 foreach my $file (sort values %makerules, @makefiles)
709 my %make = parse_makefile( $file );
710 $makefiles{$file} = \%make;
713 update_makefiles( @makefiles );
714 push @ignores, update_ignores( @makefiles );
715 push @ignores, update_winetest( @makefiles );
716 push @ignores, update_dlls( sort grep /^dlls\//, @makefiles );
717 push @ignores, update_progs( sort grep /^programs\/.*\/Makefile$/, @makefiles );
718 update_gitignore( @ignores );