1 #!/usr/bin/perl -w
2 #
3 # Build the auto-generated parts of the Wine makefiles.
4 #
5 # Copyright 2006 Alexandre Julliard
6 #
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.
11 #
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.
16 #
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
20 #
21
22 # Make rules files
23 my %makerules =
24 (
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",
30 );
31
32 # Programs that we want to install in the bin directory too
33 my %bin_install =
34 (
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 );
50
51 # Programs that we don't want to install at all
52 my %dont_install =
53 (
54 "cmdlgtst" => 1,
55 "view" => 1,
56 "winetest" => 1,
57 );
58
59 # Special dlls that can be switched on or off by configure
60 my %special_dlls =
61 (
62 "glu32" => "GLU32FILES",
63 "opengl32" => "OPENGLFILES",
64 "winex11.drv" => "XFILES",
65 "winequartz.drv" => "QUARTZFILES"
66 );
67
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"
87 );
88
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' ],
105 );
106
107 my %exported_wine_headers = (
108 "wine/debug.h" => 1,
109 "wine/exception.h" => 1,
110 "wine/library.h" => 1,
111 "wine/unicode.h" => 1,
112 "wine/itss.idl" => 1,
113 "wine/svcctl.idl" => 1,
114 );
115
116 my %private_idl_headers = (
117 "axcore.idl" => 1,
118 "axextend.idl" => 1,
119 "dbinit.idl" => 1,
120 "dbprop.idl" => 1,
121 "dbs.idl" => 1,
122 "devenum.idl" => 1,
123 "dyngraph.idl" => 1,
124 "vmrender.idl" => 1,
125 );
126
127 my (@makefiles, %makefiles);
128
129 # update a file if changed
130 sub update_file($)
131 {
132 my $file = shift;
133 my $ret = !(-f $file) || system "cmp $file $file.new >/dev/null";
134 if (!$ret)
135 {
136 unlink "$file.new";
137 }
138 else
139 {
140 rename "$file.new", "$file";
141 print "$file updated\n";
142 if ($file eq "configure.ac")
143 {
144 system "autoconf";
145 print "configure updated\n";
146 }
147 }
148 return $ret;
149 }
150
151 # replace some lines in a file between two markers
152 sub replace_in_file($$$@)
153 {
154 my $file = shift;
155 my $start = shift;
156 my $end = shift;
157
158 open NEW_FILE, ">$file.new" or die "cannot create $file.new";
159
160 if (defined($start))
161 {
162 open OLD_FILE, "$file" or die "cannot open $file";
163 while (<OLD_FILE>)
164 {
165 last if /$start/;
166 print NEW_FILE $_;
167 }
168 }
169
170 print NEW_FILE @_;
171
172 if (defined($end))
173 {
174 my $skip=1;
175 while (<OLD_FILE>)
176 {
177 print NEW_FILE $_ unless $skip;
178 $skip = 0 if /$end/;
179 }
180 }
181
182 close OLD_FILE if defined($start);
183 close NEW_FILE;
184 return update_file($file);
185 }
186
187 # parse the specified makefile to identify the rules file
188 sub parse_makefile($)
189 {
190 my $file = shift;
191 my %make;
192
193 ($make{"=dir"} = $file) =~ s/[^\/]+$//;
194
195 open MAKE, "$file.in" or die "cannot open $file.in\n";
196
197 while (<MAKE>)
198 {
199 chomp;
200 while (/\\$/) { chop; $_ .= <MAKE>; chomp; } # merge continued lines
201
202 if (/^\@(MAKE.*RULES)\@/)
203 {
204 my $var = $1;
205 $make{"=rules"} = $makerules{$var};
206 next;
207 }
208 if (/^(MODULE|IMPORTLIB|TESTDLL)\s*=\s*(.*)/)
209 {
210 $make{$1} = $2;
211 next;
212 }
213 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*(.*)/)
214 {
215 my @list = split(/\s+/, $2);
216 $make{$1} = \@list;
217 next;
218 }
219 if (/^\#\s*MKDLL_SKIP/ || /^\#\s*MKPROG_SKIP/)
220 {
221 $make{"=skip"} = 1;
222 next;
223 }
224 }
225 return %make;
226 }
227
228
229 ################################################################
230 # update the tests list in programs/winetest/Makefile.in and programs/winetest/winetest.rc
231
232 sub update_winetest(@)
233 {
234 my (@tests, @lines);
235
236 foreach my $file (@_)
237 {
238 if ($file =~ /^dlls\/(.*)\/tests\/Makefile/) { push @tests, $1; }
239 }
240 push @lines, "TESTBINS =";
241 push @lines, map { " \\\n\t" . $_ . "_test.exe"; } sort @tests;
242 push @lines, "\n\n";
243
244 foreach my $test (sort @tests)
245 {
246 push @lines, "${test}_test.exe: \$(DLLDIR)/$test/tests/${test}_test.exe\$(DLLEXT)\n";
247 push @lines, "\tcp \$(DLLDIR)/$test/tests/${test}_test.exe\$(DLLEXT) \$\@ && \$(STRIP) \$\@\n";
248 }
249 push @lines, "\n# Special rules\n";
250
251 replace_in_file( "programs/winetest/Makefile.in", '^TESTBINS\s*=', '^# Special rules', @lines );
252
253 replace_in_file( "programs/winetest/winetest.rc", ' TESTRES ', undef,
254 map { $_ . "_test.exe TESTRES \"" . $_ . "_test.exe\"\n"; } sort @tests );
255
256 # return a list of test exe files for .gitignore
257 return map { "programs/winetest/" . $_ . "_test.exe"; } sort @tests;
258 }
259
260
261 ################################################################
262 # update the makefile list in configure.ac
263
264 sub update_makefiles(@)
265 {
266 my (@lines);
267
268 foreach my $var (sort { $makerules{$a} cmp $makerules{$b}; } keys %makerules)
269 {
270 my $file = $makerules{$var};
271 my %make = %{$makefiles{$file}};
272 my $rules = $make{"=rules"} ? ",[$make{\"=rules\"}]" : "";
273 push @lines, "WINE_CONFIG_MAKERULES([$file],[$var]$rules)\n";
274 }
275 push @lines, "\n";
276
277 foreach my $file (sort @_)
278 {
279 my %make = %{$makefiles{$file}};
280 my $rules = $make{"=rules"};
281 push @lines, "WINE_CONFIG_MAKEFILE([$file],[$rules])\n";
282 }
283
284 push @lines, "\nAC_OUTPUT\n";
285 replace_in_file( "configure.ac", '^WINE_CONFIG_MAKERULES', '^AC_OUTPUT$', @lines);
286 }
287
288
289 ################################################################
290 # process ignore targets for generic source files
291
292 sub update_ignores(@)
293 {
294 my @ignores;
295
296 foreach my $file (sort @_)
297 {
298 my %makefile = %{$makefiles{$file}};
299 my @list;
300
301 foreach my $src (@ignore_srcs)
302 {
303 my @pattern = @{$src};
304 next unless defined $makefile{$pattern[0]};
305 push @list, map { (my $ret = $_) =~ s/$pattern[1]$/$pattern[2]/; $ret; } @{$makefile{$pattern[0]}};
306 }
307 push @list, @{$makefile{"RC_BINARIES"}} if defined $makefile{"RC_BINARIES"};
308 foreach my $f (@list)
309 {
310 push @ignores, $makefile{"=dir"} . $f unless $f =~ /\$\(.*\)/; # skip make variables
311 }
312 }
313 return @ignores;
314 }
315
316 ################################################################
317 # update dlls/Makefile.in
318
319 sub update_dlls(@)
320 {
321 my (%directories, %testdirs, %importlibs, %static_implibs, %staticlib_dirs, %altnames);
322 my $text = "";
323 my @ignores = ();
324
325 foreach my $make (@_)
326 {
327 my %makefile = %{$makefiles{$make}};
328 next if defined $makefile{"=skip"};
329
330 if ($make =~ /dlls\/(.*)\/tests\/Makefile/)
331 {
332 $testdirs{$1} = "$1/tests";
333 (my $crosstest = $makefile{"TESTDLL"}) =~ s/\.dll$//;
334 next;
335 }
336
337 next unless defined $makefile{"MODULE"};
338 my $module = $makefile{"MODULE"};
339 (my $dir = $makefile{"=dir"}) =~ s/^dlls\/(.*)\//$1/;
340
341 if ($makefile{"=rules"} eq $makerules{"MAKE_IMPLIB_RULES"})
342 {
343 $staticlib_dirs{$module} = $dir;
344 die "invalid module $module in dir $staticlib_dirs{$module}\n" if "$staticlib_dirs{$module}" ne $module;
345 }
346 else
347 {
348 die "invalid module $module" unless $module =~ /\./;
349 (my $mod = $module) =~ s/\.dll$//;
350 die "invalid directory $dir for module $module\n" unless $mod eq $dir;
351 $directories{$module} = $dir;
352 }
353
354 if (defined $makefile{"IMPORTLIB"})
355 {
356 if ($makefile{"IMPORTLIB"} =~ /^([a-zA-Z0-9_.]+)/)
357 {
358 $importlibs{$module} = $1;
359 }
360 else
361 {
362 die "invalid importlib name $makefile{IMPORTLIB} in $make";
363 }
364 }
365
366 $static_implibs{$module} = 1 if defined $makefile{"IMPLIB_SRCS"};
367
368 if (defined $makefile{"SPEC_SRCS16"})
369 {
370 my @list = map { $_ =~ s/\.spec$//; $_ .= ".dll" unless $_ =~ /\./; $_; } @{$makefile{"SPEC_SRCS16"}};
371 $altnames{$module} = \@list;
372 }
373 if (defined $makefile{"EXTRA_OBJS16"})
374 {
375 foreach my $obj (@{$makefile{"EXTRA_OBJS16"}})
376 {
377 if ($obj =~ /^(.*\.(exe|mod))\.o/) { push @{$altnames{$module}}, $1; }
378 }
379 }
380 }
381
382 # output special dlls configure definitions
383
384 $text .= "# special configure-dependent targets\n\n";
385 my %specials = ();
386 foreach my $mod (sort keys %special_dlls)
387 {
388 $specials{$special_dlls{$mod}} .= " " . $mod;
389 }
390 foreach my $i (sort keys %specials)
391 {
392 $text .= $i . " =" . $specials{$i} . "\n";
393 }
394 $text .= "EXTRADIRS =";
395 foreach my $i (sort keys %specials) { $text .= sprintf " \@%s\@", $i; }
396 $text .= "\n\n";
397
398 # output the subdirs list
399
400 $text .= "# Subdir list\n\n";
401 $text .= "BASEDIRS =";
402 foreach my $dir (sort values %directories)
403 {
404 next if defined($special_dlls{$dir}); # skip special dlls
405 $text .= " \\\n\t" . $dir;
406 }
407
408 $text .= "\n\nIMPLIBSUBDIRS = \\\n\t";
409 $text .= join " \\\n\t", sort values %staticlib_dirs;
410
411 $text .= "\n\nTESTSUBDIRS = \\\n\t";
412 $text .= join " \\\n\t", sort values %testdirs;
413
414 $text .= "\n\nSUBDIRS = \\\n\t";
415 $text .= join " \\\n\t", "\$(BASEDIRS)", "\$(IMPLIBSUBDIRS)", "\$(TESTSUBDIRS)", sort keys %special_dlls;
416
417 $text .= "\n\nBUILDSUBDIRS = \$(BASEDIRS) \$(EXTRADIRS) \$(TESTSUBDIRS)\n";
418 $text .= "INSTALLSUBDIRS = \$(BASEDIRS) \$(EXTRADIRS) \$(IMPLIBSUBDIRS)\n";
419 $text .= "DOCSUBDIRS = \$(BASEDIRS) \$(EXTRADIRS)\n";
420
421 # output the list of 16-bit files
422
423 my @targets16 = ();
424 foreach my $mod (sort keys %directories)
425 {
426 next unless defined $altnames{$mod};
427 foreach my $i (sort @{$altnames{$mod}})
428 {
429 push @targets16, $i . "16";
430 }
431 }
432 $text .= "\n# 16-bit dlls\n\n";
433 $text .= "WIN16_FILES = \\\n";
434 $text .= "\t" . join( " \\\n\t", sort @targets16 ) . "\n\n";
435 $text .= "\@MAKE_RULES\@\n\n";
436
437 # output the all: target
438
439 $text .= "# Main target\n\n";
440 $text .= "all: \$(BUILDSUBDIRS) \@WIN16_FILES\@\n\n";
441
442 # output the lib name -> directory rules
443
444 $text .= "# Placeholders for 16-bit libraries\n\n";
445 foreach my $mod (sort keys %directories)
446 {
447 next unless defined $altnames{$mod};
448 $text .= sprintf "%s:\n", join(" ", map { $_ . "16"; } sort @{$altnames{$mod}});
449 $text .= sprintf "\techo \"%s\" >\$\@\n\n", $mod;
450 }
451
452 # output the import libraries rules
453
454 $text .= "# Import libraries\n\n";
455 $text .= "STATIC_IMPLIBEXT = \$(IMPLIBEXT:def=def.a)\n\n";
456
457 my @lib_symlinks = ();
458 foreach my $mod (sort keys %importlibs)
459 {
460 my $dir = $directories{$mod};
461 my $lib = $importlibs{$mod};
462 if ($lib ne $dir) { push @lib_symlinks, $mod; }
463 }
464 $text .= "IMPORT_SYMLINKS =";
465 foreach my $mod (sort @lib_symlinks)
466 {
467 $text .= sprintf " \\\n\tlib%s.\$(IMPLIBEXT)", $importlibs{$mod};
468 }
469
470 $text .= "\n\nIMPORT_LIBS = \\\n\t\$(IMPORT_SYMLINKS)";
471 foreach my $mod (sort keys %staticlib_dirs)
472 {
473 $text .= sprintf " \\\n\t%s/lib%s.a", $staticlib_dirs{$mod}, $mod;
474 }
475 foreach my $mod (sort keys %importlibs)
476 {
477 $text .= " \\\n\t$directories{$mod}/lib$importlibs{$mod}.\$(IMPLIBEXT)";
478 next unless defined $static_implibs{$mod};
479 $text .= " \\\n\t$directories{$mod}/lib$importlibs{$mod}.\$(STATIC_IMPLIBEXT)";
480 }
481 $text .= "\n\nCROSS_IMPLIBS =";
482 foreach my $mod (sort @lib_symlinks)
483 {
484 $text .= sprintf " \\\n\tlib%s.a", $importlibs{$mod};
485 }
486 foreach my $mod (sort keys %importlibs)
487 {
488 next if defined $static_implibs{$mod};
489 $text .= " \\\n\t$directories{$mod}/lib$importlibs{$mod}.a";
490 }
491 $text .= "\n\n";
492 $text .= "\$(TESTSUBDIRS:%=%/__crosstest__): \$(CROSS_IMPLIBS)\n\n";
493 $text .= "implib: \$(IMPORT_LIBS)\n\n";
494 $text .= ".PHONY: implib\n\n";
495
496 foreach my $mod (sort keys %importlibs)
497 {
498 my $dir = $directories{$mod};
499 my $lib = $importlibs{$mod};
500 my $spec = $mod;
501 $spec =~ s/\.dll$//;
502 if (defined($static_implibs{$mod}))
503 {
504 $text .= sprintf "%s/lib%s.def: %s/%s.spec \$(WINEBUILD)\n", $dir, $lib, $dir, $spec;
505 $text .= sprintf "\t\@cd %s && \$(MAKE) lib%s.def\n\n", $dir, $lib;
506 $text .= sprintf "%s/lib%s.\$(STATIC_IMPLIBEXT): dummy\n", $dir, $lib, $dir, $spec;
507 $text .= sprintf "\t\@cd %s && \$(MAKE) lib%s.\$(STATIC_IMPLIBEXT)\n\n", $dir, $lib;
508 }
509 else
510 {
511 $text .= sprintf "%s/lib%s.def %s/lib%s.a: %s/%s.spec \$(WINEBUILD)\n",
512 $dir, $lib, $dir, $lib, $dir, $spec;
513 $text .= sprintf "\t\@cd %s && \$(MAKE) `basename \$\@`\n\n", $dir;
514 }
515 }
516 foreach my $mod (sort @lib_symlinks)
517 {
518 my $dir = $directories{$mod};
519 my $lib = "lib" . $importlibs{$mod};
520 $text .= sprintf "%s.a: %s/%s.a\n", $lib, $dir, $lib;
521 $text .= sprintf "\t\$(RM) \$@ && \$(LN_S) %s/%s.a \$@\n\n", $dir, $lib;
522 $text .= sprintf "%s.def: %s/%s.def\n", $lib, $dir, $lib;
523 $text .= sprintf "\t\$(RM) \$@ && \$(LN_S) %s/%s.def \$@\n\n", $dir, $lib;
524 }
525
526 $text .= "\$(BUILDSUBDIRS): \$(IMPORT_LIBS)\n";
527 $text .= "\$(INSTALLSUBDIRS:%=%/__install__) \$(INSTALLSUBDIRS:%=%/__install-lib__): \$(IMPORT_LIBS)\n\n";
528
529 # output the inter-dll dependencies and rules
530
531 $text .= "# Map library name to the corresponding directory\n\n";
532
533 foreach my $mod (sort keys %staticlib_dirs)
534 {
535 $text .= sprintf "%s/lib%s.a: %s\n", $staticlib_dirs{$mod}, $mod, $staticlib_dirs{$mod};
536 }
537 $text .= "\n# Misc rules\n";
538
539 replace_in_file( "dlls/Makefile.in",
540 '^# special configure-dependent targets',
541 '^# Misc rules',
542 $text );
543
544 # .gitignore file
545
546 foreach my $mod (sort @lib_symlinks)
547 {
548 push @ignores, "dlls/lib$importlibs{$mod}.def";
549 }
550 foreach my $mod (sort keys %directories)
551 {
552 next unless defined $altnames{$mod};
553 push @ignores, map { "dlls/" . $_ . "16"; } @{$altnames{$mod}};
554 }
555
556 return @ignores;
557 }
558
559
560 ################################################################
561 # update programs/Makefile.in
562
563 sub update_progs(@)
564 {
565 my (@subdirs, @install_subdirs, @install_progs);
566
567 my @ignores = ();
568
569 foreach my $make (@_)
570 {
571 my %makefile = %{$makefiles{$make}};
572 my $module = $makefile{"MODULE"};
573 (my $dir = $make) =~ s/^programs\/(.*)\/Makefile$/$1/;
574 die "Invalid module $module in $make" unless "$dir.exe" eq $module;
575 next if defined $makefile{"=skip"};
576 push @subdirs, $dir;
577 push @ignores, "programs/$dir/$dir";
578 push @install_subdirs, $dir unless $dont_install{$dir};
579 push @install_progs, $dir if $bin_install{$dir};
580 }
581
582 replace_in_file( "programs/Makefile.in", '^SUBDIRS\s*=', '^INSTALLDIRS',
583 "SUBDIRS = \\\n\t",
584 join( " \\\n\t", @subdirs ),
585 "\n\n# Sub-directories to run make install into\nINSTALLSUBDIRS = \\\n\t",
586 join( " \\\n\t", @install_subdirs ),
587 "\n\n# Programs to install in bin directory\nINSTALLPROGS = \\\n\t",
588 join( " \\\n\t", @install_progs ),
589 "\n\nINSTALLDIRS = \$(DESTDIR)\$(bindir)\n" );
590
591 return @ignores;
592 }
593
594
595 ################################################################
596 # update include/Makefile.in
597
598 sub update_includes()
599 {
600 return unless -d ".git";
601 my (@h_srcs, @idl_srcs, @tlb_srcs, %subdirs);
602 my @includes = map { s/^include\///; $_; } split /\0/, `git ls-files -c -z include`;
603 foreach my $incl (@includes)
604 {
605 if ($incl =~ /(.*)\//) { $subdirs{$1} = 1; }
606 next if ($incl =~ /^wine\// && !$exported_wine_headers{$incl});
607 if ($incl =~ /stdole2\.idl$/) { push @tlb_srcs, $incl; }
608 elsif ($private_idl_headers{$incl}) { push @h_srcs, $incl; }
609 elsif ($incl =~ /\.h$/) { push @h_srcs, $incl; }
610 elsif ($incl =~ /\.inl$/) { push @h_srcs, $incl; }
611 elsif ($incl =~ /\.idl$/) { push @idl_srcs, $incl; }
612 }
613 replace_in_file( "include/Makefile.in", '^IDL_H_SRCS\s*=', '^INSTALLDIRS',
614 "IDL_H_SRCS = \\\n\t",
615 join( " \\\n\t", sort @idl_srcs ),
616 "\n\nIDL_TLB_SRCS = \\\n\t",
617 join( " \\\n\t", sort @tlb_srcs ),
618 "\n\nSRCDIR_INCLUDES = \\\n\t\$(IDL_TLB_SRCS) \\\n\t\$(IDL_H_SRCS) \\\n\t",
619 join( " \\\n\t", sort @h_srcs ),
620 "\n\nEXTRASUBDIRS = ",
621 join( " ", sort keys %subdirs ),
622 "\n\nINSTALLDIRS = \\\n" );
623 }
624
625
626 ################################################################
627 # update the main .gitignore
628
629 sub update_gitignore(@)
630 {
631 my @ignores = values %makerules;
632
633 foreach my $make (@makefiles)
634 {
635 my %makefile = %{$makefiles{$make}};
636 my $dir = $makefile{"=dir"};
637 if (defined $makefile{"MANPAGES"})
638 {
639 push @ignores, map { $dir . $_; } @{$makefile{"MANPAGES"}};
640 }
641 if (defined $makefile{"PROGRAMS"})
642 {
643 push @ignores, map { s/\$\(EXEEXT\)//; $dir . $_; } @{$makefile{"PROGRAMS"}};
644 }
645 }
646
647 # prepend a slash to paths that don't have one
648 @ignores = map { $_ =~ s/^([^\/]+)$/\/$1/; $_; } @ignores;
649
650 # get rid of duplicates
651 my %ignores = ();
652 foreach my $i (@ignores, @_) { $ignores{$i} = 1; }
653
654 replace_in_file( ".gitignore", undef, undef,
655 "# Automatically generated by make_makefiles; DO NOT EDIT!!\n",
656 join("\n", sort keys %ignores), "\n" );
657 }
658
659
660 if (-d ".git")
661 {
662 @makefiles = map { s/\.in$//; $_; } split /\0/, `git ls-files -c -z Makefile.in \\*/Makefile.in`;
663 }
664 else
665 {
666 @makefiles = map { s/^\.\/(.*)\.in/$1/; $_; } split(/\s/,`find . -name Makefile.in -print`);
667 }
668
669 update_includes();
670
671 foreach my $file (sort values %makerules, @makefiles)
672 {
673 my %make = parse_makefile( $file );
674 $makefiles{$file} = \%make;
675 }
676
677 update_makefiles( @makefiles );
678 push @ignores, update_ignores( @makefiles );
679 push @ignores, update_winetest( @makefiles );
680 push @ignores, update_dlls( sort grep /^dlls\//, @makefiles );
681 push @ignores, update_progs( sort grep /^programs\/.*\/Makefile$/, @makefiles );
682 update_gitignore( @ignores );
This page was automatically generated by the
LXR engine.
Visit the LXR main site for more
information.