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`;
29 # list of special dlls that can be switched on or off by configure
33 "glu32" => "GLU32FILES",
34 "opengl32" => "OPENGLFILES",
38 foreach $i (split(/\s/,$makefiles))
44 if (/^MODULE\s*=\s*([a-zA-Z0-9_.]+)/)
47 ($directories{$module} = $i) =~ s/^\.\/(.*)\/[^\
/]+$/$1/;
50 if (/^ALTNAMES\s*=\s*(.*)/)
52 my @list = split(/\s/,$1);
53 $altnames{$module} = \
@list;
59 foreach $mod (sort keys %directories)
61 my $spec = sprintf("%s/%s.spec", $directories{$mod}, $mod);
62 open SPEC
,$spec or die "cannot open $spec";
66 if (/^\#?import\s+(-delay\s+)?([a-zA-Z0-9_]+)\.dll/)
69 push @
{$imports{$mod}}, $imp;
72 if (/^\#?import\s+(-delay\s+)?([a-zA-Z0-9_.]+)/)
75 push @
{$imports{$mod}}, $imp;
81 open NEWMAKE
,">Makefile.in.new" or die "cannot create Makefile.in.new";
83 ################################################################
87 # Automatically generated by make_dlls; DO NOT EDIT!!
89 TOPSRCDIR = \@top_srcdir\@
97 ################################################################
98 # output special dlls configure definitions
100 printf NEWMAKE
"# special configure-dependent targets\n\n";
102 foreach $mod (sort keys %special_dlls)
104 $specials{$special_dlls{$mod}} .= " " . $mod;
106 foreach $i (sort keys %specials)
108 printf NEWMAKE
"%s =%s\n", $i, $specials{$i};
110 printf NEWMAKE
"EXTRADIRS =";
111 foreach $i (sort keys %specials) { printf NEWMAKE
" \@%s\@", $i; }
112 printf NEWMAKE
"\n\n";
115 ################################################################
116 # output the subdirs list
123 printf NEWMAKE
"\t\$(EXTRADIRS)";
124 foreach $dir (sort values %directories)
126 next if defined($special_dlls{$dir}); # skip special dlls
127 printf NEWMAKE
" \\\n\t%s", $dir;
132 ################################################################
133 # output the all: target
135 my %targets = (); # use a hash to get rid of duplicate target names
136 foreach $mod (sort keys %directories)
138 next if defined($special_dlls{$mod}); # skip special dlls
139 $targets{sprintf("lib%s.\$(LIBEXT)",$mod)} = 1;
140 next unless defined $altnames{$mod};
141 foreach $i (sort @
{$altnames{$mod}})
143 $targets{sprintf("lib%s.\$(LIBEXT)",$i)} = 1;
151 \$(EXTRADIRS:%=lib%.\$(LIBEXT)) \\
153 printf NEWMAKE
"\t%s\n", join( " \\\n\t", sort keys %targets );
156 ################################################################
157 # output the lib name -> directory rules
163 # Map library name to directory
167 foreach $mod (sort keys %directories)
169 printf NEWMAKE
"lib%s.\$(LIBEXT)", $mod;
170 if (defined $altnames{$mod})
173 foreach $i (sort @
{$altnames{$mod}})
175 if (!($count++ % 3)) { printf NEWMAKE
" \\\n "; }
176 printf NEWMAKE
" lib%s.\$(LIBEXT)", $i;
179 printf NEWMAKE
": %s/lib%s.\$(LIBEXT)\n", $directories{$mod}, $mod;
180 printf NEWMAKE
"\t\$(RM) \$@ && \$(LN_S) %s/lib%s.\$(LIBEXT) \$@\n\n", $directories{$mod}, $mod;
184 ################################################################
185 # output the inter-dll dependencies and rules
187 print NEWMAKE
"# Inter-dll dependencies\n\n";
190 foreach $mod (sort keys %imports)
193 my $dep = sprintf("%s/lib%s.\$(LIBEXT): dummy", $directories{$mod}, $mod);
194 foreach $i (@
{$imports{$mod}})
201 $dep .= sprintf(" lib%s.\$(LIBEXT)", $i);
203 $dep .= sprintf("\n\t\@cd %s && \$(MAKE) lib%s.\$(LIBEXT)\n\n",$directories{$mod}, $mod);
206 print NEWMAKE
sort @depends;
209 ################################################################
215 \$(SUBDIRS:%=%/__test__): dummy
216 \@cd `dirname \$\@` && \$(MAKE) test
218 \$(SUBDIRS:%=%/__checklink__): dummy
219 \@cd `dirname \$\@` && \$(MAKE) checklink
221 \$(SUBDIRS:%=%/__debug_channels__): dummy
222 \@cd `dirname \$\@` && \$(MAKE) debug_channels
224 install:: \$(SUBDIRS:%=%/__install__)
226 uninstall:: \$(SUBDIRS:%=%/__uninstall__)
228 check test:: \$(SUBDIRS:%=%/__test__)
230 checklink:: \$(SUBDIRS:%=%/__checklink__)
232 debug_channels:: \$(SUBDIRS:%=%/__debug_channels__)
236 rename "Makefile.in.new", "Makefile.in";
237 printf "Successfully updated Makefile.in\n";