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 $imports{$module} = [ ];
49 ($directories{$module} = $i) =~ s/^\.\/(.*)\/[^\/]+$/$1/;
52 if (/^ALTNAMES\s*=\s*(.*)/)
54 my @list = split(/\s/,$1);
55 $altnames{$module} = \@list;
58 if (/^(DELAYIMPORTS|IMPORTS)\s*=\s*(.*)/)
60 my @list = map { /\./ ? $_ : $_ . ".dll"; } split(/\s/,$2);
61 push @{$imports{$module}}, @list;
64 if (/^LDIMPORTS\s*=\s*(.*)/)
66 my @list = map { /\./ ? $_ : $_ . ".dll"; } split(/\s/,$1);
67 $linked_dlls{$module} = \@list;
71 push @{$imports{$module}}, "kernel32.dll" unless @{$imports{$module}} || $module eq "ntdll.dll";
74 open NEWMAKE,">Makefile.in.new" or die "cannot create Makefile.in.new";
76 ################################################################
80 # Automatically generated by make_dlls; DO NOT EDIT!!
82 TOPSRCDIR = \@top_srcdir\@
89 ################################################################
90 # output special dlls configure definitions
92 printf NEWMAKE "# special configure-dependent targets\n\n";
94 foreach $mod (sort keys %special_dlls)
96 $specials{$special_dlls{$mod}} .= " " . $mod;
98 foreach $i (sort keys %specials)
100 printf NEWMAKE "%s =%s\n", $i, $specials{$i};
102 printf NEWMAKE "EXTRADIRS =";
103 foreach $i (sort keys %specials) { printf NEWMAKE " \@%s\@", $i; }
104 printf NEWMAKE "\n\n";
107 ################################################################
108 # output the subdirs list
115 printf NEWMAKE "\t\$(EXTRADIRS)";
116 foreach $dir (sort values %directories)
118 next if defined($special_dlls{$dir}); # skip special dlls
119 printf NEWMAKE " \\\n\t%s", $dir;
124 ################################################################
125 # output the all: target
127 my %targets = (); # use a hash to get rid of duplicate target names
128 foreach $mod (sort keys %directories)
130 next if defined($special_dlls{$directories{$mod}}); # skip special dlls
131 $targets{sprintf("%s\$(DLLEXT)",$mod)} = 1;
132 next unless defined $altnames{$mod};
133 foreach $i (sort @{$altnames{$mod}})
135 $targets{sprintf("%s\$(DLLEXT)",$i)} = 1;
145 \$(EXTRADIRS:%=%.dll\$(DLLEXT)) \\
147 printf NEWMAKE "\t%s\n", join( " \\\n\t", sort keys %targets );
150 ################################################################
151 # output the lib name -> directory rules
155 # Map library name to directory
159 foreach $mod (sort keys %directories)
161 printf NEWMAKE "%s\$(DLLEXT)", $mod;
162 if (defined $altnames{$mod})
165 foreach $i (sort @{$altnames{$mod}})
167 if (!($count++ % 3)) { printf NEWMAKE " \\\n "; }
168 printf NEWMAKE " %s\$(DLLEXT)", $i;
171 printf NEWMAKE ": %s/%s\$(DLLEXT)\n", $directories{$mod}, $mod;
172 printf NEWMAKE "\t\$(RM) \$@ && \$(LN_S) %s/%s\$(DLLEXT) \$@\n\n", $directories{$mod}, $mod;
176 ################################################################
177 # output the inter-dll dependencies and rules
179 print NEWMAKE "# Inter-dll dependencies\n\n";
182 foreach $mod (sort keys %imports)
185 my $dep = sprintf("%s/%s\$(DLLEXT): dummy", $directories{$mod}, $mod);
186 foreach $i (@{$imports{$mod}})
193 $dep .= sprintf(" %s\$(DLLEXT)", $i);
195 foreach $i (@{$linked_dlls{$mod}})
202 $dep .= sprintf(" lib%s.\$(LIBEXT)", $i);
204 $dep .= sprintf("\n\t\@cd %s && \$(MAKE) %s\$(DLLEXT)\n\n",$directories{$mod}, $mod);
207 print NEWMAKE sort @depends;
210 ################################################################
211 # output the linkable dlls special links
214 foreach $mod (keys %imports)
216 foreach $i (@{$linked_dlls{$mod}}) { $linkable_dlls{$i} = 1; }
219 print NEWMAKE "# Special targets for dlls that we need to link to\n\n";
220 foreach $mod (keys %linkable_dlls)
222 printf NEWMAKE "lib%s.\$(LIBEXT): %s/%s\$(DLLEXT)\n", $mod, $directories{$mod}, $mod;
223 printf NEWMAKE "\t\$(RM) \$@ && \$(LN_S) %s/%s\$(DLLEXT) \$@\n\n", $directories{$mod}, $mod;
226 ################################################################
232 \$(SUBDIRS:%=%/__checklink__): dummy
233 \@cd `dirname \$\@` && \$(MAKE) checklink
235 install:: \$(SUBDIRS:%=%/__install__)
237 uninstall:: \$(SUBDIRS:%=%/__uninstall__)
240 check test:: \$(SUBDIRS:%=%/__test__)
242 checklink:: \$(SUBDIRS:%=%/__checklink__)
246 rename "Makefile.in.new", "Makefile.in";
247 printf "Successfully updated Makefile.in\n";