#!/usr/bin/perl -w # # Update the dll dependencies in the dlls main Makefile.in. # Must be run in the dlls/ directory of the Wine tree. # # Copyright 2001 Alexandre Julliard # $makefiles = `find . -name Makefile.in -print`; %imports = (); %directories = (); %altnames = (); # list of special dlls that can be switched on or off by configure %special_dlls = ( "ddraw" => "XFILES", "glu32" => "GLU32FILES", "opengl32" => "OPENGLFILES", "x11drv" => "XFILES" ); foreach $i (split(/\s/,$makefiles)) { open MAKE,$i; while () { chop; if (/^MODULE\s*=\s*([a-zA-Z0-9_.]+)/) { $module = $1; ($directories{$module} = $i) =~ s/^\.\/(.*)\/[^\/]+$/$1/; next; } if (/^ALTNAMES\s*=\s*(.*)/) { my @list = split(/\s/,$1); $altnames{$module} = \@list; next; } } } foreach $mod (sort keys %directories) { my $spec = sprintf("%s/%s.spec", $directories{$mod}, $mod); open SPEC,$spec or die "cannot open $spec"; $imports{$mod} = [ ]; while () { if (/^\#?import\s+(-delay\s+)?([a-zA-Z0-9_]+)\.dll/) { my $imp = $2; push @{$imports{$mod}}, $imp; next; } if (/^\#?import\s+(-delay\s+)?([a-zA-Z0-9_.]+)/) { my $imp = $2; push @{$imports{$mod}}, $imp; next; } } } open NEWMAKE,">Makefile.in.new" or die "cannot create Makefile.in.new"; ################################################################ # makefile header print NEWMAKE < directory rules print NEWMAKE <= 3) { $count = 0; $dep .= " \\\n "; } $dep .= sprintf(" lib%s.\$(LIBEXT)", $i); } $dep .= sprintf("\n\t\@cd %s && \$(MAKE) lib%s.\$(LIBEXT)\n\n",$directories{$mod}, $mod); push @depends, $dep; } print NEWMAKE sort @depends; ################################################################ # makefile trailer print NEWMAKE <