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