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
8 # This library is free software; you can redistribute it and/or
9 # modify it under the terms of the GNU Lesser General Public
10 # License as published by the Free Software Foundation; either
11 # version 2.1 of the License, or (at your option) any later version.
13 # This library is distributed in the hope that it will be useful,
14 # but WITHOUT ANY WARRANTY; without even the implied warranty of
15 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 # Lesser General Public License for more details.
18 # You should have received a copy of the GNU Lesser General Public
19 # License along with this library; if not, write to the Free Software
20 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
23 $makefiles = `find . -name Makefile.in -print`;
30 # list of special dlls that can be switched on or off by configure
34 "glu32" => "GLU32FILES",
35 "opengl32" => "OPENGLFILES",
39 foreach $i (split(/\s/,$makefiles))
45 if (/^MODULE\s*=\s*([a-zA-Z0-9_.]+)/)
48 ($directories{$module} = $i) =~ s/^\.\/(.*)\/[^\/]+$/$1/;
51 if (/^ALTNAMES\s*=\s*(.*)/)
53 my @list = split(/\s/,$1);
54 $altnames{$module} = \@list;
57 if (/^IMPORTS\s*=\s*(.*)/)
59 my @list = split(/\s/,$1);
60 $linked_dlls{$module} = \@list;
66 foreach $mod (sort keys %directories)
70 my $spec = sprintf("%s/%s.spec", $directories{$mod}, $dll);
71 open SPEC,$spec or die "cannot open $spec";
75 if (/^\#?import\s+(-delay\s+)?([a-zA-Z0-9_]+)\.dll/)
77 my $imp = $2 . ".dll";
78 push @{$imports{$mod}}, $imp;
81 if (/^\#?import\s+(-delay\s+)?([a-zA-Z0-9_.]+)/)
84 $imp .= ".dll" unless ($imp =~ /\./);
85 push @{$imports{$mod}}, $imp;
91 open NEWMAKE,">Makefile.in.new" or die "cannot create Makefile.in.new";
93 ################################################################
97 # Automatically generated by make_dlls; DO NOT EDIT!!
99 TOPSRCDIR = \@top_srcdir\@
106 ################################################################
107 # output special dlls configure definitions
109 printf NEWMAKE "# special configure-dependent targets\n\n";
111 foreach $mod (sort keys %special_dlls)
113 $specials{$special_dlls{$mod}} .= " " . $mod;
115 foreach $i (sort keys %specials)
117 printf NEWMAKE "%s =%s\n", $i, $specials{$i};
119 printf NEWMAKE "EXTRADIRS =";
120 foreach $i (sort keys %specials) { printf NEWMAKE " \@%s\@", $i; }
121 printf NEWMAKE "\n\n";
124 ################################################################
125 # output the subdirs list
132 printf NEWMAKE "\t\$(EXTRADIRS)";
133 foreach $dir (sort values %directories)
135 next if defined($special_dlls{$dir}); # skip special dlls
136 printf NEWMAKE " \\\n\t%s", $dir;
141 ################################################################
142 # output the all: target
144 my %targets = (); # use a hash to get rid of duplicate target names
145 foreach $mod (sort keys %directories)
147 next if defined($special_dlls{$directories{$mod}}); # skip special dlls
148 $targets{sprintf("%s\$(DLLEXT)",$mod)} = 1;
149 next unless defined $altnames{$mod};
150 foreach $i (sort @{$altnames{$mod}})
152 $targets{sprintf("%s\$(DLLEXT)",$i)} = 1;
162 \$(EXTRADIRS:%=%.dll\$(DLLEXT)) \\
164 printf NEWMAKE "\t%s\n", join( " \\\n\t", sort keys %targets );
167 ################################################################
168 # output the lib name -> directory rules
172 # Map library name to directory
176 foreach $mod (sort keys %directories)
178 printf NEWMAKE "%s\$(DLLEXT)", $mod;
179 if (defined $altnames{$mod})
182 foreach $i (sort @{$altnames{$mod}})
184 if (!($count++ % 3)) { printf NEWMAKE " \\\n "; }
185 printf NEWMAKE " %s\$(DLLEXT)", $i;
188 printf NEWMAKE ": %s/%s\$(DLLEXT)\n", $directories{$mod}, $mod;
189 printf NEWMAKE "\t\$(RM) \$@ && \$(LN_S) %s/%s\$(DLLEXT) \$@\n\n", $directories{$mod}, $mod;
193 ################################################################
194 # output the inter-dll dependencies and rules
196 print NEWMAKE "# Inter-dll dependencies\n\n";
199 foreach $mod (sort keys %imports)
202 my $dep = sprintf("%s/%s\$(DLLEXT): dummy", $directories{$mod}, $mod);
203 foreach $i (@{$imports{$mod}})
210 $dep .= sprintf(" %s\$(DLLEXT)", $i);
212 foreach $i (@{$linked_dlls{$mod}})
219 $dep .= sprintf(" lib%s.\$(LIBEXT)", $i);
221 $dep .= sprintf("\n\t\@cd %s && \$(MAKE) %s\$(DLLEXT)\n\n",$directories{$mod}, $mod);
224 print NEWMAKE sort @depends;
227 ################################################################
228 # output the linkable dlls special links
231 foreach $mod (keys %imports)
233 foreach $i (@{$linked_dlls{$mod}}) { $linkable_dlls{$i} = 1; }
236 print NEWMAKE "# Special targets for dlls that we need to link to\n\n";
237 foreach $mod (keys %linkable_dlls)
239 printf NEWMAKE "lib%s.\$(LIBEXT): %s/%s\$(DLLEXT)\n", $mod, $directories{$mod}, $mod;
240 printf NEWMAKE "\t\$(RM) \$@ && \$(LN_S) %s/%s\$(DLLEXT) \$@\n\n", $directories{$mod}, $mod;
243 ################################################################
249 \$(SUBDIRS:%=%/__checklink__): dummy
250 \@cd `dirname \$\@` && \$(MAKE) checklink
252 \$(SUBDIRS:%=%/__debug_channels__): dummy
253 \@cd `dirname \$\@` && \$(MAKE) debug_channels
255 install:: \$(SUBDIRS:%=%/__install__)
257 uninstall:: \$(SUBDIRS:%=%/__uninstall__)
260 check test:: \$(SUBDIRS:%=%/__test__)
262 checklink:: \$(SUBDIRS:%=%/__checklink__)
264 debug_channels:: \$(SUBDIRS:%=%/__debug_channels__)
268 rename "Makefile.in.new", "Makefile.in";
269 printf "Successfully updated Makefile.in\n";