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;
73 open NEWMAKE,">Makefile.in.new" or die "cannot create Makefile.in.new";
75 ################################################################
79 # Automatically generated by make_dlls; DO NOT EDIT!!
81 TOPSRCDIR = \@top_srcdir\@
88 ################################################################
89 # output special dlls configure definitions
91 printf NEWMAKE "# special configure-dependent targets\n\n";
93 foreach $mod (sort keys %special_dlls)
95 $specials{$special_dlls{$mod}} .= " " . $mod;
97 foreach $i (sort keys %specials)
99 printf NEWMAKE "%s =%s\n", $i, $specials{$i};
101 printf NEWMAKE "EXTRADIRS =";
102 foreach $i (sort keys %specials) { printf NEWMAKE " \@%s\@", $i; }
103 printf NEWMAKE "\n\n";
106 ################################################################
107 # output the subdirs list
114 printf NEWMAKE "\t\$(EXTRADIRS)";
115 foreach $dir (sort values %directories)
117 next if defined($special_dlls{$dir}); # skip special dlls
118 printf NEWMAKE " \\\n\t%s", $dir;
123 ################################################################
124 # output the all: target
126 my %targets = (); # use a hash to get rid of duplicate target names
127 foreach $mod (sort keys %directories)
129 next if defined($special_dlls{$directories{$mod}}); # skip special dlls
130 $targets{sprintf("%s\$(DLLEXT)",$mod)} = 1;
131 next unless defined $altnames{$mod};
132 foreach $i (sort @{$altnames{$mod}})
134 $targets{sprintf("%s\$(DLLEXT)",$i)} = 1;
144 \$(EXTRADIRS:%=%.dll\$(DLLEXT)) \\
146 printf NEWMAKE "\t%s\n", join( " \\\n\t", sort keys %targets );
149 ################################################################
150 # output the lib name -> directory rules
154 # Map library name to directory
158 foreach $mod (sort keys %directories)
160 printf NEWMAKE "%s\$(DLLEXT)", $mod;
161 if (defined $altnames{$mod})
164 foreach $i (sort @{$altnames{$mod}})
166 if (!($count++ % 3)) { printf NEWMAKE " \\\n "; }
167 printf NEWMAKE " %s\$(DLLEXT)", $i;
170 printf NEWMAKE ": %s/%s\$(DLLEXT)\n", $directories{$mod}, $mod;
171 printf NEWMAKE "\t\$(RM) \$@ && \$(LN_S) %s/%s\$(DLLEXT) \$@\n\n", $directories{$mod}, $mod;
175 ################################################################
176 # output the inter-dll dependencies and rules
178 print NEWMAKE "# Inter-dll dependencies\n\n";
181 foreach $mod (sort keys %imports)
184 my $dep = sprintf("%s/%s\$(DLLEXT): dummy", $directories{$mod}, $mod);
185 foreach $i (@{$imports{$mod}})
192 $dep .= sprintf(" %s\$(DLLEXT)", $i);
194 foreach $i (@{$linked_dlls{$mod}})
201 $dep .= sprintf(" lib%s.\$(LIBEXT)", $i);
203 $dep .= sprintf("\n\t\@cd %s && \$(MAKE) %s\$(DLLEXT)\n\n",$directories{$mod}, $mod);
206 print NEWMAKE sort @depends;
209 ################################################################
210 # output the linkable dlls special links
213 foreach $mod (keys %imports)
215 foreach $i (@{$linked_dlls{$mod}}) { $linkable_dlls{$i} = 1; }
218 print NEWMAKE "# Special targets for dlls that we need to link to\n\n";
219 foreach $mod (keys %linkable_dlls)
221 printf NEWMAKE "lib%s.\$(LIBEXT): %s/%s\$(DLLEXT)\n", $mod, $directories{$mod}, $mod;
222 printf NEWMAKE "\t\$(RM) \$@ && \$(LN_S) %s/%s\$(DLLEXT) \$@\n\n", $directories{$mod}, $mod;
225 ################################################################
231 \$(SUBDIRS:%=%/__checklink__): dummy
232 \@cd `dirname \$\@` && \$(MAKE) checklink
234 install:: \$(SUBDIRS:%=%/__install__)
236 uninstall:: \$(SUBDIRS:%=%/__uninstall__)
239 check test:: \$(SUBDIRS:%=%/__test__)
241 checklink:: \$(SUBDIRS:%=%/__checklink__)
245 rename "Makefile.in.new", "Makefile.in";
246 printf "Successfully updated Makefile.in\n";