shell32: Fix the Chinese translations.
[wine.git] / tools / make_makefiles
blobbb492638da7cb7471e062b4f2ae2ccec1a0f4887
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/rpcss_shared.h" => 1,
112 "wine/server.h" => 1,
113 "wine/server_protocol.h" => 1,
114 "wine/test.h" => 1,
115 "wine/wgl.h" => 1,
116 "wine/winaspi.h" => 1,
117 "wine/winbase16.h" => 1,
118 "wine/windef16.h" => 1,
119 "wine/wined3d_caps.h" => 1,
120 "wine/wined3d_gl.h" => 1,
121 "wine/wined3d_interface.h" => 1,
122 "wine/wined3d_types.h" => 1,
123 "wine/wingdi16.h" => 1,
124 "wine/winnet16.h" => 1,
125 "wine/winsock16.h" => 1,
126 "wine/winuser16.h" => 1,
127 "wine/wpp.h" => 1
130 my %private_idl_headers = (
131 "axcore.idl" => 1,
132 "axextend.idl" => 1,
133 "dbinit.idl" => 1,
134 "dbprop.idl" => 1,
135 "dbs.idl" => 1,
136 "devenum.idl" => 1,
137 "dyngraph.idl" => 1
140 my (@makefiles, %makefiles);
142 # update a file if changed
143 sub update_file($)
145 my $file = shift;
146 my $ret = !(-f $file) || system "cmp $file $file.new >/dev/null";
147 if (!$ret)
149 unlink "$file.new";
151 else
153 rename "$file.new", "$file";
154 print "$file updated\n";
155 if ($file eq "configure.ac")
157 system "autoconf";
158 print "configure updated\n";
161 return $ret;
164 # replace some lines in a file between two markers
165 sub replace_in_file($$$@)
167 my $file = shift;
168 my $start = shift;
169 my $end = shift;
171 open NEW_FILE, ">$file.new" or die "cannot create $file.new";
173 if (defined($start))
175 open OLD_FILE, "$file" or die "cannot open $file";
176 while (<OLD_FILE>)
178 last if /$start/;
179 print NEW_FILE $_;
183 print NEW_FILE @_;
185 if (defined($end))
187 my $skip=1;
188 while (<OLD_FILE>)
190 print NEW_FILE $_ unless $skip;
191 $skip = 0 if /$end/;
195 close OLD_FILE if defined($start);
196 close NEW_FILE;
197 return update_file($file);
200 # parse the specified makefile to identify the rules file
201 sub parse_makefile($)
203 my $file = shift;
204 my %make;
206 ($make{"=dir"} = $file) =~ s/[^\/]+$//;
208 open MAKE, "$file.in" or die "cannot open $file.in\n";
210 while (<MAKE>)
212 chomp;
213 while (/\\$/) { chop; $_ .= <MAKE>; chomp; } # merge continued lines
215 if (/^\@(MAKE.*RULES)\@/)
217 my $var = $1;
218 $make{"=rules"} = $makerules{$var};
219 next;
221 if (/^(MODULE|IMPORTLIB|TESTDLL)\s*=\s*(.*)/)
223 $make{$1} = $2;
224 next;
226 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*(.*)/)
228 my @list = split(/\s+/, $2);
229 $make{$1} = \@list;
230 next;
232 if (/^\#\s*MKDLL_SKIP/ || /^\#\s*MKPROG_SKIP/)
234 $make{"=skip"} = 1;
235 next;
238 return %make;
242 ################################################################
243 # update the makefile list in configure.ac
245 sub update_makerules(@)
250 ################################################################
251 # update the tests list in programs/winetest/Makefile.in and programs/winetest/winetest.rc
253 sub update_winetest(@)
255 my (@tests, @lines);
257 foreach my $file (@_)
259 if ($file =~ /^dlls\/(.*)\/tests\/Makefile/) { push @tests, $1; }
261 push @lines, "TESTBINS =";
262 push @lines, map { " \\\n\t" . $_ . "_test.exe"; } sort @tests;
263 push @lines, "\n\n";
265 foreach my $test (sort @tests)
267 push @lines, "${test}_test.exe: \$(DLLDIR)/$test/tests/${test}_test.exe\$(DLLEXT)\n";
268 push @lines, "\tcp \$(DLLDIR)/$test/tests/${test}_test.exe\$(DLLEXT) \$\@ && \$(STRIP) \$\@\n";
270 push @lines, "\n# Special rules\n";
272 replace_in_file( "programs/winetest/Makefile.in", '^TESTBINS\s*=', '^# Special rules', @lines );
274 replace_in_file( "programs/winetest/winetest.rc", ' TESTRES ', undef,
275 map { $_ . "_test.exe TESTRES \"" . $_ . "_test.exe\"\n"; } sort @tests );
277 # return a list of test exe files for .gitignore
278 return map { "programs/winetest/" . $_ . "_test.exe"; } sort @tests;
282 ################################################################
283 # update the makefile list in configure.ac and Makefile.in
285 sub update_makefiles(@)
287 my (@targets, @depends, @lines);
289 foreach my $var (sort { $makerules{$a} cmp $makerules{$b}; } keys %makerules)
291 push @lines, "$var=$makerules{$var}\n";
292 push @lines, "AC_SUBST_FILE($var)\n\n";
295 foreach my $var ((sort values %makerules), (sort @_))
297 push @lines, "AC_CONFIG_FILES([$var])\n";
300 push @lines, "\nAC_OUTPUT\n";
301 replace_in_file( "configure.ac", '^MAKE_RULES', '^AC_OUTPUT$', @lines);
303 foreach my $file (sort values %makerules)
305 push @targets, $file;
306 my %make = %{$makefiles{$file}};
307 if (!defined($make{"=rules"})) { push @depends, "$file: $file.in"; }
308 else { push @depends, "$file: $file.in Make.rules"; }
311 foreach my $file (sort @_)
313 push @targets, $file unless $file eq "Makefile";
314 my %makefile = %{$makefiles{$file}};
315 my $dep = $makefile{"=rules"};
316 push @depends, "$file: $file.in $dep";
320 @lines = ();
321 push @lines, "ALL_MAKEFILES = \\\n\t";
322 push @lines, join (" \\\n\t", @targets ), "\n\n";
323 push @lines, "Makefile \$(ALL_MAKEFILES): config.status\n";
324 push @lines, "\t\@./config.status \$\@\n";
325 push @lines, ".INIT: Makefile\n";
326 push @lines, ".BEGIN: Makefile\n\n";
327 push @lines, "\$(RECURSE_TARGETS) \$(MAKEDEP): \$(ALL_MAKEFILES)\n\n";
328 push @lines, "distclean::\n";
329 push @lines, "\t\$(RM) Makefile \$(ALL_MAKEFILES)\n\n";
330 push @lines, join ("\n", @depends ), "\n";
332 replace_in_file( "Makefile.in", '^ALL_MAKEFILES\s*=', undef, @lines );
336 ################################################################
337 # process ignore targets for generic source files
339 sub update_ignores(@)
341 my @ignores;
343 foreach my $file (sort @_)
345 my %makefile = %{$makefiles{$file}};
346 my @list;
348 foreach my $src (@ignore_srcs)
350 my @pattern = @{$src};
351 next unless defined $makefile{$pattern[0]};
352 push @list, map { (my $ret = $_) =~ s/$pattern[1]$/$pattern[2]/; $ret; } @{$makefile{$pattern[0]}};
354 push @list, @{$makefile{"RC_BINARIES"}} if defined $makefile{"RC_BINARIES"};
355 foreach my $f (@list)
357 push @ignores, $makefile{"=dir"} . $f unless $f =~ /\$\(.*\)/; # skip make variables
360 return @ignores;
363 ################################################################
364 # update dlls/Makefile.in
366 sub update_dlls(@)
368 my (%directories, %testdirs, %importlibs, %static_implibs, %staticlib_dirs, %altnames);
369 my $text = "";
370 my @ignores = ();
372 foreach my $make (@_)
374 my %makefile = %{$makefiles{$make}};
375 next if defined $makefile{"=skip"};
377 if ($make =~ /dlls\/(.*)\/tests\/Makefile/)
379 $testdirs{$1} = "$1/tests";
380 (my $crosstest = $makefile{"TESTDLL"}) =~ s/\.dll$//;
381 push @ignores, $makefile{"=dir"} . $crosstest . "_crosstest.exe";
382 push @ignores, $makefile{"=dir"} . "testlist.c";
383 push @ignores, $makefile{"=dir"} . "*.ok";
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}};
591 foreach my $mod (sort keys %importlibs)
593 push @ignores, "dlls/$directories{$mod}/lib$importlibs{$mod}.def";
596 return @ignores;
600 ################################################################
601 # update programs/Makefile.in
603 sub update_progs(@)
605 my (@subdirs, @install_subdirs, @install_progs);
607 my @ignores = ();
609 foreach my $make (@_)
611 my %makefile = %{$makefiles{$make}};
612 my $module = $makefile{"MODULE"};
613 (my $dir = $make) =~ s/^programs\/(.*)\/Makefile$/$1/;
614 die "Invalid module $module in $make" unless "$dir.exe" eq $module;
615 next if defined $makefile{"=skip"};
616 push @subdirs, $dir;
617 push @ignores, "programs/$dir/$dir";
618 push @install_subdirs, $dir unless $dont_install{$dir};
619 push @install_progs, $dir if $bin_install{$dir};
622 replace_in_file( "programs/Makefile.in", '^SUBDIRS\s*=', '^INSTALLDIRS',
623 "SUBDIRS = \\\n\t",
624 join( " \\\n\t", @subdirs ),
625 "\n\n# Sub-directories to run make install into\nINSTALLSUBDIRS = \\\n\t",
626 join( " \\\n\t", @install_subdirs ),
627 "\n\n# Programs to install in bin directory\nINSTALLPROGS = \\\n\t",
628 join( " \\\n\t", @install_progs ),
629 "\n\nINSTALLDIRS = \$(DESTDIR)\$(bindir)\n" );
631 return @ignores;
635 ################################################################
636 # update include/Makefile.in
638 sub update_includes()
640 return unless -d ".git";
641 my (@h_srcs, @idl_srcs, @tlb_srcs, %subdirs);
642 my @includes = map { s/^include\///; $_; } split /\0/, `git ls-files -c -z include`;
643 foreach my $incl (@includes)
645 if ($incl =~ /(.*)\//) { $subdirs{$1} = 1; }
646 next if ($private_headers{$incl});
647 if ($incl =~ /stdole2\.idl$/) { push @tlb_srcs, $incl; }
648 elsif ($private_idl_headers{$incl}) { push @h_srcs, $incl; }
649 elsif ($incl =~ /\.h$/) { push @h_srcs, $incl; }
650 elsif ($incl =~ /\.inl$/) { push @h_srcs, $incl; }
651 elsif ($incl =~ /\.idl$/) { push @idl_srcs, $incl; }
653 replace_in_file( "include/Makefile.in", '^IDL_H_SRCS\s*=', '^INSTALLDIRS',
654 "IDL_H_SRCS = \\\n\t",
655 join( " \\\n\t", sort @idl_srcs ),
656 "\n\nIDL_TLB_SRCS = \\\n\t",
657 join( " \\\n\t", sort @tlb_srcs ),
658 "\n\nSRCDIR_INCLUDES = \\\n\t\$(IDL_TLB_SRCS) \\\n\t\$(IDL_H_SRCS) \\\n\t",
659 join( " \\\n\t", sort @h_srcs ),
660 "\n\nEXTRASUBDIRS = ",
661 join( " ", sort keys %subdirs ),
662 "\n\nINSTALLDIRS = \\\n" );
666 ################################################################
667 # update the main .gitignore
669 sub update_gitignore(@)
671 my @ignores = values %makerules;
673 foreach my $make (@makefiles)
675 my %makefile = %{$makefiles{$make}};
676 my $dir = $makefile{"=dir"};
677 if (defined $makefile{"MANPAGES"})
679 push @ignores, map { $dir . $_; } @{$makefile{"MANPAGES"}};
681 if (defined $makefile{"PROGRAMS"})
683 push @ignores, map { s/\$\(EXEEXT\)//; $dir . $_; } @{$makefile{"PROGRAMS"}};
687 # prepend a slash to paths that don't have one
688 @ignores = map { $_ =~ s/^([^\/]+)$/\/$1/; $_; } @ignores;
690 # get rid of duplicates
691 my %ignores = ();
692 foreach my $i (@ignores, @_) { $ignores{$i} = 1; }
694 replace_in_file( ".gitignore", undef, undef,
695 "# Automatically generated by make_makefiles; DO NOT EDIT!!\n",
696 join("\n", sort keys %ignores), "\n" );
700 if (-d ".git")
702 @makefiles = map { s/\.in$//; $_; } split /\0/, `git ls-files -c -z Makefile.in \\*/Makefile.in`;
704 else
706 @makefiles = map { s/^\.\/(.*)\.in/$1/; $_; } split(/\s/,`find . -name Makefile.in -print`);
709 update_includes();
711 foreach my $file (sort values %makerules, @makefiles)
713 my %make = parse_makefile( $file );
714 $makefiles{$file} = \%make;
717 update_makefiles( @makefiles );
718 push @ignores, update_ignores( @makefiles );
719 push @ignores, update_winetest( @makefiles );
720 push @ignores, update_dlls( sort grep /^dlls\//, @makefiles );
721 push @ignores, update_progs( sort grep /^programs\/.*\/Makefile$/, @makefiles );
722 update_gitignore( @ignores );