shell32: Fix and simplify the FO_COPY operation, with tests.
[wine.git] / tools / make_makefiles
blobf72728813242f0dc3c267bcfc7da1bead8f3433d
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,
49 "winhelp" => 1,
52 # Programs that we don't want to install at all
53 my %dont_install =
55 "cmdlgtst" => 1,
56 "view" => 1,
57 "winetest" => 1,
60 # Special dlls that can be switched on or off by configure
61 my %special_dlls =
63 "glu32" => "GLU32FILES",
64 "opengl32" => "OPENGLFILES",
65 "winex11.drv" => "XFILES",
66 "winequartz.drv" => "QUARTZFILES"
69 # Default patterns for top-level .gitignore
70 my @ignores = (
71 "*.[oa]",
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 "include/config.h",
83 "include/stamp-h"
86 # Source files and their resulting target to ignore
87 my @ignore_srcs = (
88 [ 'BISON_SRCS', '\.y', '.tab.c' ],
89 [ 'BISON_SRCS', '\.y', '.tab.h' ],
90 [ 'LEX_SRCS', '\.l', '.yy.c' ],
91 [ 'MC_SRCS', '\.mc', '.mc.rc' ],
92 [ 'IDL_TLB_SRCS', '\.idl', '.tlb' ],
93 [ 'IDL_H_SRCS', '\.idl', '.h' ],
94 [ 'IDL_C_SRCS', '\.idl', '.h' ],
95 [ 'IDL_I_SRCS', '\.idl', '.h' ],
96 [ 'IDL_P_SRCS', '\.idl', '.h' ],
97 [ 'IDL_S_SRCS', '\.idl', '.h' ],
98 [ 'IDL_C_SRCS', '\.idl', '_c.c' ],
99 [ 'IDL_I_SRCS', '\.idl', '_i.c' ],
100 [ 'IDL_P_SRCS', '\.idl', '_p.c' ],
101 [ 'IDL_S_SRCS', '\.idl', '_s.c' ],
104 my %private_headers = (
105 "wine/irot.idl" => 1,
106 "wine/list.h" => 1,
107 "wine/mmsystem16.h" => 1,
108 "wine/mscvpdb.h" => 1,
109 "wine/port.h" => 1,
110 "wine/pthread.h" => 1,
111 "wine/rpcfc.h" => 1,
112 "wine/rpcss_shared.h" => 1,
113 "wine/server.h" => 1,
114 "wine/server_protocol.h" => 1,
115 "wine/test.h" => 1,
116 "wine/wgl.h" => 1,
117 "wine/winaspi.h" => 1,
118 "wine/winbase16.h" => 1,
119 "wine/windef16.h" => 1,
120 "wine/wined3d_caps.h" => 1,
121 "wine/wined3d_gl.h" => 1,
122 "wine/wined3d_interface.h" => 1,
123 "wine/wined3d_types.h" => 1,
124 "wine/wingdi16.h" => 1,
125 "wine/winnet16.h" => 1,
126 "wine/winsock16.h" => 1,
127 "wine/winuser16.h" => 1,
128 "wine/wpp.h" => 1
131 my %private_idl_headers = (
132 "axcore.idl" => 1,
133 "axextend.idl" => 1,
134 "dbinit.idl" => 1,
135 "dbprop.idl" => 1,
136 "dbs.idl" => 1,
137 "devenum.idl" => 1,
138 "dyngraph.idl" => 1
141 my (@makefiles, %makefiles);
143 # update a file if changed
144 sub update_file($)
146 my $file = shift;
147 my $ret = !(-f $file) || system "cmp $file $file.new >/dev/null";
148 if (!$ret)
150 unlink "$file.new";
152 else
154 rename "$file.new", "$file";
155 print "$file updated\n";
156 if ($file eq "configure.ac")
158 system "autoconf";
159 print "configure updated\n";
162 return $ret;
165 # replace some lines in a file between two markers
166 sub replace_in_file($$$@)
168 my $file = shift;
169 my $start = shift;
170 my $end = shift;
172 open NEW_FILE, ">$file.new" or die "cannot create $file.new";
174 if (defined($start))
176 open OLD_FILE, "$file" or die "cannot open $file";
177 while (<OLD_FILE>)
179 last if /$start/;
180 print NEW_FILE $_;
184 print NEW_FILE @_;
186 if (defined($end))
188 my $skip=1;
189 while (<OLD_FILE>)
191 print NEW_FILE $_ unless $skip;
192 $skip = 0 if /$end/;
196 close OLD_FILE if defined($start);
197 close NEW_FILE;
198 return update_file($file);
201 # parse the specified makefile to identify the rules file
202 sub parse_makefile($)
204 my $file = shift;
205 my %make;
207 ($make{"=dir"} = $file) =~ s/[^\/]+$//;
209 open MAKE, "$file.in" or die "cannot open $file.in\n";
211 while (<MAKE>)
213 chomp;
214 while (/\\$/) { chop; $_ .= <MAKE>; chomp; } # merge continued lines
216 if (/^\@(MAKE.*RULES)\@/)
218 my $var = $1;
219 $make{"=rules"} = $makerules{$var};
220 next;
222 if (/^(MODULE|IMPORTLIB|TESTDLL)\s*=\s*(.*)/)
224 $make{$1} = $2;
225 next;
227 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*(.*)/)
229 my @list = split(/\s+/, $2);
230 $make{$1} = \@list;
231 next;
233 if (/^\#\s*MKDLL_SKIP/ || /^\#\s*MKPROG_SKIP/)
235 $make{"=skip"} = 1;
236 next;
239 return %make;
243 ################################################################
244 # update the makefile list in configure.ac
246 sub update_makerules(@)
251 ################################################################
252 # update the tests list in programs/winetest/Makefile.in and programs/winetest/winetest.rc
254 sub update_winetest(@)
256 my (@tests, @lines);
258 foreach my $file (@_)
260 if ($file =~ /^dlls\/(.*)\/tests\/Makefile/) { push @tests, $1; }
262 push @lines, "TESTBINS =";
263 push @lines, map { " \\\n\t" . $_ . "_test.exe"; } sort @tests;
264 push @lines, "\n\n";
266 foreach my $test (sort @tests)
268 push @lines, "${test}_test.exe: \$(DLLDIR)/$test/tests/${test}_test.exe\$(DLLEXT)\n";
269 push @lines, "\tcp \$(DLLDIR)/$test/tests/${test}_test.exe\$(DLLEXT) \$\@ && \$(STRIP) \$\@\n";
271 push @lines, "\n# Special rules\n";
273 replace_in_file( "programs/winetest/Makefile.in", '^TESTBINS\s*=', '^# Special rules', @lines );
275 replace_in_file( "programs/winetest/winetest.rc", ' TESTRES ', undef,
276 map { $_ . "_test.exe TESTRES \"" . $_ . "_test.exe\"\n"; } sort @tests );
278 # return a list of test exe files for .gitignore
279 return map { "programs/winetest/" . $_ . "_test.exe"; } sort @tests;
283 ################################################################
284 # update the makefile list in configure.ac and Makefile.in
286 sub update_makefiles(@)
288 my (@targets, @depends, @lines);
290 foreach my $var (sort { $makerules{$a} cmp $makerules{$b}; } keys %makerules)
292 push @lines, "$var=$makerules{$var}\n";
293 push @lines, "AC_SUBST_FILE($var)\n\n";
296 foreach my $var ((sort values %makerules), (sort @_))
298 push @lines, "AC_CONFIG_FILES([$var])\n";
301 push @lines, "\nAC_OUTPUT\n";
302 replace_in_file( "configure.ac", '^MAKE_RULES', '^AC_OUTPUT$', @lines);
304 foreach my $file (sort values %makerules)
306 push @targets, $file;
307 my %make = %{$makefiles{$file}};
308 if (!defined($make{"=rules"})) { push @depends, "$file: $file.in"; }
309 else { push @depends, "$file: $file.in Make.rules"; }
312 foreach my $file (sort @_)
314 push @targets, $file unless $file eq "Makefile";
315 my %makefile = %{$makefiles{$file}};
316 my $dep = $makefile{"=rules"};
317 push @depends, "$file: $file.in $dep";
321 @lines = ();
322 push @lines, "ALL_MAKEFILES = \\\n\t";
323 push @lines, join (" \\\n\t", @targets ), "\n\n";
324 push @lines, "Makefile \$(ALL_MAKEFILES): config.status\n";
325 push @lines, "\t\@./config.status \$\@\n";
326 push @lines, ".INIT: Makefile\n";
327 push @lines, ".BEGIN: Makefile\n\n";
328 push @lines, "\$(RECURSE_TARGETS) \$(MAKEDEP): \$(ALL_MAKEFILES)\n\n";
329 push @lines, "distclean::\n";
330 push @lines, "\t\$(RM) Makefile \$(ALL_MAKEFILES)\n\n";
331 push @lines, join ("\n", @depends ), "\n";
333 replace_in_file( "Makefile.in", '^ALL_MAKEFILES\s*=', undef, @lines );
337 ################################################################
338 # process ignore targets for generic source files
340 sub update_ignores(@)
342 my @ignores;
344 foreach my $file (sort @_)
346 my %makefile = %{$makefiles{$file}};
347 my @list;
349 foreach my $src (@ignore_srcs)
351 my @pattern = @{$src};
352 next unless defined $makefile{$pattern[0]};
353 push @list, map { (my $ret = $_) =~ s/$pattern[1]$/$pattern[2]/; $ret; } @{$makefile{$pattern[0]}};
355 push @list, @{$makefile{"RC_BINARIES"}} if defined $makefile{"RC_BINARIES"};
356 foreach my $f (@list)
358 push @ignores, $makefile{"=dir"} . $f unless $f =~ /\$\(.*\)/; # skip make variables
361 return @ignores;
364 ################################################################
365 # update dlls/Makefile.in
367 sub update_dlls(@)
369 my (%directories, %testdirs, %importlibs, %static_implibs, %staticlib_dirs, %altnames);
370 my $text = "";
371 my @ignores = ();
373 foreach my $make (@_)
375 my %makefile = %{$makefiles{$make}};
376 next if defined $makefile{"=skip"};
378 if ($make =~ /dlls\/(.*)\/tests\/Makefile/)
380 $testdirs{$1} = "$1/tests";
381 (my $crosstest = $makefile{"TESTDLL"}) =~ s/\.dll$//;
382 push @ignores, $makefile{"=dir"} . $crosstest . "_crosstest.exe";
383 push @ignores, $makefile{"=dir"} . "testlist.c";
384 push @ignores, $makefile{"=dir"} . "*.ok";
385 next;
388 next unless defined $makefile{"MODULE"};
389 my $module = $makefile{"MODULE"};
390 (my $dir = $makefile{"=dir"}) =~ s/^dlls\/(.*)\//$1/;
392 if ($makefile{"=rules"} eq $makerules{"MAKE_IMPLIB_RULES"})
394 $staticlib_dirs{$module} = $dir;
395 die "invalid module $module in dir $staticlib_dirs{$module}\n" if "$staticlib_dirs{$module}" ne $module;
397 else
399 die "invalid module $module" unless $module =~ /\./;
400 (my $mod = $module) =~ s/\.dll$//;
401 die "invalid directory $dir for module $module\n" unless $mod eq $dir;
402 $directories{$module} = $dir;
405 if (defined $makefile{"IMPORTLIB"})
407 if ($makefile{"IMPORTLIB"} =~ /^([a-zA-Z0-9_.]+)/)
409 $importlibs{$module} = $1;
411 else
413 die "invalid importlib name $makefile{IMPORTLIB} in $make";
417 $static_implibs{$module} = 1 if defined $makefile{"IMPLIB_SRCS"};
419 if (defined $makefile{"SPEC_SRCS16"})
421 my @list = map { $_ =~ s/\.spec$//; $_ .= ".dll" unless $_ =~ /\./; $_; } @{$makefile{"SPEC_SRCS16"}};
422 $altnames{$module} = \@list;
424 if (defined $makefile{"EXTRA_OBJS16"})
426 foreach my $obj (@{$makefile{"EXTRA_OBJS16"}})
428 if ($obj =~ /^(.*\.(exe|mod))\.o/) { push @{$altnames{$module}}, $1; }
433 # output special dlls configure definitions
435 $text .= "# special configure-dependent targets\n\n";
436 my %specials = ();
437 foreach my $mod (sort keys %special_dlls)
439 $specials{$special_dlls{$mod}} .= " " . $mod;
441 foreach my $i (sort keys %specials)
443 $text .= $i . " =" . $specials{$i} . "\n";
445 $text .= "EXTRADIRS =";
446 foreach my $i (sort keys %specials) { $text .= sprintf " \@%s\@", $i; }
447 $text .= "\n\n";
449 # output the subdirs list
451 $text .= "# Subdir list\n\n";
452 $text .= "BASEDIRS =";
453 foreach my $dir (sort values %directories)
455 next if defined($special_dlls{$dir}); # skip special dlls
456 $text .= " \\\n\t" . $dir;
459 $text .= "\n\nIMPLIBSUBDIRS = \\\n\t";
460 $text .= join " \\\n\t", sort values %staticlib_dirs;
462 $text .= "\n\nTESTSUBDIRS = \\\n\t";
463 $text .= join " \\\n\t", sort values %testdirs;
465 $text .= "\n\nSUBDIRS = \\\n\t";
466 $text .= join " \\\n\t", "\$(BASEDIRS)", "\$(IMPLIBSUBDIRS)", "\$(TESTSUBDIRS)", sort keys %special_dlls;
468 $text .= "\n\nBUILDSUBDIRS = \$(BASEDIRS) \$(EXTRADIRS) \$(TESTSUBDIRS)\n";
469 $text .= "INSTALLSUBDIRS = \$(BASEDIRS) \$(EXTRADIRS) \$(IMPLIBSUBDIRS)\n";
470 $text .= "DOCSUBDIRS = \$(BASEDIRS) \$(EXTRADIRS)\n";
472 # output the list of 16-bit files
474 my @targets16 = ();
475 foreach my $mod (sort keys %directories)
477 next unless defined $altnames{$mod};
478 foreach my $i (sort @{$altnames{$mod}})
480 push @targets16, $i . "16";
483 $text .= "\n# 16-bit dlls\n\n";
484 $text .= "WIN16_FILES = \\\n";
485 $text .= "\t" . join( " \\\n\t", sort @targets16 ) . "\n\n";
486 $text .= "\@MAKE_RULES\@\n\n";
488 # output the all: target
490 $text .= "# Main target\n\n";
491 $text .= "all: \$(BUILDSUBDIRS) \@WIN16_FILES\@\n\n";
493 # output the lib name -> directory rules
495 $text .= "# Placeholders for 16-bit libraries\n\n";
496 foreach my $mod (sort keys %directories)
498 next unless defined $altnames{$mod};
499 $text .= sprintf "%s:\n", join(" ", map { $_ . "16"; } sort @{$altnames{$mod}});
500 $text .= sprintf "\techo \"%s\" >\$\@\n\n", $mod;
503 # output the import libraries rules
505 $text .= "# Import libraries\n\n";
506 $text .= "STATIC_IMPLIBEXT = \$(IMPLIBEXT:def=def.a)\n\n";
508 my @lib_symlinks = ();
509 foreach my $mod (sort keys %importlibs)
511 my $dir = $directories{$mod};
512 my $lib = $importlibs{$mod};
513 if ($lib ne $dir) { push @lib_symlinks, $mod; }
515 $text .= "IMPORT_SYMLINKS =";
516 foreach my $mod (sort @lib_symlinks)
518 $text .= sprintf " \\\n\tlib%s.\$(IMPLIBEXT)", $importlibs{$mod};
521 $text .= "\n\nIMPORT_LIBS = \\\n\t\$(IMPORT_SYMLINKS)";
522 foreach my $mod (sort keys %staticlib_dirs)
524 $text .= sprintf " \\\n\t%s/lib%s.a", $staticlib_dirs{$mod}, $mod;
526 foreach my $mod (sort keys %importlibs)
528 $text .= " \\\n\t$directories{$mod}/lib$importlibs{$mod}.\$(IMPLIBEXT)";
529 next unless defined $static_implibs{$mod};
530 $text .= " \\\n\t$directories{$mod}/lib$importlibs{$mod}.\$(STATIC_IMPLIBEXT)";
532 $text .= "\n\n";
533 $text .= "implib: \$(IMPORT_LIBS)\n\n";
534 $text .= ".PHONY: implib\n\n";
536 foreach my $mod (sort keys %importlibs)
538 my $dir = $directories{$mod};
539 my $lib = $importlibs{$mod};
540 my $spec = $mod;
541 $spec =~ s/\.dll$//;
542 $text .= sprintf "%s/lib%s.\$(IMPLIBEXT): %s/%s.spec \$(WINEBUILD)\n", $dir, $lib, $dir, $spec;
543 $text .= sprintf "\t\@cd %s && \$(MAKE) lib%s.\$(IMPLIBEXT)\n\n", $dir, $lib;
544 next unless $static_implibs{$mod};
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 foreach my $mod (sort @lib_symlinks)
550 my $dir = $directories{$mod};
551 my $lib = "lib" . $importlibs{$mod} . ".\$(IMPLIBEXT)";
552 $text .= sprintf "%s: %s/%s\n", $lib, $dir, $lib;
553 $text .= sprintf "\t\$(RM) \$@ && \$(LN_S) %s/%s \$@\n\n", $dir, $lib;
556 $text .= "\$(BUILDSUBDIRS): \$(IMPORT_LIBS)\n";
557 $text .= "\$(INSTALLSUBDIRS:%=%/__install__) \$(INSTALLSUBDIRS:%=%/__install-lib__): \$(IMPORT_LIBS)\n\n";
559 # output the inter-dll dependencies and rules
561 $text .= "# Map library name to the corresponding directory\n\n";
563 foreach my $mod (sort keys %staticlib_dirs)
565 $text .= sprintf "%s/lib%s.a: %s\n", $staticlib_dirs{$mod}, $mod, $staticlib_dirs{$mod};
567 $text .= "\n# Misc rules\n";
569 replace_in_file( "dlls/Makefile.in",
570 '^# special configure-dependent targets',
571 '^# Misc rules',
572 $text );
574 # .gitignore file
576 foreach my $mod (sort @lib_symlinks)
578 push @ignores, "dlls/lib$importlibs{$mod}.def";
580 foreach my $mod (sort keys %directories)
582 next unless defined $altnames{$mod};
583 push @ignores, map { "dlls/" . $_ . "16"; } @{$altnames{$mod}};
585 foreach my $mod (sort keys %importlibs)
587 push @ignores, "dlls/$directories{$mod}/lib$importlibs{$mod}.def";
590 return @ignores;
594 ################################################################
595 # update programs/Makefile.in
597 sub update_progs(@)
599 my (@subdirs, @install_subdirs, @install_progs);
601 my @ignores = ();
603 foreach my $make (@_)
605 my %makefile = %{$makefiles{$make}};
606 my $module = $makefile{"MODULE"};
607 (my $dir = $make) =~ s/^programs\/(.*)\/Makefile$/$1/;
608 die "Invalid module $module in $make" unless "$dir.exe" eq $module;
609 next if defined $makefile{"=skip"};
610 push @subdirs, $dir;
611 push @ignores, "programs/$dir/$dir";
612 push @install_subdirs, $dir unless $dont_install{$dir};
613 push @install_progs, $dir if $bin_install{$dir};
616 replace_in_file( "programs/Makefile.in", '^SUBDIRS\s*=', '^INSTALLDIRS',
617 "SUBDIRS = \\\n\t",
618 join( " \\\n\t", @subdirs ),
619 "\n\n# Sub-directories to run make install into\nINSTALLSUBDIRS = \\\n\t",
620 join( " \\\n\t", @install_subdirs ),
621 "\n\n# Programs to install in bin directory\nINSTALLPROGS = \\\n\t",
622 join( " \\\n\t", @install_progs ),
623 "\n\nINSTALLDIRS = \$(DESTDIR)\$(bindir)\n" );
625 return @ignores;
629 ################################################################
630 # update include/Makefile.in
632 sub update_includes()
634 return unless -d ".git";
635 my (@h_srcs, @idl_srcs, @tlb_srcs, %subdirs);
636 my @includes = map { s/^include\///; $_; } split /\0/, `git ls-files -c -z include`;
637 foreach my $incl (@includes)
639 if ($incl =~ /(.*)\//) { $subdirs{$1} = 1; }
640 next if ($private_headers{$incl});
641 if ($incl =~ /stdole2\.idl$/) { push @tlb_srcs, $incl; }
642 elsif ($private_idl_headers{$incl}) { push @h_srcs, $incl; }
643 elsif ($incl =~ /\.h$/) { push @h_srcs, $incl; }
644 elsif ($incl =~ /\.inl$/) { push @h_srcs, $incl; }
645 elsif ($incl =~ /\.idl$/) { push @idl_srcs, $incl; }
647 replace_in_file( "include/Makefile.in", '^IDL_H_SRCS\s*=', '^INSTALLDIRS',
648 "IDL_H_SRCS = \\\n\t",
649 join( " \\\n\t", sort @idl_srcs ),
650 "\n\nIDL_TLB_SRCS = \\\n\t",
651 join( " \\\n\t", sort @tlb_srcs ),
652 "\n\nSRCDIR_INCLUDES = \\\n\t\$(IDL_TLB_SRCS) \\\n\t\$(IDL_H_SRCS) \\\n\t",
653 join( " \\\n\t", sort @h_srcs ),
654 "\n\nEXTRASUBDIRS = ",
655 join( " ", sort keys %subdirs ),
656 "\n\nINSTALLDIRS = \\\n" );
660 ################################################################
661 # update the main .gitignore
663 sub update_gitignore(@)
665 my @ignores = values %makerules;
667 foreach my $make (@makefiles)
669 my %makefile = %{$makefiles{$make}};
670 my $dir = $makefile{"=dir"};
671 if (defined $makefile{"MANPAGES"})
673 push @ignores, map { $dir . $_; } @{$makefile{"MANPAGES"}};
675 if (defined $makefile{"PROGRAMS"})
677 push @ignores, map { s/\$\(EXEEXT\)//; $dir . $_; } @{$makefile{"PROGRAMS"}};
681 # prepend a slash to paths that don't have one
682 @ignores = map { $_ =~ s/^([^\/]+)$/\/$1/; $_; } @ignores;
684 # get rid of duplicates
685 my %ignores = ();
686 foreach my $i (@ignores, @_) { $ignores{$i} = 1; }
688 replace_in_file( ".gitignore", undef, undef,
689 "# Automatically generated by make_makefiles; DO NOT EDIT!!\n",
690 join("\n", sort keys %ignores), "\n" );
694 if (-d ".git")
696 @makefiles = map { s/\.in$//; $_; } split /\0/, `git ls-files -c -z Makefile.in \\*/Makefile.in`;
698 else
700 @makefiles = map { s/^\.\/(.*)\.in/$1/; $_; } split(/\s/,`find . -name Makefile.in -print`);
703 update_includes();
705 foreach my $file (sort values %makerules, @makefiles)
707 my %make = parse_makefile( $file );
708 $makefiles{$file} = \%make;
711 update_makefiles( @makefiles );
712 push @ignores, update_ignores( @makefiles );
713 push @ignores, update_winetest( @makefiles );
714 push @ignores, update_dlls( sort grep /^dlls\//, @makefiles );
715 push @ignores, update_progs( sort grep /^programs\/.*\/Makefile$/, @makefiles );
716 update_gitignore( @ignores );