~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~ [ freetext search ] ~ [ file search ] ~

Wine Cross Reference
wine/tools/make_makefiles

Version: ~ [ wine-1.1.33 ] ~ [ wine-1.1.32 ] ~ [ wine-1.1.31 ] ~ [ wine-1.1.30 ] ~ [ wine-1.1.29 ] ~ [ wine-1.1.28 ] ~ [ wine-1.1.27 ] ~ [ wine-1.1.26 ] ~ [ wine-1.1.25 ] ~ [ wine-1.1.24 ] ~ [ wine-1.1.23 ] ~ [ wine-1.1.22 ] ~ [ wine-1.1.21 ] ~ [ wine-1.1.20 ] ~ [ wine-1.1.19 ] ~ [ wine-1.1.18 ] ~ [ wine-1.1.17 ] ~ [ wine-1.1.16 ] ~ [ wine-1.1.15 ] ~ [ wine-1.1.14 ] ~ [ wine-1.1.13 ] ~ [ wine-1.1.12 ] ~ [ wine-1.1.11 ] ~ [ wine-1.1.10 ] ~ [ wine-1.1.9 ] ~ [ wine-1.1.8 ] ~ [ wine-1.1.7 ] ~ [ wine-1.0.1 ] ~ [ wine-1.1.6 ] ~ [ wine-1.1.5 ] ~ [ wine-1.1.4 ] ~ [ wine-1.1.3 ] ~ [ wine-1.1.2 ] ~ [ wine-1.1.1 ] ~ [ wine-1.1.0 ] ~ [ wine-1.0 ] ~

  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 use strict;
 23 
 24 # Make rules files
 25 my %makerules =
 26 (
 27  "MAKE_RULES" => "Make.rules",
 28  "MAKE_DLL_RULES" => "dlls/Makedll.rules",
 29  "MAKE_IMPLIB_RULES" => "dlls/Makeimplib.rules",
 30  "MAKE_TEST_RULES" => "dlls/Maketest.rules",
 31  "MAKE_PROG_RULES" => "programs/Makeprog.rules",
 32 );
 33 
 34 # Programs that we want to install in the bin directory too
 35 my %bin_install =
 36 (
 37   "msiexec" => 1,
 38   "notepad" => 1,
 39   "regedit" => 1,
 40   "regsvr32" => 1,
 41   "wineboot" => 1,
 42   "winecfg" => 1,
 43   "wineconsole" => 1,
 44   "winedbg" => 1,
 45   "winefile" => 1,
 46   "winemine" => 1,
 47   "winepath" => 1,
 48 );
 49 
 50 # Programs that we don't want to install at all
 51 my %dont_install =
 52 (
 53   "cmdlgtst" => 1,
 54   "view" => 1,
 55   "winetest" => 1,
 56 );
 57 
 58 # Default patterns for top-level .gitignore
 59 my @ignores = (
 60     "*.[oa]",
 61     "*.ok",
 62     "*.res",
 63     "*.so",
 64     "/autom4te.cache",
 65     "/config.cache",
 66     "/config.log",
 67     "/config.status",
 68     "/TAGS",
 69     "/tags",
 70     "Makefile",
 71     "dlldata.c",
 72     "dlls/*/*.def",
 73     "dlls/*/tests/*crosstest.exe",
 74     "dlls/*/tests/testlist.c",
 75     "include/config.h",
 76     "include/stamp-h",
 77     "programs/winetest/*_test.exe",
 78     "programs/winetest/*_test.rc",
 79     "programs/winetest/build.rc",
 80 );
 81 
 82 # Source files and their resulting target to ignore
 83 my @ignore_srcs = (
 84     [ 'BISON_SRCS',   '\.y',   '.tab.c' ],
 85     [ 'BISON_SRCS',   '\.y',   '.tab.h' ],
 86     [ 'LEX_SRCS',     '\.l',   '.yy.c' ],
 87     [ 'MC_SRCS',      '\.mc',  '.mc.rc' ],
 88     [ 'IDL_TLB_SRCS', '\.idl', '.tlb' ],
 89     [ 'IDL_H_SRCS',   '\.idl', '.h' ],
 90     [ 'IDL_C_SRCS',   '\.idl', '.h' ],
 91     [ 'IDL_I_SRCS',   '\.idl', '.h' ],
 92     [ 'IDL_P_SRCS',   '\.idl', '.h' ],
 93     [ 'IDL_S_SRCS',   '\.idl', '.h' ],
 94     [ 'IDL_C_SRCS',   '\.idl', '_c.c' ],
 95     [ 'IDL_I_SRCS',   '\.idl', '_i.c' ],
 96     [ 'IDL_P_SRCS',   '\.idl', '_p.c' ],
 97     [ 'IDL_S_SRCS',   '\.idl', '_s.c' ],
 98 );
 99 
