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",
38 "d3d8" => "OPENGLFILES",
39 "d3dx8" => "OPENGLFILES",
43 foreach my $i (split(/\s/,$makefiles))
47 next if $i =~ /\/tests\
/Makefile.in/;
55 # EPP hack to disable this DLL... the MKDLL_SKIP comment must appear
56 # at the very top of the Makefile.in
57 last if (/^\#\s*MKDLL_SKIP/);
59 if (/^MODULE\s*=\s*([a-zA-Z0-9_.]+)/)
62 $imports{$module} = [ ];
63 ($directories{$module} = $i) =~ s/^\.\/(.*)\/[^\
/]+$/$1/;
66 if (/^ALTNAMES\s*=\s*(.*)/)
68 my @list = split(/\s/,$1);
69 $altnames{$module} = \
@list;
72 if (/^(DELAYIMPORTS|IMPORTS)\s*=\s*(.*)/)
74 my @list = map { /\./ ?
$_ : $_ . ".dll"; } split(/\s/,$2);
75 push @
{$imports{$module}}, @list;
78 if (/^LDIMPORTS\s*=\s*(.*)/)
80 my @list = map { /\./ ?
$_ : $_ . ".dll"; } split(/\s/,$1);
81 $linked_dlls{$module} = \
@list;
86 push @
{$imports{$module}}, "kernel32.dll" unless !defined($module) || @
{$imports{$module}} || $module eq "ntdll.dll";
89 open NEWMAKE
,">Makefile.in.new" or die "cannot create Makefile.in.new";
91 ################################################################
95 # Automatically generated by make_dlls; DO NOT EDIT!!
97 TOPSRCDIR = \@top_srcdir\@
104 ################################################################
105 # output special dlls configure definitions
107 printf NEWMAKE
"# special configure-dependent targets\n\n";
109 foreach my $mod (sort keys %special_dlls)
111 $specials{$special_dlls{$mod}} .= " " . $mod;
113 foreach my $i (sort keys %specials)
115 printf NEWMAKE
"%s =%s\n", $i, $specials{$i};
117 printf NEWMAKE
"EXTRADIRS =";
118 foreach my $i (sort keys %specials) { printf NEWMAKE
" \@%s\@", $i; }
119 printf NEWMAKE
"\n\n";
122 ################################################################
123 # output the subdirs list
125 print NEWMAKE
"# Subdir list\n\nBASEDIRS =";
126 foreach my $dir (sort values %directories)
128 next if defined($special_dlls{$dir}); # skip special dlls
129 printf NEWMAKE
" \\\n\t%s", $dir;
132 printf NEWMAKE
"\n\nSUBDIRS = \\\n\t\$(BASEDIRS)";
133 foreach my $dir (sort keys %special_dlls)
135 printf NEWMAKE
" \\\n\t%s", $dir;
137 printf NEWMAKE
<<EOF;
140 BUILDSUBDIRS = \$(BASEDIRS) \$(EXTRADIRS)
142 INSTALLSUBDIRS = \$(BUILDSUBDIRS)
145 ################################################################
146 # output the all: target
148 my %targets = (); # use a hash to get rid of duplicate target names
150 foreach my $mod (sort keys %directories)
152 next if defined($special_dlls{$directories{$mod}}); # skip special dlls
153 $targets{sprintf("%s\$(DLLEXT)",$mod)} = 1;
154 next unless defined $altnames{$mod};
155 foreach my $i (sort @
{$altnames{$mod}})
157 $targets16{sprintf("%s\$(DLLEXT)",$i)} = 1;
168 printf NEWMAKE
"\t%s\n", join( " \\\n\t", sort keys %targets16 );
173 \$(EXTRADIRS:%=%.dll\$(DLLEXT)) \\
176 printf NEWMAKE
"\t%s\n", join( " \\\n\t", sort keys %targets );
185 ################################################################
186 # output the lib name -> directory rules
190 # Map symlink name to the corresponding library
194 foreach my $mod (sort keys %directories)
196 printf NEWMAKE
"%s\$(DLLEXT)", $mod;
197 if (defined $altnames{$mod})
200 foreach my $i (sort @
{$altnames{$mod}})
202 if (!($count++ % 3)) { printf NEWMAKE
" \\\n "; }
203 printf NEWMAKE
" %s\$(DLLEXT)", $i;
206 printf NEWMAKE
": %s/%s\$(DLLEXT)\n", $directories{$mod}, $mod;
207 printf NEWMAKE
"\t\$(RM) \$@ && \$(LN_S) %s/%s\$(DLLEXT) \$@\n\n", $directories{$mod}, $mod;
211 ################################################################
212 # output the import libraries rules
214 my @implibs = grep /\.dll$/, keys %directories;
215 push @implibs, "winspool.drv";
217 print NEWMAKE
"\n# Import libraries\n\nIMPORT_LIBS =";
218 foreach my $mod (sort @implibs)
221 $def =~ s/\.(dll|drv)$//;
222 printf NEWMAKE
" \\\n\tlib%s", $def;
224 print NEWMAKE
"\n\n";
226 foreach my $mod (sort @implibs)
228 my $dir = $directories{$mod};
232 $def =~ s/\.(dll|drv)$//;
233 printf NEWMAKE
"lib%s.def: %s/%s.spec.def\n", $def, $dir, $spec;
234 printf NEWMAKE
"\t\$(RM) \$@ && \$(LN_S) %s/%s.spec.def \$@\n", $dir, $spec;
235 printf NEWMAKE
"lib%s.a: %s/%s.spec.def\n", $def, $dir, $spec;
236 printf NEWMAKE
"\t\$(DLLTOOL) -k -l \$@ -d %s/%s.spec.def\n\n", $dir, $spec;
238 foreach my $mod (sort @implibs)
240 my $dir = $directories{$mod};
243 printf NEWMAKE
"%s/%s.spec.def: \$(WINEBUILD)\n", $dir, $spec;
249 \$(SUBDIRS): \$(IMPORT_LIBS:%=%.\$(IMPLIBEXT))
250 \$(SUBDIRS:%=%/__install__): \$(IMPORT_LIBS:%=%.\$(IMPLIBEXT))
251 \$(SUBDIRS:%=%/__crosstest__): \$(IMPORT_LIBS:%=%.a)
255 ################################################################
256 # output the inter-dll dependencies and rules
258 print NEWMAKE
"# Map library name to the corresponding directory\n\n";
260 foreach my $mod (sort keys %directories)
262 printf NEWMAKE
"%s/%s\$(DLLEXT): %s\n", $directories{$mod}, $mod, $directories{$mod};
265 ################################################################
266 # output the linkable dlls special links
268 my %linkable_dlls = ();
269 foreach my $mod (keys %imports)
271 foreach my $i (@
{$linked_dlls{$mod}}) { $linkable_dlls{$i} = 1; }
274 print NEWMAKE
"\n# Special targets for dlls that we need to link to\n\n";
275 printf NEWMAKE
"LINKABLE_DLLS = %s\n\n", join( " ", keys %linkable_dlls );
277 foreach my $mod (keys %linkable_dlls)
279 printf NEWMAKE
"lib%s.\$(LIBEXT): %s/%s\$(DLLEXT)\n", $mod, $directories{$mod}, $mod;
280 printf NEWMAKE
"\t\$(RM) \$@ && \$(LN_S) %s/%s\$(DLLEXT) \$@\n\n", $directories{$mod}, $mod;
283 foreach my $mod (keys %imports)
286 foreach my $i (@
{$linked_dlls{$mod}}) { $deps .= " lib$i.\$(LIBEXT)"; }
287 if ($deps) { printf NEWMAKE
"%s:%s\n", $directories{$mod}, $deps; }
293 \$(RM) \$(LINKABLE_DLLS:%=\$(libdir)/lib%.\$(LIBEXT))
295 install install-lib:: \$(INSTALLSUBDIRS:%=%/__install__)
296 \$(RM) \$(LINKABLE_DLLS:%=\$(libdir)/lib%.\$(LIBEXT))
297 cd \$(libdir) && if [ "\$(dlldir)" = "\$(libdir)/wine" ]; \\
300 foreach my $mod (keys %linkable_dlls)
302 printf NEWMAKE
"\t \$(LN_S) wine/%s\$(DLLEXT) lib%s.\$(LIBEXT); \\\n", $mod, $mod;
304 print NEWMAKE
"\telse \\\n";
305 foreach my $mod (keys %linkable_dlls)
307 printf NEWMAKE
"\t \$(LN_S) \$(dlldir)/%s\$(DLLEXT) lib%s.\$(LIBEXT); \\\n", $mod, $mod;
309 print NEWMAKE
"\tfi\n\n";
311 ################################################################
315 # Rules for auto documentation
317 \$(SUBDIRS:%=%/__man__): dummy
318 cd `dirname \$@` && \$(MAKE) man
320 man: \$(SUBDIRS:%=%/__man__)
322 \$(SUBDIRS:%=%/__doc_html__): dummy
323 cd `dirname \$@` && \$(MAKE) doc-html
325 doc-html: \$(SUBDIRS:%=%/__doc_html__)
327 \$(SUBDIRS:%=%/__doc_sgml__): dummy
328 cd `dirname \$@` && \$(MAKE) doc-sgml
330 doc-sgml: \$(SUBDIRS:%=%/__doc_sgml__)
332 .PHONY: man doc-html doc-sgml \$(SUBDIRS:%=%/__man__) \$(SUBDIRS:%=%/__doc_html__) \$(SUBDIRS:%=%/__doc_sgml__)
336 install install-dev:: \$(IMPORT_LIBS:%=%.\$(IMPLIBEXT))
337 \$(MKINSTALLDIRS) \$(dlldir)
338 for f in \$(IMPORT_LIBS:%=%.\$(IMPLIBEXT)); do \$(INSTALL_DATA) \$\$f \$(dlldir)/\$\$f; done
341 \$(RM) \$(IMPORT_LIBS:%=\$(dlldir)/%.\$(IMPLIBEXT))
345 \$(RM) \$(IMPORT_LIBS:%=%.a) \$(IMPORT_LIBS:%=%.def) \$(SYMLINKS)
347 check test:: \$(BUILDSUBDIRS:%=%/__test__)
349 crosstest:: \$(BUILDSUBDIRS:%=%/__crosstest__)
351 checklink:: \$(BUILDSUBDIRS:%=%/__checklink__)
357 rename "Makefile.in.new", "Makefile.in";
358 printf "Successfully updated Makefile.in\n";