dinput: Don't depend on the dxerr8 static library in the tests.
[wine/multimedia.git] / tools / make_makefiles
blob175c127ba6118cd20997e2760cc693d9637b21a2
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 "*.res",
72 "*.so",
73 "/autom4te.cache",
74 "/config.cache",
75 "/config.log",
76 "/config.status",
77 "/TAGS",
78 "/tags",
79 "Makefile",
80 "dlldata.c",
81 "include/config.h",
82 "include/stamp-h"
85 # Source files and their resulting target to ignore
86 my @ignore_srcs = (
87 [ 'BISON_SRCS', '\.y', '.tab.c' ],
88 [ 'BISON_SRCS', '\.y', '.tab.h' ],
89 [ 'LEX_SRCS', '\.l', '.yy.c' ],
90 [ 'MC_SRCS', '\.mc', '.mc.rc' ],
91 [ 'IDL_TLB_SRCS', '\.idl', '.tlb' ],
92 [ 'IDL_H_SRCS', '\.idl', '.h' ],
93 [ 'IDL_C_SRCS', '\.idl', '.h' ],
94 [ 'IDL_I_SRCS', '\.idl', '.h' ],
95 [ 'IDL_P_SRCS', '\.idl', '.h' ],
96 [ 'IDL_S_SRCS', '\.idl', '.h' ],
97 [ 'IDL_C_SRCS', '\.idl', '_c.c' ],
98 [ 'IDL_I_SRCS', '\.idl', '_i.c' ],
99 [ 'IDL_P_SRCS', '\.idl', '_p.c' ],
100 [ 'IDL_S_SRCS', '\.idl', '_s.c' ],
103 my %private_headers = (
104 "wine/irot.idl" => 1,
105 "wine/list.h" => 1,
106 "wine/mmsystem16.h" => 1,
107 "wine/mscvpdb.h" => 1,
108 "wine/port.h" => 1,
109 "wine/pthread.h" => 1,
110 "wine/rpcfc.h" => 1,
111 "wine/server.h" => 1,
112 "wine/server_protocol.h" => 1,
113 "wine/test.h" => 1,
114 "wine/wgl.h" => 1,
115 "wine/winaspi.h" => 1,
116 "wine/winbase16.h" => 1,
117 "wine/windef16.h" => 1,
118 "wine/wined3d_caps.h" => 1,
119 "wine/wined3d_gl.h" => 1,
120 "wine/wined3d_interface.h" => 1,
121 "wine/wined3d_types.h" => 1,
122 "wine/wingdi16.h" => 1,
123 "wine/winnet16.h" => 1,
124 "wine/winsock16.h" => 1,
125 "wine/winuser16.h" => 1,
126 "wine/wpp.h" => 1
129 my %private_idl_headers = (
130 "axcore.idl" => 1,
131 "axextend.idl" => 1,
132 "dbinit.idl" => 1,
133 "dbprop.idl" => 1,
134 "dbs.idl" => 1,
135 "devenum.idl" => 1,
136 "dyngraph.idl" => 1
139 my (@makefiles, %makefiles);
141 # update a file if changed
142 sub update_file($)
144 my $file = shift;
145 my $ret = !(-f $file) || system "cmp $file $file.new >/dev/null";
146 if (!$ret)
148 unlink "$file.new";
150 else
152 rename "$file.new", "$file";
153 print "$file updated\n";
154 if ($file eq "configure.ac")
156 system "autoconf";
157 print "configure updated\n";
160 return $ret;
163 # replace some lines in a file between two markers
164 sub replace_in_file($$$@)
166 my $file = shift;
167 my $start = shift;
168 my $end = shift;
170 open NEW_FILE, ">$file.new" or die "cannot create $file.new";
172 if (defined($start))
174 open OLD_FILE, "$file" or die "cannot open $file";
175 while (<OLD_FILE>)
177 last if /$start/;
178 print NEW_FILE $_;
182 print NEW_FILE @_;
184 if (defined($end))
186 my $skip=1;
187 while (<OLD_FILE>)
189 print NEW_FILE $_ unless $skip;
190 $skip = 0 if /$end/;
194 close OLD_FILE if defined($start);
195 close NEW_FILE;
196 return update_file($file);
199 # parse the specified makefile to identify the rules file
200 sub parse_makefile($)
202 my $file = shift;
203 my %make;
205 ($make{"=dir"} = $file) =~ s/[^\/]+$//;
207 open MAKE, "$file.in" or die "cannot open $file.in\n";
209 while (<MAKE>)
211 chomp;
212 while (/\\$/) { chop; $_ .= <MAKE>; chomp; } # merge continued lines
214 if (/^\@(MAKE.*RULES)\@/)
216 my $var = $1;
217 $make{"=rules"} = $makerules{$var};
218 next;
220 if (/^(MODULE|IMPORTLIB|TESTDLL)\s*=\s*(.*)/)
222 $make{$1} = $2;
223 next;
225 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*(.*)/)
227 my @list = split(/\s+/, $2);
228 $make{$1} = \@list;
229 next;
231 if (/^\#\s*MKDLL_SKIP/ || /^\#\s*MKPROG_SKIP/)
233 $make{"=skip"} = 1;
234 next;
237 return %make;
241 ################################################################
242 # update the makefile list in configure.ac
244 sub update_makerules(@)
249 ################################################################
250 # update the tests list in programs/winetest/Makefile.in and programs/winetest/winetest.rc
252 sub update_winetest(@)
254 my (@tests, @lines);
256 foreach my $file (@_)
258 if ($file =~ /^dlls\/(.*)\/tests\/Makefile/) { push @tests, $1; }
260 push @lines, "TESTBINS =";
261 push @lines, map { " \\\n\t" . $_ . "_test.exe"; } sort @tests;
262 push @lines, "\n\n";
264 foreach my $test (sort @tests)
266 push @lines, "${test}_test.exe: \$(DLLDIR)/$test/tests/${test}_test.exe\$(DLLEXT)\n";
267 push @lines, "\tcp \$(DLLDIR)/$test/tests/${test}_test.exe\$(DLLEXT) \$\@ && \$(STRIP) \$\@\n";
269 push @lines, "\n# Special rules\n";
271 replace_in_file( "programs/winetest/Makefile.in", '^TESTBINS\s*=', '^# Special rules', @lines );
273 replace_in_file( "programs/winetest/winetest.rc", ' TESTRES ', undef,
274 map { $_ . "_test.exe TESTRES \"" . $_ . "_test.exe\"\n"; } sort @tests );
276 # return a list of test exe files for .gitignore
277 return map { "programs/winetest/" . $_ . "_test.exe"; } sort @tests;
281 ################################################################
282 # update the makefile list in configure.ac and Makefile.in
284 sub update_makefiles(@)
286 my (@targets, @depends, @lines);
288 foreach my $var (sort { $makerules{$a} cmp $makerules{$b}; } keys %makerules)
290 push @lines, "$var=$makerules{$var}\n";
291 push @lines, "AC_SUBST_FILE($var)\n\n";
294 foreach my $var ((sort values %makerules), (sort @_))
296 push @lines, "AC_CONFIG_FILES([$var])\n";
299 push @lines, "\nAC_OUTPUT\n";
300 replace_in_file( "configure.ac", '^MAKE_RULES', '^AC_OUTPUT$', @lines);
302 foreach my $file (sort values %makerules)
304 push @targets, $file;
305 my %make = %{$makefiles{$file}};
306 if (!defined($make{"=rules"})) { push @depends, "$file: $file.in"; }
307 else { push @depends, "$file: $file.in Make.rules"; }
310 foreach my $file (sort @_)
312 push @targets, $file unless $file eq "Makefile";
313 my %makefile = %{$makefiles{$file}};
314 my $dep = $makefile{"=rules"};
315 push @depends, "$file: $file.in $dep";
319 @lines = ();
320 push @lines, "ALL_MAKEFILES = \\\n\t";
321 push @lines, join (" \\\n\t", @targets ), "\n\n";
322 push @lines, "Makefile \$(ALL_MAKEFILES): config.status\n";
323 push @lines, "\t\@./config.status \$\@\n";
324 push @lines, ".INIT: Makefile\n";
325 push @lines, ".BEGIN: Makefile\n\n";
326 push @lines, "\$(RECURSE_TARGETS) \$(MAKEDEP): \$(ALL_MAKEFILES)\n\n";
327 push @lines, "distclean::\n";
328 push @lines, "\t\$(RM) Makefile \$(ALL_MAKEFILES)\n\n";
329 push @lines, join ("\n", @depends ), "\n";
331 replace_in_file( "Makefile.in", '^ALL_MAKEFILES\s*=', undef, @lines );
335 ################################################################
336 # process ignore targets for generic source files
338 sub update_ignores(@)
340 my @ignores;
342 foreach my $file (sort @_)
344 my %makefile = %{$makefiles{$file}};
345 my @list;
347 foreach my $src (@ignore_srcs)
349 my @pattern = @{$src};
350 next unless defined $makefile{$pattern[0]};
351 push @list, map { (my $ret = $_) =~ s/$pattern[1]$/$pattern[2]/; $ret; } @{$makefile{$pattern[0]}};
353 push @list, @{$makefile{"RC_BINARIES"}} if defined $makefile{"RC_BINARIES"};
354 foreach my $f (@list)
356 push @ignores, $makefile{"=dir"} . $f unless $f =~ /\$\(.*\)/; # skip make variables
359 return @ignores;
362 ################################################################
363 # update dlls/Makefile.in
365 sub update_dlls(@)
367 my (%directories, %testdirs, %importlibs, %static_implibs, %staticlib_dirs, %altnames);
368 my $text = "";
369 my @ignores = ();
371 foreach my $make (@_)
373 my %makefile = %{$makefiles{$make}};
374 next if defined $makefile{"=skip"};
376 if ($make =~ /dlls\/(.*)\/tests\/Makefile/)
378 $testdirs{$1} = "$1/tests";
379 (my $crosstest = $makefile{"TESTDLL"}) =~ s/\.dll$//;
380 push @ignores, $makefile{"=dir"} . $crosstest . "_crosstest.exe";
381 push @ignores, $makefile{"=dir"} . "testlist.c";
382 push @ignores, $makefile{"=dir"} . "*.ok";
383 next;
386 next unless defined $makefile{"MODULE"};
387 my $module = $makefile{"MODULE"};
388 (my $dir = $makefile{"=dir"}) =~ s/^dlls\/(.*)\//$1/;
390 if ($makefile{"=rules"} eq $makerules{"MAKE_IMPLIB_RULES"})
392 $staticlib_dirs{$module} = $dir;
393 die "invalid module $module in dir $staticlib_dirs{$module}\n" if "$staticlib_dirs{$module}" ne $module;
395 else
397 die "invalid module $module" unless $module =~ /\./;
398 (my $mod = $module) =~ s/\.dll$//;
399 die "invalid directory $dir for module $module\n" unless $mod eq $dir;
400 $directories{$module} = $dir;
403 if (defined $makefile{"IMPORTLIB"})
405 if ($makefile{"IMPORTLIB"} =~ /^([a-zA-Z0-9_.]+)/)
407 $importlibs{$module} = $1;
409 else
411 die "invalid importlib name $makefile{IMPORTLIB} in $make";
415 $static_implibs{$module} = 1 if defined $makefile{"IMPLIB_SRCS"};
417 if (defined $makefile{"SPEC_SRCS16"})
419 my @list = map { $_ =~ s/\.spec$//; $_ .= ".dll" unless $_ =~ /\./; $_; } @{$makefile{"SPEC_SRCS16"}};
420 $altnames{$module} = \@list;
422 if (defined $makefile{"EXTRA_OBJS16"})
424 foreach my $obj (@{$makefile{"EXTRA_OBJS16"}})
426 if ($obj =~ /^(.*\.(exe|mod))\.o/) { push @{$altnames{$module}}, $1; }
431 # output special dlls configure definitions
433 $text .= "# special configure-dependent targets\n\n";
434 my %specials = ();
435 foreach my $mod (sort keys %special_dlls)
437 $specials{$special_dlls{$mod}} .= " " . $mod;
439 foreach my $i (sort keys %specials)
441 $text .= $i . " =" . $specials{$i} . "\n";
443 $text .= "EXTRADIRS =";
444 foreach my $i (sort keys %specials) { $text .= sprintf " \@%s\@", $i; }
445 $text .= "\n\n";
447 # output the subdirs list
449 $text .= "# Subdir list\n\n";
450 $text .= "BASEDIRS =";
451 foreach my $dir (sort values %directories)
453 next if defined($special_dlls{$dir}); # skip special dlls
454 $text .= " \\\n\t" . $dir;
457 $text .= "\n\nIMPLIBSUBDIRS = \\\n\t";
458 $text .= join " \\\n\t", sort values %staticlib_dirs;
460 $text .= "\n\nTESTSUBDIRS = \\\n\t";
461 $text .= join " \\\n\t", sort values %testdirs;
463 $text .= "\n\nSUBDIRS = \\\n\t";
464 $text .= join " \\\n\t", "\$(BASEDIRS)", "\$(IMPLIBSUBDIRS)", "\$(TESTSUBDIRS)", sort keys %special_dlls;
466 $text .= "\n\nBUILDSUBDIRS = \$(BASEDIRS) \$(EXTRADIRS) \$(TESTSUBDIRS)\n";
467 $text .= "INSTALLSUBDIRS = \$(BASEDIRS) \$(EXTRADIRS) \$(IMPLIBSUBDIRS)\n";
468 $text .= "DOCSUBDIRS = \$(BASEDIRS) \$(EXTRADIRS)\n";
470 # output the list of 16-bit files
472 my @targets16 = ();
473 foreach my $mod (sort keys %directories)
475 next unless defined $altnames{$mod};
476 foreach my $i (sort @{$altnames{$mod}})
478 push @targets16, $i . "16";
481 $text .= "\n# 16-bit dlls\n\n";
482 $text .= "WIN16_FILES = \\\n";
483 $text .= "\t" . join( " \\\n\t", sort @targets16 ) . "\n\n";
484 $text .= "\@MAKE_RULES\@\n\n";
486 # output the all: target
488 $text .= "# Main target\n\n";
489 $text .= "all: \$(BUILDSUBDIRS) \@WIN16_FILES\@\n\n";
491 # output the lib name -> directory rules
493 $text .= "# Placeholders for 16-bit libraries\n\n";
494 foreach my $mod (sort keys %directories)
496 next unless defined $altnames{$mod};
497 $text .= sprintf "%s:\n", join(" ", map { $_ . "16"; } sort @{$altnames{$mod}});
498 $text .= sprintf "\techo \"%s\" >\$\@\n\n", $mod;
501 # output the import libraries rules
503 $text .= "# Import libraries\n\n";
504 $text .= "STATIC_IMPLIBEXT = \$(IMPLIBEXT:def=def.a)\n\n";
506 my @lib_symlinks = ();
507 foreach my $mod (sort keys %importlibs)
509 my $dir = $directories{$mod};
510 my $lib = $importlibs{$mod};
511 if ($lib ne $dir) { push @lib_symlinks, $mod; }
513 $text .= "IMPORT_SYMLINKS =";
514 foreach my $mod (sort @lib_symlinks)
516 $text .= sprintf " \\\n\tlib%s.\$(IMPLIBEXT)", $importlibs{$mod};
519 $text .= "\n\nIMPORT_LIBS = \\\n\t\$(IMPORT_SYMLINKS)";
520 foreach my $mod (sort keys %staticlib_dirs)
522 $text .= sprintf " \\\n\t%s/lib%s.a", $staticlib_dirs{$mod}, $mod;
524 foreach my $mod (sort keys %importlibs)
526 $text .= " \\\n\t$directories{$mod}/lib$importlibs{$mod}.\$(IMPLIBEXT)";
527 next unless defined $static_implibs{$mod};
528 $text .= " \\\n\t$directories{$mod}/lib$importlibs{$mod}.\$(STATIC_IMPLIBEXT)";
530 $text .= "\n\n";
531 $text .= "implib: \$(IMPORT_LIBS)\n\n";
532 $text .= ".PHONY: implib\n\n";
534 foreach my $mod (sort keys %importlibs)
536 my $dir = $directories{$mod};
537 my $lib = $importlibs{$mod};
538 my $spec = $mod;
539 $spec =~ s/\.dll$//;
540 if (defined($static_implibs{$mod}))
542 $text .= sprintf "%s/lib%s.def: %s/%s.spec \$(WINEBUILD)\n", $dir, $lib, $dir, $spec;
543 $text .= sprintf "\t\@cd %s && \$(MAKE) lib%s.def\n\n", $dir, $lib;
544 $text .= sprintf "%s/lib%s.\$(STATIC_IMPLIBEXT): dummy\n", $dir, $lib, $dir, $spec;
545 $text .= sprintf "\t\@cd %s && \$(MAKE) lib%s.\$(STATIC_IMPLIBEXT)\n\n", $dir, $lib;
547 else
549 $text .= sprintf "%s/lib%s.\$(IMPLIBEXT): %s/%s.spec \$(WINEBUILD)\n", $dir, $lib, $dir, $spec;
550 $text .= sprintf "\t\@cd %s && \$(MAKE) lib%s.\$(IMPLIBEXT)\n\n", $dir, $lib;
553 foreach my $mod (sort @lib_symlinks)
555 my $dir = $directories{$mod};
556 my $lib = "lib" . $importlibs{$mod} . ".\$(IMPLIBEXT)";
557 $text .= sprintf "%s: %s/%s\n", $lib, $dir, $lib;
558 $text .= sprintf "\t\$(RM) \$@ && \$(LN_S) %s/%s \$@\n\n", $dir, $lib;
561 $text .= "\$(BUILDSUBDIRS): \$(IMPORT_LIBS)\n";
562 $text .= "\$(INSTALLSUBDIRS:%=%/__install__) \$(INSTALLSUBDIRS:%=%/__install-lib__): \$(IMPORT_LIBS)\n\n";
564 # output the inter-dll dependencies and rules
566 $text .= "# Map library name to the corresponding directory\n\n";
568 foreach my $mod (sort keys %staticlib_dirs)
570 $text .= sprintf "%s/lib%s.a: %s\n", $staticlib_dirs{$mod}, $mod, $staticlib_dirs{$mod};
572 $text .= "\n# Misc rules\n";
574 replace_in_file( "dlls/Makefile.in",
575 '^# special configure-dependent targets',
576 '^# Misc rules',
577 $text );
579 # .gitignore file
581 foreach my $mod (sort @lib_symlinks)
583 push @ignores, "dlls/lib$importlibs{$mod}.def";
585 foreach my $mod (sort keys %directories)
587 next unless defined $altnames{$mod};
588 push @ignores, map { "dlls/" . $_ . "16"; } @{$altnames{$mod}};
590 foreach my $mod (sort keys %importlibs)
592 push @ignores, "dlls/$directories{$mod}/lib$importlibs{$mod}.def";
595 return @ignores;
599 ################################################################
600 # update programs/Makefile.in
602 sub update_progs(@)
604 my (@subdirs, @install_subdirs, @install_progs);
606 my @ignores = ();
608 foreach my $make (@_)
610 my %makefile = %{$makefiles{$make}};
611 my $module = $makefile{"MODULE"};
612 (my $dir = $make) =~ s/^programs\/(.*)\/Makefile$/$1/;
613 die "Invalid module $module in $make" unless "$dir.exe" eq $module;
614 next if defined $makefile{"=skip"};
615 push @subdirs, $dir;
616 push @ignores, "programs/$dir/$dir";
617 push @install_subdirs, $dir unless $dont_install{$dir};
618 push @install_progs, $dir if $bin_install{$dir};
621 replace_in_file( "programs/Makefile.in", '^SUBDIRS\s*=', '^INSTALLDIRS',
622 "SUBDIRS = \\\n\t",
623 join( " \\\n\t", @subdirs ),
624 "\n\n# Sub-directories to run make install into\nINSTALLSUBDIRS = \\\n\t",
625 join( " \\\n\t", @install_subdirs ),
626 "\n\n# Programs to install in bin directory\nINSTALLPROGS = \\\n\t",
627 join( " \\\n\t", @install_progs ),
628 "\n\nINSTALLDIRS = \$(DESTDIR)\$(bindir)\n" );
630 return @ignores;
634 ################################################################
635 # update include/Makefile.in
637 sub update_includes()
639 return unless -d ".git";
640 my (@h_srcs, @idl_srcs, @tlb_srcs, %subdirs);
641 my @includes = map { s/^include\///; $_; } split /\0/, `git ls-files -c -z include`;
642 foreach my $incl (@includes)
644 if ($incl =~ /(.*)\//) { $subdirs{$1} = 1; }
645 next if ($private_headers{$incl});
646 if ($incl =~ /stdole2\.idl$/) { push @tlb_srcs, $incl; }
647 elsif ($private_idl_headers{$incl}) { push @h_srcs, $incl; }
648 elsif ($incl =~ /\.h$/) { push @h_srcs, $incl; }
649 elsif ($incl =~ /\.inl$/) { push @h_srcs, $incl; }
650 elsif ($incl =~ /\.idl$/) { push @idl_srcs, $incl; }
652 replace_in_file( "include/Makefile.in", '^IDL_H_SRCS\s*=', '^INSTALLDIRS',
653 "IDL_H_SRCS = \\\n\t",
654 join( " \\\n\t", sort @idl_srcs ),
655 "\n\nIDL_TLB_SRCS = \\\n\t",
656 join( " \\\n\t", sort @tlb_srcs ),
657 "\n\nSRCDIR_INCLUDES = \\\n\t\$(IDL_TLB_SRCS) \\\n\t\$(IDL_H_SRCS) \\\n\t",
658 join( " \\\n\t", sort @h_srcs ),
659 "\n\nEXTRASUBDIRS = ",
660 join( " ", sort keys %subdirs ),
661 "\n\nINSTALLDIRS = \\\n" );
665 ################################################################
666 # update the main .gitignore
668 sub update_gitignore(@)
670 my @ignores = values %makerules;
672 foreach my $make (@makefiles)
674 my %makefile = %{$makefiles{$make}};
675 my $dir = $makefile{"=dir"};
676 if (defined $makefile{"MANPAGES"})
678 push @ignores, map { $dir . $_; } @{$makefile{"MANPAGES"}};
680 if (defined $makefile{"PROGRAMS"})
682 push @ignores, map { s/\$\(EXEEXT\)//; $dir . $_; } @{$makefile{"PROGRAMS"}};
686 # prepend a slash to paths that don't have one
687 @ignores = map { $_ =~ s/^([^\/]+)$/\/$1/; $_; } @ignores;
689 # get rid of duplicates
690 my %ignores = ();
691 foreach my $i (@ignores, @_) { $ignores{$i} = 1; }
693 replace_in_file( ".gitignore", undef, undef,
694 "# Automatically generated by make_makefiles; DO NOT EDIT!!\n",
695 join("\n", sort keys %ignores), "\n" );
699 if (-d ".git")
701 @makefiles = map { s/\.in$//; $_; } split /\0/, `git ls-files -c -z Makefile.in \\*/Makefile.in`;
703 else
705 @makefiles = map { s/^\.\/(.*)\.in/$1/; $_; } split(/\s/,`find . -name Makefile.in -print`);
708 update_includes();
710 foreach my $file (sort values %makerules, @makefiles)
712 my %make = parse_makefile( $file );
713 $makefiles{$file} = \%make;
716 update_makefiles( @makefiles );
717 push @ignores, update_ignores( @makefiles );
718 push @ignores, update_winetest( @makefiles );
719 push @ignores, update_dlls( sort grep /^dlls\//, @makefiles );
720 push @ignores, update_progs( sort grep /^programs\/.*\/Makefile$/, @makefiles );
721 update_gitignore( @ignores );