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 if ($module =~ /^lib.*\.a$/)
66 ($implib_dirs{$module} = $i) =~ s/^\.\/(.*)\/[^\/]+$/$1/;
70 ($directories{$module} = $i) =~ s/^\.\/(.*)\/[^\/]+$/$1/;
74 if (/^SPEC_SRCS16\s*=\s*(.*)/)
77 while ($specs =~ /\s*(.*)\\$/) { $specs = $1 . <MAKE>; }
78 my @list = split(/\s+/,$specs);
79 @list = map { $_ =~ s/\.spec$//; $_ .= ".dll" unless $_ =~ /\./; $_; } @list;
80 $altnames{$module} = \@list;
87 open NEWMAKE,">Makefile.in.new" or die "cannot create Makefile.in.new";
89 ################################################################
93 # Automatically generated by make_dlls; DO NOT EDIT!!
95 TOPSRCDIR = \@top_srcdir\@
102 ################################################################
103 # output special dlls configure definitions
105 printf NEWMAKE "# special configure-dependent targets\n\n";
107 foreach my $mod (sort keys %special_dlls)
109 $specials{$special_dlls{$mod}} .= " " . $mod;
111 foreach my $i (sort keys %specials)
113 printf NEWMAKE "%s =%s\n", $i, $specials{$i};
115 printf NEWMAKE "EXTRADIRS =";
116 foreach my $i (sort keys %specials) { printf NEWMAKE " \@%s\@", $i; }
117 printf NEWMAKE "\n\n";
120 ################################################################
121 # output the subdirs list
123 print NEWMAKE "# Subdir list\n\nBASEDIRS =";
124 foreach my $dir (sort values %directories)
126 next if defined($special_dlls{$dir}); # skip special dlls
127 printf NEWMAKE " \\\n\t%s", $dir;
130 printf NEWMAKE "\n\nSUBDIRS = \\\n\t\$(BASEDIRS)";
131 foreach my $dir (sort (keys %special_dlls, values %implib_dirs))
133 printf NEWMAKE " \\\n\t%s", $dir;
135 printf NEWMAKE <<EOF;
138 BUILDSUBDIRS = \$(BASEDIRS) \$(EXTRADIRS)
140 INSTALLSUBDIRS = \$(BUILDSUBDIRS)
143 ################################################################
144 # output the all: target
146 my %targets = (); # use a hash to get rid of duplicate target names
148 foreach my $mod (sort keys %directories)
150 next if defined($special_dlls{$directories{$mod}}); # skip special dlls
151 $targets{$mod . ".so"} = 1;
152 next unless defined $altnames{$mod};
153 foreach my $i (sort @{$altnames{$mod}})
155 $targets16{sprintf("%s.so",$i)} = 1;
158 foreach my $mod (sort keys %implib_dirs) { $targets{$mod} = 1; }
168 printf NEWMAKE "\t%s\n", join( " \\\n\t", sort keys %targets16 );
173 \$(EXTRADIRS:%=%.dll.so) \\
176 printf NEWMAKE "\t%s\n", join( " \\\n\t", sort keys %targets );
182 all: symlinks\$(DLLEXT)
184 .PHONY: symlinks symlinks.so implib
186 symlinks.so: \$(SYMLINKS_SO)
188 symlinks: \$(BUILDSUBDIRS)
190 x11drv.dll.so: winex11.drv.so
191 \$(RM) \$@ && \$(LN_S) winex11.drv.so \$@
195 ################################################################
196 # output the lib name -> directory rules
200 # Map symlink name to the corresponding library
204 foreach my $mod (sort keys %directories)
206 printf NEWMAKE "%s.so: %s/%s.so\n", $mod, $directories{$mod}, $mod;
207 printf NEWMAKE "\t\$(RM) \$@ && \$(LN_S) %s/%s.so \$@\n\n", $directories{$mod}, $mod;
209 if (defined $altnames{$mod})
212 foreach my $i (sort @{$altnames{$mod}})
214 if ($count++ == 3) { printf NEWMAKE "\\\n "; $count = 1; }
215 printf NEWMAKE "%s.so ", $i;
217 printf NEWMAKE ": %s.so\n", $mod;
218 printf NEWMAKE "\t\$(RM) \$@ && \$(LN_S) %s.so \$@\n\n", $mod;
221 foreach my $mod (sort keys %implib_dirs)
223 printf NEWMAKE "%s: %s/%s\n", $mod, $implib_dirs{$mod}, $mod;
224 printf NEWMAKE "\t\$(RM) \$@ && \$(LN_S) %s/%s \$@\n\n", $implib_dirs{$mod}, $mod;
227 ################################################################
228 # output the import libraries rules
230 my @implibs = grep /\.dll$/, keys %directories;
231 push @implibs, "winspool.drv";
233 print NEWMAKE "\n# Import libraries\n\nIMPORT_LIBS =";
234 foreach my $mod (sort @implibs)
237 $def =~ s/\.(dll|drv)$//;
238 printf NEWMAKE " \\\n\tlib%s.\$(IMPLIBEXT)", $def;
240 foreach my $mod (sort keys %implib_dirs)
242 printf NEWMAKE " \\\n\t%s", $mod;
244 print NEWMAKE "\n\n";
245 print NEWMAKE "implib: \$(IMPORT_LIBS)\n\n";
247 foreach my $mod (sort @implibs)
249 my $dir = $directories{$mod};
253 $def =~ s/\.(dll|drv)$//;
254 printf NEWMAKE "lib%s.def: %s/lib%s.def\n", $def, $dir, $spec;
255 printf NEWMAKE "\t\$(RM) \$@ && \$(LN_S) %s/lib%s.def \$@\n", $dir, $spec;
256 printf NEWMAKE "lib%s.a: %s/lib%s.a\n", $def, $dir, $spec;
257 printf NEWMAKE "\t\$(RM) \$@ && \$(LN_S) %s/lib%s.a \$@\n", $dir, $spec;
258 printf NEWMAKE "%s/lib%s.def: %s/%s.spec \$(WINEBUILD)\n", $dir, $spec, $dir, $spec;
259 printf NEWMAKE "\t\$(WINEBUILD) -w --def -o \$@ --export \$(SRCDIR)/%s/%s.spec\n", $dir, $spec;
260 printf NEWMAKE "%s/lib%s.a: %s/lib%s.def\n", $dir, $spec, $dir, $spec;
261 printf NEWMAKE "\t\$(DLLTOOL) -k -l \$@ -d %s/lib%s.def\n\n", $dir, $spec;
266 \$(BUILDSUBDIRS): \$(IMPORT_LIBS)
267 \$(INSTALLSUBDIRS:%=%/__install__): \$(IMPORT_LIBS)
271 ################################################################
272 # output the inter-dll dependencies and rules
274 print NEWMAKE "# Map library name to the corresponding directory\n\n";
276 foreach my $mod (sort keys %directories)
278 printf NEWMAKE "%s/%s.so: %s\n", $directories{$mod}, $mod, $directories{$mod};
280 foreach my $mod (sort keys %implib_dirs)
282 printf NEWMAKE "%s/%s: %s\n", $implib_dirs{$mod}, $mod, $implib_dirs{$mod};
285 ################################################################
290 # Rules for auto documentation
292 \$(SUBDIRS:%=%/__man__): dummy
293 cd `dirname \$@` && \$(MAKE) man
295 man: \$(SUBDIRS:%=%/__man__)
297 \$(SUBDIRS:%=%/__doc_html__): dummy
298 cd `dirname \$@` && \$(MAKE) doc-html
300 doc-html: \$(SUBDIRS:%=%/__doc_html__)
302 \$(SUBDIRS:%=%/__doc_sgml__): dummy
303 cd `dirname \$@` && \$(MAKE) doc-sgml
305 doc-sgml: \$(SUBDIRS:%=%/__doc_sgml__)
307 .PHONY: man doc-html doc-sgml \$(SUBDIRS:%=%/__man__) \$(SUBDIRS:%=%/__doc_html__) \$(SUBDIRS:%=%/__doc_sgml__)
311 install-lib:: \$(INSTALLSUBDIRS:%=%/__install-lib__)
313 install-dev:: \$(INSTALLSUBDIRS:%=%/__install-dev__)
319 \$(RM) \$(IMPORT_LIBS)
321 check test:: \$(BUILDSUBDIRS:%=%/__test__)
323 crosstest:: \$(BUILDSUBDIRS:%=%/__crosstest__)
325 checklink:: \$(BUILDSUBDIRS:%=%/__checklink__)
331 rename "Makefile.in.new", "Makefile.in";
332 printf "Successfully updated Makefile.in\n";