3 # Update the dll dependencies in the dlls main Makefile.in.
4 # Must be run in the dlls/ directory of the Wine tree.
6 # Copyright 2001 Alexandre Julliard
9 $makefiles = `find . -name Makefile.in -print`;
15 foreach $i (split(/\s/,$makefiles))
21 if (/^MODULE\s*=\s*([a-zA-Z0-9_.]+)/)
24 ($directories{$module} = $i) =~ s/^\.\/(.*)\/[^\/]+$/$1/;
27 if (/^ALTNAMES\s*=\s*(.*)/)
29 my @list = split(/\s/,$1);
30 $altnames{$module} = \@list;
36 foreach $mod (sort keys %directories)
38 my $spec = sprintf("%s/%s.spec", $directories{$mod}, $mod);
39 open SPEC,$spec or die "cannot open $spec";
43 if (/^\#?import\s+(-delay\s+)?([a-zA-Z0-9_]+)\.dll/)
46 push @{$imports{$mod}}, $imp;
49 if (/^\#?import\s+(-delay\s+)?([a-zA-Z0-9_.]+)/)
52 push @{$imports{$mod}}, $imp;
58 open OLDMAKE,"Makefile.in" or die "cannot open Makefile.in";
59 open NEWMAKE,">Makefile.in.new" or die "cannot create Makefile.in.new";
63 last if (/^EXTRADLLNAMES/);
68 printf NEWMAKE "EXTRADLLNAMES =";
69 foreach $extra (values %altnames) { push @extra, @$extra; }
70 foreach $extra (sort @extra)
72 printf NEWMAKE " \\\n\t%s", $extra;
75 printf NEWMAKE "\n\nSUBDIRS =";
76 foreach $dir (sort values %directories)
78 printf NEWMAKE " \\\n\t%s", $dir;
86 all: \$(DLLS:%=lib%.\@LIBEXT\@) \$(EXTRADLLNAMES:%=lib%.\@LIBEXT\@)
88 # Map library name to directory
92 foreach $mod (sort keys %directories)
95 printf NEWMAKE "lib%s.\@LIBEXT\@", $mod;
96 foreach $i (sort @{$altnames{$mod}})
101 printf NEWMAKE " \\\n ";
103 printf NEWMAKE " lib%s.\@LIBEXT\@", $i;
105 printf NEWMAKE ": %s/lib%s.\@LIBEXT\@\n", $directories{$mod}, $mod;
106 printf NEWMAKE "\t\$(RM) \$@ && \$(LN_S) %s/lib%s.\@LIBEXT\@ \$@\n\n", $directories{$mod}, $mod;
109 print NEWMAKE "# Inter-dll dependencies (only necessary for dynamic libs)\n\n";
112 foreach $mod (sort keys %imports)
114 next unless $#{$imports{$mod}} >= 0;
115 my $dep = sprintf("%s/lib%s.\@LIBEXT\@:", $directories{$mod}, $mod);
116 foreach $i (@{$imports{$mod}})
118 $dep .= sprintf(" lib%s.\@LIBEXT\@", $i);
120 push @depends, $dep . "\n";
122 print NEWMAKE sort @depends;
127 \@cd `dirname \$\@` && \$(MAKE)
129 \$(DLLFILES:%=%_install_): dummy
130 \@cd `dirname \$\@` && \$(MAKE) install
132 \$(DLLFILES:%=%_uninstall_): dummy
133 \@cd `dirname \$\@` && \$(MAKE) uninstall
135 \$(DLLFILES:%=%_checklink_): dummy
136 \@cd `dirname \$\@` && \$(MAKE) checklink
138 install:: \$(DLLFILES:%=%_install_)
140 uninstall:: \$(DLLFILES:%=%_uninstall_)
142 checklink:: \$(DLLFILES:%=%_checklink_)
146 rename "Makefile.in.new", "Makefile.in";
147 printf "Successfully updated Makefile.in\n";