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