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`;
31 # list of special dlls that can be switched on or off by configure
35 "glu32" => "GLU32FILES",
36 "glut32" => "GLUT32FILES",
37 "opengl32" => "OPENGLFILES",
38 "d3d8" => "OPENGLFILES",
39 "d3d9" => "OPENGLFILES",
40 "d3dx8" => "OPENGLFILES",
41 "wined3d" => "OPENGLFILES",
45 foreach my $i (split(/\s/,$makefiles))
49 next if $i =~ /\/tests\
/Makefile.in/;
57 # EPP hack to disable this DLL... the MKDLL_SKIP comment must appear
58 # at the very top of the Makefile.in
59 last if (/^\#\s*MKDLL_SKIP/);
61 if (/^MODULE\s*=\s*([a-zA-Z0-9_.]+)/)
64 $imports{$module} = [ ];
65 ($directories{$module} = $i) =~ s/^\.\/(.*)\/[^\
/]+$/$1/;
68 if (/^ALTNAMES\s*=\s*(.*)/)
70 my @list = split(/\s/,$1);
71 $altnames{$module} = \
@list;
74 if (/^(DELAYIMPORTS|IMPORTS)\s*=\s*(.*)/)
76 my @list = map { /\./ ?
$_ : $_ . ".dll"; } split(/\s/,$2);
77 push @
{$imports{$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
121 print NEWMAKE
"# Subdir list\n\nBASEDIRS =";
122 foreach my $dir (sort values %directories)
124 next if defined($special_dlls{$dir}); # skip special dlls
125 printf NEWMAKE
" \\\n\t%s", $dir;
128 printf NEWMAKE
"\n\nSUBDIRS = \\\n\t\$(BASEDIRS)";
129 foreach my $dir (sort keys %special_dlls)
131 printf NEWMAKE
" \\\n\t%s", $dir;
133 printf NEWMAKE
<<EOF;
136 BUILDSUBDIRS = \$(BASEDIRS) \$(EXTRADIRS)
138 INSTALLSUBDIRS = \$(BUILDSUBDIRS)
141 ################################################################
142 # output the all: target
144 my %targets = (); # use a hash to get rid of duplicate target names
146 foreach my $mod (sort keys %directories)
148 next if defined($special_dlls{$directories{$mod}}); # skip special dlls
149 $targets{sprintf("%s\$(DLLEXT)",$mod)} = 1;
150 next unless defined $altnames{$mod};
151 foreach my $i (sort @
{$altnames{$mod}})
153 $targets16{sprintf("%s\$(DLLEXT)",$i)} = 1;
164 printf NEWMAKE
"\t%s\n", join( " \\\n\t", sort keys %targets16 );
169 \$(EXTRADIRS:%=%.dll\$(DLLEXT)) \\
172 printf NEWMAKE
"\t%s\n", join( " \\\n\t", sort keys %targets );
181 ################################################################
182 # output the lib name -> directory rules
186 # Map symlink name to the corresponding library
190 foreach my $mod (sort keys %directories)
192 printf NEWMAKE
"%s\$(DLLEXT): %s/%s\$(DLLEXT)\n", $mod, $directories{$mod}, $mod;
193 printf NEWMAKE
"\t\$(RM) \$@ && \$(LN_S) %s/%s\$(DLLEXT) \$@\n\n", $directories{$mod}, $mod;
195 if (defined $altnames{$mod})
198 foreach my $i (sort @
{$altnames{$mod}})
200 if ($count++ == 3) { printf NEWMAKE
"\\\n "; $count = 1; }
201 printf NEWMAKE
"%s\$(DLLEXT) ", $i;
203 printf NEWMAKE
": %s\$(DLLEXT)\n", $mod;
204 printf NEWMAKE
"\t\$(RM) \$@ && \$(LN_S) %s\$(DLLEXT) \$@\n\n", $mod;
209 ################################################################
210 # output the import libraries rules
212 my @implibs = grep /\.dll$/, keys %directories;
213 push @implibs, "winspool.drv";
215 print NEWMAKE
"\n# Import libraries\n\nIMPORT_LIBS =";
216 foreach my $mod (sort @implibs)
219 $def =~ s/\.(dll|drv)$//;
220 printf NEWMAKE
" \\\n\tlib%s", $def;
222 print NEWMAKE
"\n\n";
224 foreach my $mod (sort @implibs)
226 my $dir = $directories{$mod};
230 $def =~ s/\.(dll|drv)$//;
231 printf NEWMAKE
"lib%s.def: %s/%s.spec.def\n", $def, $dir, $spec;
232 printf NEWMAKE
"\t\$(RM) \$@ && \$(LN_S) %s/%s.spec.def \$@\n", $dir, $spec;
233 printf NEWMAKE
"lib%s.a: %s/%s.spec.def\n", $def, $dir, $spec;
234 printf NEWMAKE
"\t\$(DLLTOOL) -k -l \$@ -d %s/%s.spec.def\n\n", $dir, $spec;
236 foreach my $mod (sort @implibs)
238 my $dir = $directories{$mod};
241 printf NEWMAKE
"%s/%s.spec.def: \$(WINEBUILD)\n", $dir, $spec;
247 \$(SUBDIRS): \$(IMPORT_LIBS:%=%.\$(IMPLIBEXT))
248 \$(SUBDIRS:%=%/__install__): \$(IMPORT_LIBS:%=%.\$(IMPLIBEXT))
249 \$(SUBDIRS:%=%/__crosstest__): \$(IMPORT_LIBS:%=%.a)
253 ################################################################
254 # output the inter-dll dependencies and rules
256 print NEWMAKE
"# Map library name to the corresponding directory\n\n";
258 foreach my $mod (sort keys %directories)
260 printf NEWMAKE
"%s/%s\$(DLLEXT): %s\n", $directories{$mod}, $mod, $directories{$mod};
263 ################################################################
267 # Rules for auto documentation
269 \$(SUBDIRS:%=%/__man__): dummy
270 cd `dirname \$@` && \$(MAKE) man
272 man: \$(SUBDIRS:%=%/__man__)
274 \$(SUBDIRS:%=%/__doc_html__): dummy
275 cd `dirname \$@` && \$(MAKE) doc-html
277 doc-html: \$(SUBDIRS:%=%/__doc_html__)
279 \$(SUBDIRS:%=%/__doc_sgml__): dummy
280 cd `dirname \$@` && \$(MAKE) doc-sgml
282 doc-sgml: \$(SUBDIRS:%=%/__doc_sgml__)
284 .PHONY: man doc-html doc-sgml implib \$(SUBDIRS:%=%/__man__) \$(SUBDIRS:%=%/__doc_html__) \$(SUBDIRS:%=%/__doc_sgml__)
288 install install-dev:: \$(IMPORT_LIBS:%=%.\$(IMPLIBEXT))
289 \$(MKINSTALLDIRS) \$(dlldir)
290 for f in \$(IMPORT_LIBS:%=%.\$(IMPLIBEXT)); do \$(INSTALL_DATA) \$\$f \$(dlldir)/\$\$f; done
292 install install-lib:: \$(INSTALLSUBDIRS:%=%/__install__)
295 \$(RM) \$(IMPORT_LIBS:%=\$(dlldir)/%.\$(IMPLIBEXT))
298 implib: \$(IMPORT_LIBS:%=%.\$(IMPLIBEXT))
301 \$(RM) \$(IMPORT_LIBS:%=%.a) \$(IMPORT_LIBS:%=%.def) \$(SYMLINKS)
303 check test:: \$(BUILDSUBDIRS:%=%/__test__)
305 crosstest:: \$(BUILDSUBDIRS:%=%/__crosstest__)
307 checklink:: \$(BUILDSUBDIRS:%=%/__checklink__)
313 rename "Makefile.in.new", "Makefile.in";
314 printf "Successfully updated Makefile.in\n";