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
25 my $makefiles = `find . -name Makefile.in -print`;
32 # list of special dlls that can be switched on or off by configure
36 "glu32" => "GLU32FILES",
37 "opengl32" => "OPENGLFILES",
41 foreach my $i (split(/\s/,$makefiles))
51 # EPP hack to disable this DLL... the MKDLL_SKIP comment must appear
52 # at the very top of the Makefile.in
53 last if (/^\#\s*MKDLL_SKIP/);
55 if (/^MODULE\s*=\s*([a-zA-Z0-9_.]+)/)
58 $imports{$module} = [ ];
59 ($directories{$module} = $i) =~ s/^\.\/(.*)\/[^\
/]+$/$1/;
62 if (/^ALTNAMES\s*=\s*(.*)/)
64 my @list = split(/\s/,$1);
65 $altnames{$module} = \
@list;
68 if (/^(DELAYIMPORTS|IMPORTS)\s*=\s*(.*)/)
70 my @list = map { /\./ ?
$_ : $_ . ".dll"; } split(/\s/,$2);
71 push @
{$imports{$module}}, @list;
74 if (/^LDIMPORTS\s*=\s*(.*)/)
76 my @list = map { /\./ ?
$_ : $_ . ".dll"; } split(/\s/,$1);
77 $linked_dlls{$module} = \
@list;
82 push @
{$imports{$module}}, "kernel32.dll" unless !defined($module) || @
{$imports{$module}} || $module eq "ntdll.dll";
85 open NEWMAKE
,">Makefile.in.new" or die "cannot create Makefile.in.new";
87 ################################################################
91 # Automatically generated by make_dlls; DO NOT EDIT!!
93 TOPSRCDIR = \@top_srcdir\@
100 ################################################################
101 # output special dlls configure definitions
103 printf NEWMAKE
"# special configure-dependent targets\n\n";
105 foreach my $mod (sort keys %special_dlls)
107 $specials{$special_dlls{$mod}} .= " " . $mod;
109 foreach my $i (sort keys %specials)
111 printf NEWMAKE
"%s =%s\n", $i, $specials{$i};
113 printf NEWMAKE
"EXTRADIRS =";
114 foreach my $i (sort keys %specials) { printf NEWMAKE
" \@%s\@", $i; }
115 printf NEWMAKE
"\n\n";
118 ################################################################
119 # output the subdirs list
126 printf NEWMAKE
"\t\$(EXTRADIRS)";
127 foreach my $dir (sort values %directories)
129 next if defined($special_dlls{$dir}); # skip special dlls
130 printf NEWMAKE
" \\\n\t%s", $dir;
135 ################################################################
136 # output the all: target
138 my %targets = (); # use a hash to get rid of duplicate target names
139 foreach my $mod (sort keys %directories)
141 next if defined($special_dlls{$directories{$mod}}); # skip special dlls
142 $targets{sprintf("%s\$(DLLEXT)",$mod)} = 1;
143 next unless defined $altnames{$mod};
144 foreach my $i (sort @
{$altnames{$mod}})
146 $targets{sprintf("%s\$(DLLEXT)",$i)} = 1;
156 \$(EXTRADIRS:%=%.dll\$(DLLEXT)) \\
158 printf NEWMAKE
"\t%s\n", join( " \\\n\t", sort keys %targets );
161 ################################################################
162 # output the lib name -> directory rules
166 # Map library name to directory
170 foreach my $mod (sort keys %directories)
172 printf NEWMAKE
"%s\$(DLLEXT)", $mod;
173 if (defined $altnames{$mod})
176 foreach my $i (sort @
{$altnames{$mod}})
178 if (!($count++ % 3)) { printf NEWMAKE
" \\\n "; }
179 printf NEWMAKE
" %s\$(DLLEXT)", $i;
182 printf NEWMAKE
": %s/%s\$(DLLEXT)\n", $directories{$mod}, $mod;
183 printf NEWMAKE
"\t\$(RM) \$@ && \$(LN_S) %s/%s\$(DLLEXT) \$@\n\n", $directories{$mod}, $mod;
187 ################################################################
188 # output the inter-dll dependencies and rules
190 print NEWMAKE
"# Inter-dll dependencies\n\n";
193 foreach my $mod (sort keys %imports)
196 my $dep = sprintf("%s/%s\$(DLLEXT): dummy", $directories{$mod}, $mod);
197 foreach my $i (@
{$imports{$mod}})
204 $dep .= sprintf(" %s\$(DLLEXT)", $i);
206 foreach my $i (@
{$linked_dlls{$mod}})
213 $dep .= sprintf(" lib%s.\$(LIBEXT)", $i);
215 $dep .= sprintf("\n\t\@cd %s && \$(MAKE) %s\$(DLLEXT)\n\n",$directories{$mod}, $mod);
218 print NEWMAKE
sort @depends;
221 ################################################################
222 # output the linkable dlls special links
224 my %linkable_dlls = ();
225 foreach my $mod (keys %imports)
227 foreach my $i (@
{$linked_dlls{$mod}}) { $linkable_dlls{$i} = 1; }
230 print NEWMAKE
"# Special targets for dlls that we need to link to\n\n";
231 foreach my $mod (keys %linkable_dlls)
233 printf NEWMAKE
"lib%s.\$(LIBEXT): %s/%s\$(DLLEXT)\n", $mod, $directories{$mod}, $mod;
234 printf NEWMAKE
"\t\$(RM) \$@ && \$(LN_S) %s/%s\$(DLLEXT) \$@\n\n", $directories{$mod}, $mod;
237 ################################################################
243 \$(SUBDIRS:%=%/__checklink__): dummy
244 \@cd `dirname \$\@` && \$(MAKE) checklink
246 install:: \$(SUBDIRS:%=%/__install__)
248 uninstall:: \$(SUBDIRS:%=%/__uninstall__)
251 check test:: \$(SUBDIRS:%=%/__test__)
253 checklink:: \$(SUBDIRS:%=%/__checklink__)
257 rename "Makefile.in.new", "Makefile.in";
258 printf "Successfully updated Makefile.in\n";