100 my %exported_wine_headers = (
101     "wine/debug.h" => 1,
102     "wine/exception.h" => 1,
103     "wine/library.h" => 1,
104     "wine/unicode.h" => 1,
105     "wine/itss.idl" => 1,
106     "wine/svcctl.idl" => 1,
107 );
108 
109 my %private_idl_headers = (
110     "axcore.idl" => 1,
111     "axextend.idl" => 1,
112     "dbinit.idl" => 1,
113     "dbprop.idl" => 1,
114     "dbs.idl" => 1,
115     "devenum.idl" => 1,
116     "dyngraph.idl" => 1,
117     "vmrender.idl" => 1,
118     "wine/wined3d.idl" => 1,
119     "wine/winedxgi.idl" => 1,
120 );
121 
122 my %ignored_source_files = (
123     "dlls/wineps.drv/afm2c.c" => 1,
124     "dlls/wineps.drv/mkagl.c" => 1,
125     "programs/winetest/dist.rc" => 1,
126 );
127 
128 my (@all_files, @makefiles, %makefiles);
129 
130 sub dirname($)
131 {
132     my $ret = shift;
133     return "" unless $ret =~ /\//;
134     $ret =~ s!/[^/]*$!!;
135     return $ret;
136 }
137 
138 # update a file if changed
139 sub update_file($)
140 {
141     my $file = shift;
142     my $ret = !(-f $file) || system "cmp $file $file.new >/dev/null";
143     if (!$ret)
144     {
145         unlink "$file.new";
146     }
147     else
148     {
149         rename "$file.new", "$file";
150         print "$file updated\n";
151         if ($file eq "configure.ac")
152         {
153             system "autoconf";
154             print "configure updated\n";
155         }
156     }
157     return $ret;
158 }
159 
160 # replace some lines in a file between two markers
161 sub replace_in_file($$$@)
162 {
163     my $file = shift;
164     my $start = shift;
165     my $end = shift;
166 
167     open NEW_FILE, ">$file.new" or die "cannot create $file.new";
168 
169     if (defined($start))
170     {
171         open OLD_FILE, "$file" or die "cannot open $file";
172         while (<OLD_FILE>)
173         {
174             last if /$start/;
175             print NEW_FILE $_;
176         }
177     }
178 
179     print NEW_FILE @_;
180 
181     if (defined($end))
182     {
183         my $skip=1;
184         while (<OLD_FILE>)
185         {
186             print NEW_FILE $_ unless $skip;
187             $skip = 0 if /$end/;
188         }
189     }
190 
191     close OLD_FILE if defined($start);
192     close NEW_FILE;
193     return update_file($file);
194 }
195 
196 # replace a variable in a makefile
197 sub replace_makefile_variable($$)
198 {
199     my ($file, $var) = @_;
200     my $make = $makefiles{$file};
201 
202     return unless defined ${$make}{"=$var"};
203 
204     my @values = @{${$make}{"=$var"}};
205     ${$make}{$var} = \@values;
206 
207     open NEW_FILE, ">$file.in.new" or die "cannot create $file.in.new";
208 
209     open OLD_FILE, "$file.in" or die "cannot open $file.in";
210     while (<OLD_FILE>)
211     {
212         if (/^\s*($var\s+)=/)
213         {
214             # try to preserve formatting
215             my $prefix = $1;
216             my $multiline = /\\$/ || (@values > 1);
217             while (/\\$/)
218             {
219                 $_ = <OLD_FILE>;
220                 last unless $_;
221             }
222             if ($multiline)
223             {
224                 print NEW_FILE "$var = \\\n\t" . join(" \\\n\t", sort @values) . "\n";
225             }
226             else
227             {
228                 print NEW_FILE "$prefix= @values\n";
229             }
230             next;
231         }
232         print NEW_FILE $_;
233     }
234     close OLD_FILE;
235     close NEW_FILE;
236     return update_file("$file.in");
237 }
238 
239 # parse the specified makefile to identify the rules file
240 sub parse_makefile($)
241 {
242     my $file = shift;
243     my %make;
244 
245     ($make{"=dir"} = $file) =~ s/[^\/]+$//;
246 
247     open MAKE, "$file.in" or die "cannot open $file.in\n";
248 
249     while (<MAKE>)
250     {
251         chomp;
252         next if (/^\s*#/);
253         while (/\\$/) { chop; $_ .= <MAKE>; chomp; }  # merge continued lines
254         next if (/^\s*$/);
255 
256         if (/^\@(MAKE.*RULES)\@/)
257         {
258             my $var = $1;
259             $make{"=rules"} = $makerules{$var};
260             next;
261         }
262         if (/^\s*(MODULE|IMPORTLIB|TESTDLL)\s*=\s*(.*)/)
263         {
264             $make{$1} = $2;
265             next;
266         }
267         if (/^\s*(BISON_SRCS|LEX_SRCS|IDL_[CHIPS]_SRCS|IDL_TLB_SRCS|IMPLIB_SRCS|C_SRCS|MC_SRCS|RC_SRCS|SVG_SRCS|C_SRCS16|RC_SRCS16|SPEC_SRCS16|EXTRA_OBJS16|MANPAGES|PROGRAMS)\s*=\s*(.*)/)
268         {
269             my @list = split(/\s+/, $2);
270             $make{$1} = \@list;
271             next;
272         }
273     }
274     return %make;
275 }
276 
277 # assign source files to their respective makefile
278 sub assign_sources_to_makefiles()
279 {
280     foreach my $file (@all_files)
281     {
282         next if defined $ignored_source_files{$file};
283         my $dir = dirname( $file );
284 
285         while ($dir && !defined $makefiles{"$dir/Makefile"}) { $dir = dirname( $dir ); }
286         next unless $dir;
287 
288         die "no makefile found for $file\n" unless defined $makefiles{"$dir/Makefile"};
289 
290         my $make = $makefiles{"$dir/Makefile"};
291         my $basename = substr( $file, length($dir) + 1 );
292 
293         if ($basename =~ /\.c$/) { push @{${$make}{"=C_SRCS"}}, $basename; }
294         elsif ($basename =~ /\.l$/) { push @{${$make}{"=LEX_SRCS"}}, $basename; }
295         elsif ($basename =~ /\.y$/) { push @{${$make}{"=BISON_SRCS"}}, $basename; }
296         elsif ($basename =~ /\.rc$/) { push @{${$make}{"=RC_SRCS"}}, $basename; }
297         elsif ($basename =~ /\.rc$/) { push @{${$make}{"=RC_SRCS"}}, $basename; }
298         elsif ($basename =~ /\.svg$/) { push @{${$make}{"=SVG_SRCS"}}, $basename; }
299     }
300 }
301 
302 ################################################################
303 # update the makefile list in configure.ac
304 
305 sub update_makefiles(@)
306 {
307     my (@lines);
308 
309     foreach my $var (sort { $makerules{$a} cmp $makerules{$b}; } keys %makerules)
310     {
311         my $file = $makerules{$var};
312         my %make = %{$makefiles{$file}};
313         my $rules = $make{"=rules"} ? ",[$make{\"=rules\"}]" : "";
314         push @lines, "WINE_CONFIG_MAKERULES([$file],[$var]$rules)\n";
315     }
316     push @lines, "\n";
317 
318     foreach my $file (sort @_)
319     {
320         my %make = %{$makefiles{$file}};
321         my $rules = $make{"=rules"};
322         my $args = "";
323         if ($rules eq $makerules{"MAKE_DLL_RULES"})
324         {
325             $args = ",[dlls],[ALL_DLL_DIRS]";
326             $args .= ",[enable_win16]" if $make{"MODULE"} =~ /(16|\.vxd)$/;
327         }
328         elsif ($rules eq $makerules{"MAKE_IMPLIB_RULES"}) { $args = ",[dlls],[ALL_IMPLIB_DIRS]"; }
329         elsif ($rules eq $makerules{"MAKE_TEST_RULES"}) { $args = ",[dlls],[ALL_TEST_DIRS],[enable_tests]"; }
330         elsif ($rules eq $makerules{"MAKE_PROG_RULES"})
331         {
332             (my $name = $file) =~ s/^programs\/(.*)\/Makefile/$1/;
333             $args = ",[programs],[ALL_PROGRAM_DIRS";
334             $args .= ",ALL_PROGRAM_INSTALL_DIRS" unless $dont_install{$name};
335             $args .= ",ALL_PROGRAM_BIN_INSTALL_DIRS" if $bin_install{$name};
336             $args .= "]";
337             $args .= ",[enable_win16]" if $make{"MODULE"} =~ /16$/;
338         }
339         elsif ($file =~ /^[^\/]*\/Makefile$/) { $args = ",[],[ALL_TOP_DIRS]"; }
340         push @lines, "WINE_CONFIG_MAKEFILE([$file],[$rules]$args)\n";
341     }
342 
343     # update the source variables in all the makefiles
344 
345     foreach my $file (sort @_)
346     {
347         my %make = %{$makefiles{$file}};
348 
349         replace_makefile_variable( $file, "LEX_SRCS" );
350         replace_makefile_variable( $file, "BISON_SRCS" );
351         replace_makefile_variable( $file, "MC_SRCS" );
352         replace_makefile_variable( $file, "SVG_SRCS" );
353         replace_makefile_variable( $file, "C_SRCS" ) unless defined $make{"C_SRCS16"};
354         replace_makefile_variable( $file, "RC_SRCS" ) unless defined $make{"RC_SRCS16"};
355     }
356 
357     push @lines, "\ndnl Build dependencies for test files compiled into winetest\n";
358     replace_in_file( "configure.ac", '^WINE_CONFIG_MAKERULES', '^dnl Build dependencies for test files compiled into winetest$', @lines);
359 }
360 
361 
362 ################################################################
363 # process ignore targets for generic source files
364 
365 sub update_ignores(@)
366 {
367     my @ignores;
368 
369     foreach my $file (sort @_)
370     {
371         my %makefile = %{$makefiles{$file}};
372         my @list;
373 
374         foreach my $src (@ignore_srcs)
375         {
376             my @pattern = @{$src};
377             next unless defined $makefile{$pattern[0]};
378             push @list, map { (my $ret = $_) =~ s/$pattern[1]$/$pattern[2]/; $ret; } @{$makefile{$pattern[0]}};
379         }
380         foreach my $f (@list)
381         {
382             push @ignores, $makefile{"=dir"} . $f unless $f =~ /\$\(.*\)/;  # skip make variables
383         }
384     }
385     return @ignores;
386 }
387 
388 ################################################################
389 # update dlls/Makefile.in
390 
391 sub update_dlls(@)
392 {
393     my (%directories, %importlibs, %static_implibs, %staticlib_dirs, %altnames);
394     my $text = "";
395     my @ignores = ();
396 
397     foreach my $make (@_)
398     {
399         my %makefile = %{$makefiles{$make}};
400         next if ($makefile{"=rules"} eq $makerules{"MAKE_TEST_RULES"});
401 
402         next unless defined $makefile{"MODULE"};
403         my $module = $makefile{"MODULE"};
404         (my $dir = $makefile{"=dir"}) =~ s/^dlls\/(.*)\//$1/;
405 
406         if ($makefile{"=rules"} eq $makerules{"MAKE_IMPLIB_RULES"})
407         {
408             $staticlib_dirs{$module} = $dir;
409             die "invalid module $module in dir $staticlib_dirs{$module}\n" if "$staticlib_dirs{$module}" ne $module;
410         }
411         else
412         {
413             die "invalid module $module" unless $module =~ /\./;
414             (my $mod = $module) =~ s/\.dll$//;
415             die "invalid directory $dir for module $module\n" unless $mod eq $dir;
416             $directories{$module} = $dir;
417         }
418 
419         if (defined $makefile{"IMPORTLIB"})
420         {
421             if ($makefile{"IMPORTLIB"} =~ /^([a-zA-Z0-9_.]+)/)
422             {
423                 $importlibs{$module} = $1;
424             }
425             else
426             {
427                 die "invalid importlib name $makefile{IMPORTLIB} in $make";
428             }
429         }
430 
431         $static_implibs{$module} = 1 if defined $makefile{"IMPLIB_SRCS"};
432 
433         if (defined $makefile{"SPEC_SRCS16"})
434         {
435             my @list = map { $_ =~ s/\.spec$//; $_ .= ".dll" unless $_ =~ /\./; $_; } @{$makefile{"SPEC_SRCS16"}};
436             $altnames{$module} = \@list;
437         }
438         if (defined $makefile{"EXTRA_OBJS16"})
439         {
440             foreach my $obj (@{$makefile{"EXTRA_OBJS16"}})
441             {
442                 if ($obj =~ /^(.*\.(exe|mod))\.o/) { push @{$altnames{$module}}, $1; }
443             }
444         }
445     }
446 
447     # output the list of 16-bit files
448 
449     my @targets16 = ();
450     foreach my $mod (sort keys %directories)
451     {
452         next unless defined $altnames{$mod};
453         foreach my $i (sort @{$altnames{$mod}})
454         {
455             push @targets16, $i . "16";
456         }
457     }
458     $text .= "# 16-bit dlls\n\n";
459     $text .= "WIN16_FILES = \\\n";
460     $text .=  "\t" . join( " \\\n\t", sort @targets16 ) . "\n\n";
461     $text .= "\@MAKE_RULES\@\n\n";
462 
463     # output the all: target
464 
465     $text .= "# Main target\n\n";
466     $text .= "all: \$(BUILDSUBDIRS) \@WIN16_FILES\@\n\n";
467 
468     # output the lib name -> directory rules
469 
470     $text .= "# Placeholders for 16-bit libraries\n\n";
471     foreach my $mod (sort keys %directories)
472     {
473         next unless defined $altnames{$mod};
474         $text .= sprintf "%s:\n", join(" ", map { $_ . "16"; } sort @{$altnames{$mod}});
475         $text .= sprintf "\techo \"%s\" >\$\@\n\n", $mod;
476     }
477 
478     # output the import libraries rules
479 
480     $text .= "# Import libraries\n\n";
481     $text .= "STATIC_IMPLIBEXT = \$(IMPLIBEXT:def=def.a)\n\n";
482 
483     my @lib_symlinks = ();
484     foreach my $mod (sort keys %importlibs)
485     {
486         my $dir = $directories{$mod};
487         my $lib = $importlibs{$mod};
488         if ($lib ne $dir) { push @lib_symlinks, $mod; }
489     }
490     $text .= "IMPORT_SYMLINKS =";
491     foreach my $mod (sort @lib_symlinks)
492     {
493         $text .= sprintf " \\\n\tlib%s.\$(IMPLIBEXT)", $importlibs{$mod};
494     }
495 
496     $text .= "\n\nIMPORT_LIBS = \\\n\t\$(IMPORT_SYMLINKS)";
497     foreach my $mod (sort keys %staticlib_dirs)
498     {
499         $text .= sprintf " \\\n\t%s/lib%s.a", $staticlib_dirs{$mod}, $mod;
500     }
501     foreach my $mod (sort keys %importlibs)
502     {
503         $text .= " \\\n\t$directories{$mod}/lib$importlibs{$mod}.\$(IMPLIBEXT)";
504         next unless defined $static_implibs{$mod};
505         $text .= " \\\n\t$directories{$mod}/lib$importlibs{$mod}.\$(STATIC_IMPLIBEXT)";
506     }
507     $text .= "\n\nCROSS_IMPLIBS =";
508     foreach my $mod (sort @lib_symlinks)
509     {
510         $text .= sprintf " \\\n\tlib%s.a", $importlibs{$mod};
511     }
512     foreach my $mod (sort keys %importlibs)
513     {
514         next if defined $static_implibs{$mod};
515         $text .= " \\\n\t$directories{$mod}/lib$importlibs{$mod}.a";
516     }
517     $text .= "\n\n";
518     $text .= "\$(TESTSUBDIRS:%=%/__crosstest__): \$(CROSS_IMPLIBS)\n\n";
519     $text .= "implib: \$(IMPORT_LIBS)\n\n";
520     $text .= "testsubdirs: \$(TESTSUBDIRS)\n\n";
521     $text .= ".PHONY: implib testsubdirs\n\n";
522 
523     foreach my $mod (sort keys %importlibs)
524     {
525         my $dir = $directories{$mod};
526         my $lib = $importlibs{$mod};
527         my $spec = $mod;
528         $spec =~ s/\.dll$//;
529         if (defined($static_implibs{$mod}))
530         {
531             $text .= sprintf "%s/lib%s.def: %s/%s.spec \$(WINEBUILD)\n", $dir, $lib, $dir, $spec;
532             $text .= sprintf "\t\@cd %s && \$(MAKE) lib%s.def\n\n", $dir, $lib;
533             $text .= sprintf "%s/lib%s.\$(STATIC_IMPLIBEXT): dummy\n", $dir, $lib, $dir, $spec;
534             $text .= sprintf "\t\@cd %s && \$(MAKE) lib%s.\$(STATIC_IMPLIBEXT)\n\n", $dir, $lib;
535         }
536         else
537         {
538             $text .= sprintf "%s/lib%s.def %s/lib%s.a: %s/%s.spec \$(WINEBUILD)\n",
539                              $dir, $lib, $dir, $lib, $dir, $spec;
540             $text .= sprintf "\t\@cd %s && \$(MAKE) `basename \$\@`\n\n", $dir;
541         }
542     }
543     foreach my $mod (sort @lib_symlinks)
544     {
545         my $dir = $directories{$mod};
546         my $lib = "lib" . $importlibs{$mod};
547         $text .= sprintf "%s.a: %s/%s.a\n", $lib, $dir, $lib;
548         $text .= sprintf "\t\$(RM) \$@ && \$(LN_S) %s/%s.a \$@\n\n", $dir, $lib;
549         $text .= sprintf "%s.def: %s/%s.def\n", $lib, $dir, $lib;
550         $text .= sprintf "\t\$(RM) \$@ && \$(LN_S) %s/%s.def \$@\n\n", $dir, $lib;
551     }
552 
553     $text .= "\$(BUILDSUBDIRS): \$(IMPORT_LIBS)\n";
554     $text .= "\$(INSTALLSUBDIRS:%=%/__install__) \$(INSTALLSUBDIRS:%=%/__install-lib__): \$(IMPORT_LIBS)\n\n";
555 
556     # output the inter-dll dependencies and rules
557 
558     $text .= "# Map library name to the corresponding directory\n\n";
559 
560     foreach my $mod (sort keys %staticlib_dirs)
561     {
562         $text .= sprintf "%s/lib%s.a: %s\n", $staticlib_dirs{$mod}, $mod, $staticlib_dirs{$mod};
563     }
564     $text .= "\n# Misc rules\n";
565 
566     replace_in_file( "dlls/Makefile.in",
567                      '^# 16-bit dlls',
568                      '^# Misc rules',
569                      $text );
570 
571     # .gitignore file
572 
573     foreach my $mod (sort @lib_symlinks)
574     {
575         push @ignores, "dlls/lib$importlibs{$mod}.def";
576     }
577     foreach my $mod (sort keys %directories)
578     {
579         next unless defined $altnames{$mod};
580         push @ignores, map { "dlls/" . $_ . "16"; } @{$altnames{$mod}};
581     }
582 
583     return @ignores;
584 }
585 
586 
587 ################################################################
588 # update include/Makefile.in
589 
590 sub update_includes()
591 {
592     my (@h_srcs, @private_idl_srcs, @public_idl_srcs, @tlb_srcs, %subdirs);
593     my @includes = map { (my $ret = $_) =~ s/^include\///; $ret; } grep /^include\//, @all_files;
594     foreach my $incl (@includes)
595     {
596         if ($incl =~ /(.*)\//) { $subdirs{$1} = 1; }
597         next if ($incl =~ /\.in$/);
598         if ($incl =~ /^wine\// && !$exported_wine_headers{$incl})
599         {
600             if ($private_idl_headers{$incl}) { push @private_idl_srcs, $incl; }
601             next;
602         }
603         if ($incl =~ /stdole2\.idl$/) { push @tlb_srcs, $incl; }
604         elsif ($private_idl_headers{$incl}) { push @h_srcs, $incl; }
605         elsif ($incl =~ /\.h$/) { push @h_srcs, $incl; }
606         elsif ($incl =~ /\.rh$/) { push @h_srcs, $incl; }
607         elsif ($incl =~ /\.inl$/) { push @h_srcs, $incl; }
608         elsif ($incl =~ /\.idl$/) { push @public_idl_srcs, $incl; }
609         else { die "unknown file $incl in include dir"; }
610     }
611     replace_in_file( "include/Makefile.in", '^PRIVATE_IDL_H_SRCS\s*=', '^INSTALLDIRS',
612                      "PRIVATE_IDL_H_SRCS = \\\n\t",
613                      join( " \\\n\t", sort @private_idl_srcs ),
614                      "\n\nPUBLIC_IDL_H_SRCS = \\\n\t",
615                      join( " \\\n\t", sort @public_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\$(PUBLIC_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     return map { s/(.*)\.idl$/include\/$1.h/; $_; } @public_idl_srcs, @private_idl_srcs;
624 }
625 
626 
627 ################################################################
628 # update the main .gitignore
629 
630 sub update_gitignore(@)
631 {
632     my @ignores = values %makerules;
633 
634     foreach my $make (@makefiles)
635     {
636         my %makefile = %{$makefiles{$make}};
637         my $dir = $makefile{"=dir"};
638         if (defined $makefile{"MANPAGES"})
639         {
640             push @ignores, map { $dir . $_; } @{$makefile{"MANPAGES"}};
641         }
642         if (defined $makefile{"PROGRAMS"})
643         {
644             push @ignores, map { s/\$\(EXEEXT\)//; $dir . $_; } @{$makefile{"PROGRAMS"}};
645         }
646     }
647 
648     # prepend a slash to paths that don't have one
649     @ignores = map { $_ =~ s/^([^\/]+)$/\/$1/; $_; } @ignores;
650 
651     # get rid of duplicates
652     my %ignores = ();
653     foreach my $i (@ignores, @_) { $ignores{$i} = 1; }
654 
655     replace_in_file( ".gitignore", undef, undef,
656                      "# Automatically generated by make_makefiles; DO NOT EDIT!!\n",
657                      join("\n", sort keys %ignores), "\n" );
658 }
659 
660 
661 die "needs to be run from a git checkout" unless -d ".git";
662 
663 @all_files = split /\0/, `git ls-files -c -z`;
664 @makefiles = map { my $ret = $_; $ret =~ s/\.in$//; $ret; } grep /Makefile.in$/, @all_files;
665 
666 foreach my $file (sort values %makerules, @makefiles)
667 {
668     my %make = parse_makefile( $file );
669     $makefiles{$file} = \%make;
670 }
671 
672 assign_sources_to_makefiles();
673 update_makefiles( @makefiles );
674 push @ignores, update_includes();
675 push @ignores, update_ignores( @makefiles );
676 push @ignores, update_dlls( sort grep /^dlls\//, @makefiles );
677 update_gitignore( @ignores );

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~ [ freetext search ] ~ [ file search ] ~

This page was automatically generated by the LXR engine.
Visit the LXR main site for more information.