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
9 $makefiles = `find . -name Makefile.in -print`;
15 # list of special dlls that can be switched on or off by configure
19 "glu32" => "GLU32FILES",
20 "opengl32" => "OPENGLFILES",
24 foreach $i (split(/\s/,$makefiles))
30 if (/^MODULE\s*=\s*([a-zA-Z0-9_.]+)/)
33 ($directories{$module} = $i) =~ s/^\.\/(.*)\/[^\/]+$/$1/;
36 if (/^ALTNAMES\s*=\s*(.*)/)
38 my @list = split(/\s/,$1);
39 $altnames{$module} = \@list;
45 foreach $mod (sort keys %directories)
47 my $spec = sprintf("%s/%s.spec", $directories{$mod}, $mod);
48 open SPEC,$spec or die "cannot open $spec";
52 if (/^\#?import\s+(-delay\s+)?([a-zA-Z0-9_]+)\.dll/)
55 push @{$imports{$mod}}, $imp;
58 if (/^\#?import\s+(-delay\s+)?([a-zA-Z0-9_.]+)/)
61 push @{$imports{$mod}}, $imp;
67 open NEWMAKE,">Makefile.in.new" or die "cannot create Makefile.in.new";
69 ################################################################
73 # Automatically generated by make_dlls; DO NOT EDIT!!
75 TOPSRCDIR = \@top_srcdir\@
83 ################################################################
84 # output special dlls configure definitions
86 printf NEWMAKE "# special configure-dependent targets\n\n";
88 foreach $mod (sort keys %special_dlls)
90 $specials{$special_dlls{$mod}} .= " " . $mod;
92 foreach $i (sort keys %specials)
94 printf NEWMAKE "%s =%s\n", $i, $specials{$i};
96 printf NEWMAKE "EXTRADIRS =";
97 foreach $i (sort keys %specials) { printf NEWMAKE " \@%s\@", $i; }
98 printf NEWMAKE "\n\n";
101 ################################################################
102 # output the subdirs list
109 printf NEWMAKE "\t\$(EXTRADIRS)";
110 foreach $dir (sort values %directories)
112 next if defined($special_dlls{$dir}); # skip special dlls
113 printf NEWMAKE " \\\n\t%s", $dir;
118 ################################################################
119 # output the all: target
121 my %targets = (); # use a hash to get rid of duplicate target names
122 foreach $mod (sort keys %directories)
124 next if defined($special_dlls{$mod}); # skip special dlls
125 $targets{sprintf("lib%s.\$(LIBEXT)",$mod)} = 1;
126 next unless defined $altnames{$mod};
127 foreach $i (sort @{$altnames{$mod}})
129 $targets{sprintf("lib%s.\$(LIBEXT)",$i)} = 1;
137 \$(EXTRADIRS:%=lib%.\$(LIBEXT)) \\
139 printf NEWMAKE "\t%s\n", join( " \\\n\t", sort keys %targets );
142 ################################################################
143 # output the lib name -> directory rules
149 # Map library name to directory
153 foreach $mod (sort keys %directories)
155 printf NEWMAKE "lib%s.\$(LIBEXT)", $mod;
156 if (defined $altnames{$mod})
159 foreach $i (sort @{$altnames{$mod}})
161 if (!($count++ % 3)) { printf NEWMAKE " \\\n "; }
162 printf NEWMAKE " lib%s.\$(LIBEXT)", $i;
165 printf NEWMAKE ": %s/lib%s.\$(LIBEXT)\n", $directories{$mod}, $mod;
166 printf NEWMAKE "\t\$(RM) \$@ && \$(LN_S) %s/lib%s.\$(LIBEXT) \$@\n\n", $directories{$mod}, $mod;
170 ################################################################
171 # output the inter-dll dependencies and rules
173 print NEWMAKE "# Inter-dll dependencies\n\n";
176 foreach $mod (sort keys %imports)
179 my $dep = sprintf("%s/lib%s.\$(LIBEXT): dummy", $directories{$mod}, $mod);
180 foreach $i (@{$imports{$mod}})
187 $dep .= sprintf(" lib%s.\$(LIBEXT)", $i);
189 $dep .= sprintf("\n\t\@cd %s && \$(MAKE) lib%s.\$(LIBEXT)\n\n",$directories{$mod}, $mod);
192 print NEWMAKE sort @depends;
195 ################################################################
201 \$(SUBDIRS:%=%/__test__): dummy
202 \@cd `dirname \$\@` && \$(MAKE) test
204 \$(SUBDIRS:%=%/__checklink__): dummy
205 \@cd `dirname \$\@` && \$(MAKE) checklink
207 \$(SUBDIRS:%=%/__debug_channels__): dummy
208 \@cd `dirname \$\@` && \$(MAKE) debug_channels
210 install:: \$(SUBDIRS:%=%/__install__)
212 uninstall:: \$(SUBDIRS:%=%/__uninstall__)
214 test:: \$(SUBDIRS:%=%/__test__)
216 checklink:: \$(SUBDIRS:%=%/__checklink__)
218 debug_channels:: \$(SUBDIRS:%=%/__debug_channels__)
222 rename "Makefile.in.new", "Makefile.in";
223 printf "Successfully updated Makefile.in\n";