Alexandre Julliard | f33f7f0 | 2001-09-17 20:09:08 +0000 | [diff] [blame] | 1 | #!/usr/bin/perl -w |
Alexandre Julliard | 7c3dec9 | 2001-06-08 19:09:44 +0000 | [diff] [blame] | 2 | # |
| 3 | # Update the dll dependencies in the dlls main Makefile.in. |
| 4 | # Must be run in the dlls/ directory of the Wine tree. |
| 5 | # |
| 6 | # Copyright 2001 Alexandre Julliard |
| 7 | # |
Alexandre Julliard | 0799c1a | 2002-03-09 23:29:33 +0000 | [diff] [blame] | 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. |
| 12 | # |
| 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. |
| 17 | # |
| 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 |
| 21 | # |
Alexandre Julliard | 7c3dec9 | 2001-06-08 19:09:44 +0000 | [diff] [blame] | 22 | |
Eric Pouech | c0d955e | 2002-05-21 18:29:31 +0000 | [diff] [blame] | 23 | use strict; |
Alexandre Julliard | 7c3dec9 | 2001-06-08 19:09:44 +0000 | [diff] [blame] | 24 | |
Eric Pouech | c0d955e | 2002-05-21 18:29:31 +0000 | [diff] [blame] | 25 | my $makefiles = `find . -name Makefile.in -print`; |
| 26 | |
Eric Pouech | c0d955e | 2002-05-21 18:29:31 +0000 | [diff] [blame] | 27 | my %directories = (); |
Alexandre Julliard | 15ac684 | 2005-05-10 13:21:04 +0000 | [diff] [blame] | 28 | my %importlibs = (); |
| 29 | my %static_implibs = (); |
| 30 | my %staticlib_dirs = (); |
Eric Pouech | c0d955e | 2002-05-21 18:29:31 +0000 | [diff] [blame] | 31 | my %altnames = (); |
Alexandre Julliard | 7c3dec9 | 2001-06-08 19:09:44 +0000 | [diff] [blame] | 32 | |
Alexandre Julliard | f33f7f0 | 2001-09-17 20:09:08 +0000 | [diff] [blame] | 33 | # list of special dlls that can be switched on or off by configure |
Eric Pouech | c0d955e | 2002-05-21 18:29:31 +0000 | [diff] [blame] | 34 | my %special_dlls = |
Alexandre Julliard | f33f7f0 | 2001-09-17 20:09:08 +0000 | [diff] [blame] | 35 | ( |
| 36 | "ddraw" => "XFILES", |
| 37 | "glu32" => "GLU32FILES", |
Jacek Caban | ef799c4 | 2003-12-02 04:11:09 +0000 | [diff] [blame] | 38 | "glut32" => "GLUT32FILES", |
Alexandre Julliard | f33f7f0 | 2001-09-17 20:09:08 +0000 | [diff] [blame] | 39 | "opengl32" => "OPENGLFILES", |
Alexandre Julliard | 7cbb340 | 2002-09-29 18:07:25 +0000 | [diff] [blame] | 40 | "d3d8" => "OPENGLFILES", |
Alexandre Julliard | aa1bdc4 | 2003-07-01 01:11:13 +0000 | [diff] [blame] | 41 | "d3d9" => "OPENGLFILES", |
Raphael Junqueira | e31ae92 | 2002-12-17 01:15:15 +0000 | [diff] [blame] | 42 | "d3dx8" => "OPENGLFILES", |
Raphael Junqueira | 0196861 | 2003-11-14 03:50:35 +0000 | [diff] [blame] | 43 | "wined3d" => "OPENGLFILES", |
Alexandre Julliard | f33f7f0 | 2001-09-17 20:09:08 +0000 | [diff] [blame] | 44 | "x11drv" => "XFILES" |
| 45 | ); |
| 46 | |
Eric Pouech | c0d955e | 2002-05-21 18:29:31 +0000 | [diff] [blame] | 47 | foreach my $i (split(/\s/,$makefiles)) |
Alexandre Julliard | 7c3dec9 | 2001-06-08 19:09:44 +0000 | [diff] [blame] | 48 | { |
Eric Pouech | c0d955e | 2002-05-21 18:29:31 +0000 | [diff] [blame] | 49 | my $module; |
| 50 | |
Alexandre Julliard | edeee89 | 2002-08-09 01:22:40 +0000 | [diff] [blame] | 51 | next if $i =~ /\/tests\/Makefile.in/; |
| 52 | |
Alexandre Julliard | 7c3dec9 | 2001-06-08 19:09:44 +0000 | [diff] [blame] | 53 | open MAKE,$i; |
Eric Pouech | c0d955e | 2002-05-21 18:29:31 +0000 | [diff] [blame] | 54 | |
| 55 | $module = undef; |
Alexandre Julliard | 7c3dec9 | 2001-06-08 19:09:44 +0000 | [diff] [blame] | 56 | while (<MAKE>) |
| 57 | { |
| 58 | chop; |
Eric Pouech | c0d955e | 2002-05-21 18:29:31 +0000 | [diff] [blame] | 59 | # EPP hack to disable this DLL... the MKDLL_SKIP comment must appear |
| 60 | # at the very top of the Makefile.in |
| 61 | last if (/^\#\s*MKDLL_SKIP/); |
| 62 | |
Alexandre Julliard | 7c3dec9 | 2001-06-08 19:09:44 +0000 | [diff] [blame] | 63 | if (/^MODULE\s*=\s*([a-zA-Z0-9_.]+)/) |
| 64 | { |
| 65 | $module = $1; |
Alexandre Julliard | c3eac43 | 2004-01-26 21:29:05 +0000 | [diff] [blame] | 66 | if ($module =~ /^lib.*\.a$/) |
| 67 | { |
Alexandre Julliard | 15ac684 | 2005-05-10 13:21:04 +0000 | [diff] [blame] | 68 | ($staticlib_dirs{$module} = $i) =~ s/^\.\/(.*)\/[^\/]+$/$1/; |
Alexandre Julliard | c3eac43 | 2004-01-26 21:29:05 +0000 | [diff] [blame] | 69 | } |
| 70 | else |
| 71 | { |
| 72 | ($directories{$module} = $i) =~ s/^\.\/(.*)\/[^\/]+$/$1/; |
| 73 | } |
Alexandre Julliard | 7c3dec9 | 2001-06-08 19:09:44 +0000 | [diff] [blame] | 74 | next; |
| 75 | } |
Alexandre Julliard | 15ac684 | 2005-05-10 13:21:04 +0000 | [diff] [blame] | 76 | if (/^IMPORTLIB\s*=\s*([a-zA-Z0-9_.]+)\.\$\(IMPLIBEXT\)/) |
| 77 | { |
| 78 | $importlibs{$module} = $1; |
| 79 | next; |
| 80 | } |
| 81 | if (/^IMPLIB_SRCS\s*=/) |
| 82 | { |
| 83 | $static_implibs{$module} = 1; |
| 84 | next; |
| 85 | } |
Alexandre Julliard | 8be0edb | 2004-08-17 22:10:26 +0000 | [diff] [blame] | 86 | if (/^SPEC_SRCS16\s*=\s*(.*)/) |
Alexandre Julliard | 7c3dec9 | 2001-06-08 19:09:44 +0000 | [diff] [blame] | 87 | { |
Alexandre Julliard | 8be0edb | 2004-08-17 22:10:26 +0000 | [diff] [blame] | 88 | my $specs = $1; |
| 89 | while ($specs =~ /\s*(.*)\\$/) { $specs = $1 . <MAKE>; } |
| 90 | my @list = split(/\s+/,$specs); |
| 91 | @list = map { $_ =~ s/\.spec$//; $_ .= ".dll" unless $_ =~ /\./; $_; } @list; |
Alexandre Julliard | 7c3dec9 | 2001-06-08 19:09:44 +0000 | [diff] [blame] | 92 | $altnames{$module} = \@list; |
| 93 | next; |
| 94 | } |
| 95 | } |
Eric Pouech | c0d955e | 2002-05-21 18:29:31 +0000 | [diff] [blame] | 96 | close MAKE; |
Alexandre Julliard | 7c3dec9 | 2001-06-08 19:09:44 +0000 | [diff] [blame] | 97 | } |
| 98 | |
Alexandre Julliard | 7c3dec9 | 2001-06-08 19:09:44 +0000 | [diff] [blame] | 99 | open NEWMAKE,">Makefile.in.new" or die "cannot create Makefile.in.new"; |
| 100 | |
Alexandre Julliard | f33f7f0 | 2001-09-17 20:09:08 +0000 | [diff] [blame] | 101 | ################################################################ |
| 102 | # makefile header |
Alexandre Julliard | 7c3dec9 | 2001-06-08 19:09:44 +0000 | [diff] [blame] | 103 | |
Alexandre Julliard | f33f7f0 | 2001-09-17 20:09:08 +0000 | [diff] [blame] | 104 | print NEWMAKE <<EOF; |
| 105 | # Automatically generated by make_dlls; DO NOT EDIT!! |
Alexandre Julliard | 7c3dec9 | 2001-06-08 19:09:44 +0000 | [diff] [blame] | 106 | |
Alexandre Julliard | f33f7f0 | 2001-09-17 20:09:08 +0000 | [diff] [blame] | 107 | TOPSRCDIR = \@top_srcdir\@ |
| 108 | TOPOBJDIR = .. |
| 109 | SRCDIR = \@srcdir\@ |
| 110 | VPATH = \@srcdir\@ |
Alexandre Julliard | f33f7f0 | 2001-09-17 20:09:08 +0000 | [diff] [blame] | 111 | |
| 112 | EOF |
| 113 | |
| 114 | ################################################################ |
| 115 | # output special dlls configure definitions |
| 116 | |
| 117 | printf NEWMAKE "# special configure-dependent targets\n\n"; |
| 118 | my %specials = (); |
Eric Pouech | c0d955e | 2002-05-21 18:29:31 +0000 | [diff] [blame] | 119 | foreach my $mod (sort keys %special_dlls) |
Alexandre Julliard | f33f7f0 | 2001-09-17 20:09:08 +0000 | [diff] [blame] | 120 | { |
| 121 | $specials{$special_dlls{$mod}} .= " " . $mod; |
| 122 | } |
Eric Pouech | c0d955e | 2002-05-21 18:29:31 +0000 | [diff] [blame] | 123 | foreach my $i (sort keys %specials) |
Alexandre Julliard | f33f7f0 | 2001-09-17 20:09:08 +0000 | [diff] [blame] | 124 | { |
| 125 | printf NEWMAKE "%s =%s\n", $i, $specials{$i}; |
| 126 | } |
| 127 | printf NEWMAKE "EXTRADIRS ="; |
Eric Pouech | c0d955e | 2002-05-21 18:29:31 +0000 | [diff] [blame] | 128 | foreach my $i (sort keys %specials) { printf NEWMAKE " \@%s\@", $i; } |
Alexandre Julliard | f33f7f0 | 2001-09-17 20:09:08 +0000 | [diff] [blame] | 129 | printf NEWMAKE "\n\n"; |
| 130 | |
| 131 | |
| 132 | ################################################################ |
| 133 | # output the subdirs list |
| 134 | |
Alexandre Julliard | 5852f7a | 2002-05-23 02:47:16 +0000 | [diff] [blame] | 135 | print NEWMAKE "# Subdir list\n\nBASEDIRS ="; |
Eric Pouech | c0d955e | 2002-05-21 18:29:31 +0000 | [diff] [blame] | 136 | foreach my $dir (sort values %directories) |
Alexandre Julliard | 7c3dec9 | 2001-06-08 19:09:44 +0000 | [diff] [blame] | 137 | { |
Alexandre Julliard | f33f7f0 | 2001-09-17 20:09:08 +0000 | [diff] [blame] | 138 | next if defined($special_dlls{$dir}); # skip special dlls |
Alexandre Julliard | 7c3dec9 | 2001-06-08 19:09:44 +0000 | [diff] [blame] | 139 | printf NEWMAKE " \\\n\t%s", $dir; |
| 140 | } |
Alexandre Julliard | 7c3dec9 | 2001-06-08 19:09:44 +0000 | [diff] [blame] | 141 | |
Alexandre Julliard | fd75880 | 2005-08-25 12:15:06 +0000 | [diff] [blame] | 142 | printf NEWMAKE "\n\nIMPLIBSUBDIRS ="; |
| 143 | foreach my $dir (sort values %staticlib_dirs) |
| 144 | { |
| 145 | printf NEWMAKE " \\\n\t%s", $dir; |
| 146 | } |
| 147 | |
| 148 | printf NEWMAKE "\n\nSUBDIRS = \\\n\t\$(BASEDIRS) \\\n\t\$(IMPLIBSUBDIRS)"; |
| 149 | foreach my $dir (sort keys %special_dlls) |
Alexandre Julliard | 5852f7a | 2002-05-23 02:47:16 +0000 | [diff] [blame] | 150 | { |
| 151 | printf NEWMAKE " \\\n\t%s", $dir; |
| 152 | } |
| 153 | printf NEWMAKE <<EOF; |
| 154 | |
| 155 | |
| 156 | BUILDSUBDIRS = \$(BASEDIRS) \$(EXTRADIRS) |
Alexandre Julliard | f673b71 | 2002-06-14 23:48:27 +0000 | [diff] [blame] | 157 | |
Alexandre Julliard | fd75880 | 2005-08-25 12:15:06 +0000 | [diff] [blame] | 158 | INSTALLSUBDIRS = \$(BUILDSUBDIRS) \$(IMPLIBSUBDIRS) |
Alexandre Julliard | 5852f7a | 2002-05-23 02:47:16 +0000 | [diff] [blame] | 159 | EOF |
Alexandre Julliard | f33f7f0 | 2001-09-17 20:09:08 +0000 | [diff] [blame] | 160 | |
| 161 | ################################################################ |
| 162 | # output the all: target |
| 163 | |
| 164 | my %targets = (); # use a hash to get rid of duplicate target names |
Alexandre Julliard | c728efc | 2002-10-02 02:34:09 +0000 | [diff] [blame] | 165 | my %targets16 = (); |
Eric Pouech | c0d955e | 2002-05-21 18:29:31 +0000 | [diff] [blame] | 166 | foreach my $mod (sort keys %directories) |
Alexandre Julliard | f33f7f0 | 2001-09-17 20:09:08 +0000 | [diff] [blame] | 167 | { |
Alexandre Julliard | c1bfca0 | 2002-03-20 22:19:06 +0000 | [diff] [blame] | 168 | next if defined($special_dlls{$directories{$mod}}); # skip special dlls |
Alexandre Julliard | c2fbb40 | 2004-03-10 01:56:00 +0000 | [diff] [blame] | 169 | $targets{$mod . ".so"} = 1; |
Alexandre Julliard | f33f7f0 | 2001-09-17 20:09:08 +0000 | [diff] [blame] | 170 | next unless defined $altnames{$mod}; |
Eric Pouech | c0d955e | 2002-05-21 18:29:31 +0000 | [diff] [blame] | 171 | foreach my $i (sort @{$altnames{$mod}}) |
Alexandre Julliard | f33f7f0 | 2001-09-17 20:09:08 +0000 | [diff] [blame] | 172 | { |
Alexandre Julliard | aed49d4 | 2006-02-16 13:44:38 +0100 | [diff] [blame] | 173 | $targets16{$i . "16"} = $mod; |
Alexandre Julliard | f33f7f0 | 2001-09-17 20:09:08 +0000 | [diff] [blame] | 174 | } |
| 175 | } |
Alexandre Julliard | 15ac684 | 2005-05-10 13:21:04 +0000 | [diff] [blame] | 176 | foreach my $mod (sort keys %staticlib_dirs) { $targets{$mod} = 1; } |
Alexandre Julliard | c3eac43 | 2004-01-26 21:29:05 +0000 | [diff] [blame] | 177 | |
Alexandre Julliard | f33f7f0 | 2001-09-17 20:09:08 +0000 | [diff] [blame] | 178 | print NEWMAKE <<EOF; |
| 179 | |
Alexandre Julliard | c1bfca0 | 2002-03-20 22:19:06 +0000 | [diff] [blame] | 180 | \@MAKE_RULES\@ |
| 181 | |
Alexandre Julliard | 23829be | 2003-05-15 04:30:46 +0000 | [diff] [blame] | 182 | # Symbolic links |
| 183 | |
Alexandre Julliard | c728efc | 2002-10-02 02:34:09 +0000 | [diff] [blame] | 184 | WIN16_FILES = \\ |
| 185 | EOF |
| 186 | printf NEWMAKE "\t%s\n", join( " \\\n\t", sort keys %targets16 ); |
| 187 | |
| 188 | print NEWMAKE <<EOF; |
| 189 | |
Alexandre Julliard | c2fbb40 | 2004-03-10 01:56:00 +0000 | [diff] [blame] | 190 | SYMLINKS_SO = \\ |
| 191 | \$(EXTRADIRS:%=%.dll.so) \\ |
Alexandre Julliard | c728efc | 2002-10-02 02:34:09 +0000 | [diff] [blame] | 192 | \@WIN16_FILES\@ \\ |
Alexandre Julliard | f33f7f0 | 2001-09-17 20:09:08 +0000 | [diff] [blame] | 193 | EOF |
| 194 | printf NEWMAKE "\t%s\n", join( " \\\n\t", sort keys %targets ); |
| 195 | |
Alexandre Julliard | 23829be | 2003-05-15 04:30:46 +0000 | [diff] [blame] | 196 | print NEWMAKE <<EOF; |
| 197 | |
| 198 | # Main target |
| 199 | |
Alexandre Julliard | c2fbb40 | 2004-03-10 01:56:00 +0000 | [diff] [blame] | 200 | all: symlinks\$(DLLEXT) |
| 201 | |
| 202 | .PHONY: symlinks symlinks.so implib |
| 203 | |
| 204 | symlinks.so: \$(SYMLINKS_SO) |
| 205 | |
| 206 | symlinks: \$(BUILDSUBDIRS) |
| 207 | |
Alexandre Julliard | c3116c5 | 2005-05-06 19:38:50 +0000 | [diff] [blame] | 208 | x11drv.dll.so: winex11.drv.so |
| 209 | \$(RM) \$@ && \$(LN_S) winex11.drv.so \$@ |
| 210 | |
Alexandre Julliard | 23829be | 2003-05-15 04:30:46 +0000 | [diff] [blame] | 211 | EOF |
Alexandre Julliard | f33f7f0 | 2001-09-17 20:09:08 +0000 | [diff] [blame] | 212 | |
| 213 | ################################################################ |
| 214 | # output the lib name -> directory rules |
| 215 | |
Alexandre Julliard | 7c3dec9 | 2001-06-08 19:09:44 +0000 | [diff] [blame] | 216 | print NEWMAKE <<EOF; |
| 217 | |
Alexandre Julliard | 45a795c | 2002-05-23 19:13:22 +0000 | [diff] [blame] | 218 | # Map symlink name to the corresponding library |
Alexandre Julliard | 7c3dec9 | 2001-06-08 19:09:44 +0000 | [diff] [blame] | 219 | |
| 220 | EOF |
| 221 | |
Eric Pouech | c0d955e | 2002-05-21 18:29:31 +0000 | [diff] [blame] | 222 | foreach my $mod (sort keys %directories) |
Alexandre Julliard | 7c3dec9 | 2001-06-08 19:09:44 +0000 | [diff] [blame] | 223 | { |
Alexandre Julliard | c2fbb40 | 2004-03-10 01:56:00 +0000 | [diff] [blame] | 224 | printf NEWMAKE "%s.so: %s/%s.so\n", $mod, $directories{$mod}, $mod; |
| 225 | printf NEWMAKE "\t\$(RM) \$@ && \$(LN_S) %s/%s.so \$@\n\n", $directories{$mod}, $mod; |
Alexandre Julliard | 03b47d2 | 2004-01-02 20:54:03 +0000 | [diff] [blame] | 226 | |
Alexandre Julliard | f33f7f0 | 2001-09-17 20:09:08 +0000 | [diff] [blame] | 227 | if (defined $altnames{$mod}) |
Alexandre Julliard | 7c3dec9 | 2001-06-08 19:09:44 +0000 | [diff] [blame] | 228 | { |
Alexandre Julliard | 03b47d2 | 2004-01-02 20:54:03 +0000 | [diff] [blame] | 229 | my $count = 0; |
Eric Pouech | c0d955e | 2002-05-21 18:29:31 +0000 | [diff] [blame] | 230 | foreach my $i (sort @{$altnames{$mod}}) |
Alexandre Julliard | 7c3dec9 | 2001-06-08 19:09:44 +0000 | [diff] [blame] | 231 | { |
Alexandre Julliard | 03b47d2 | 2004-01-02 20:54:03 +0000 | [diff] [blame] | 232 | if ($count++ == 3) { printf NEWMAKE "\\\n "; $count = 1; } |
Alexandre Julliard | aed49d4 | 2006-02-16 13:44:38 +0100 | [diff] [blame] | 233 | printf NEWMAKE "%s16 ", $i; |
Alexandre Julliard | 7c3dec9 | 2001-06-08 19:09:44 +0000 | [diff] [blame] | 234 | } |
Alexandre Julliard | c2fbb40 | 2004-03-10 01:56:00 +0000 | [diff] [blame] | 235 | printf NEWMAKE ": %s.so\n", $mod; |
Alexandre Julliard | aed49d4 | 2006-02-16 13:44:38 +0100 | [diff] [blame] | 236 | printf NEWMAKE "\techo \"%s\" >\$\@\n\n", $mod; |
Alexandre Julliard | 7c3dec9 | 2001-06-08 19:09:44 +0000 | [diff] [blame] | 237 | } |
Alexandre Julliard | 7c3dec9 | 2001-06-08 19:09:44 +0000 | [diff] [blame] | 238 | } |
Alexandre Julliard | 15ac684 | 2005-05-10 13:21:04 +0000 | [diff] [blame] | 239 | foreach my $mod (sort keys %staticlib_dirs) |
Alexandre Julliard | c3eac43 | 2004-01-26 21:29:05 +0000 | [diff] [blame] | 240 | { |
Alexandre Julliard | 15ac684 | 2005-05-10 13:21:04 +0000 | [diff] [blame] | 241 | printf NEWMAKE "%s: %s/%s\n", $mod, $staticlib_dirs{$mod}, $mod; |
| 242 | printf NEWMAKE "\t\$(RM) \$@ && \$(LN_S) %s/%s \$@\n\n", $staticlib_dirs{$mod}, $mod; |
Alexandre Julliard | c3eac43 | 2004-01-26 21:29:05 +0000 | [diff] [blame] | 243 | } |
Alexandre Julliard | f33f7f0 | 2001-09-17 20:09:08 +0000 | [diff] [blame] | 244 | |
| 245 | ################################################################ |
Alexandre Julliard | ada5e65 | 2002-12-12 22:03:14 +0000 | [diff] [blame] | 246 | # output the import libraries rules |
| 247 | |
Alexandre Julliard | 15ac684 | 2005-05-10 13:21:04 +0000 | [diff] [blame] | 248 | print NEWMAKE "\n# Import libraries\n\n"; |
| 249 | print NEWMAKE "STATIC_IMPLIBEXT = \$(IMPLIBEXT:def=def.a)\n\n"; |
Alexandre Julliard | ada5e65 | 2002-12-12 22:03:14 +0000 | [diff] [blame] | 250 | |
Alexandre Julliard | 12c9b50 | 2005-08-26 08:52:06 +0000 | [diff] [blame] | 251 | my @lib_symlinks = (); |
Alexandre Julliard | 15ac684 | 2005-05-10 13:21:04 +0000 | [diff] [blame] | 252 | foreach my $mod (sort keys %importlibs) |
Alexandre Julliard | ada5e65 | 2002-12-12 22:03:14 +0000 | [diff] [blame] | 253 | { |
Alexandre Julliard | 15ac684 | 2005-05-10 13:21:04 +0000 | [diff] [blame] | 254 | my $dir = $directories{$mod}; |
| 255 | my $lib = $importlibs{$mod}; |
| 256 | if ($lib ne "lib" . $dir) { push @lib_symlinks, $mod; } |
Alexandre Julliard | ada5e65 | 2002-12-12 22:03:14 +0000 | [diff] [blame] | 257 | } |
Alexandre Julliard | 15ac684 | 2005-05-10 13:21:04 +0000 | [diff] [blame] | 258 | print NEWMAKE "IMPORT_SYMLINKS ="; |
| 259 | foreach my $mod (sort @lib_symlinks) |
| 260 | { |
| 261 | printf NEWMAKE " \\\n\t%s.\$(IMPLIBEXT)", $importlibs{$mod}; |
| 262 | } |
| 263 | foreach my $mod (sort keys %staticlib_dirs) |
Alexandre Julliard | c3eac43 | 2004-01-26 21:29:05 +0000 | [diff] [blame] | 264 | { |
| 265 | printf NEWMAKE " \\\n\t%s", $mod; |
| 266 | } |
Alexandre Julliard | 15ac684 | 2005-05-10 13:21:04 +0000 | [diff] [blame] | 267 | |
| 268 | print NEWMAKE "\n\nIMPORT_LIBS = \\\n\t\$(IMPORT_SYMLINKS)"; |
| 269 | foreach my $mod (sort keys %importlibs) |
| 270 | { |
| 271 | my $dir = $directories{$mod}; |
| 272 | my $def = $mod; |
| 273 | $def =~ s/\.(dll|drv)$//; |
| 274 | printf NEWMAKE " \\\n\t%s/lib%s.\$(IMPLIBEXT)", $dir, $def; |
| 275 | printf NEWMAKE " \\\n\t%s/lib%s.\$(STATIC_IMPLIBEXT)", $dir, $def if $static_implibs{$mod}; |
| 276 | } |
Alexandre Julliard | ada5e65 | 2002-12-12 22:03:14 +0000 | [diff] [blame] | 277 | print NEWMAKE "\n\n"; |
Alexandre Julliard | 06233cf | 2004-08-11 20:59:09 +0000 | [diff] [blame] | 278 | print NEWMAKE "implib: \$(IMPORT_LIBS)\n\n"; |
Alexandre Julliard | ada5e65 | 2002-12-12 22:03:14 +0000 | [diff] [blame] | 279 | |
Alexandre Julliard | 15ac684 | 2005-05-10 13:21:04 +0000 | [diff] [blame] | 280 | foreach my $mod (sort keys %importlibs) |
Alexandre Julliard | ada5e65 | 2002-12-12 22:03:14 +0000 | [diff] [blame] | 281 | { |
| 282 | my $dir = $directories{$mod}; |
Alexandre Julliard | 15ac684 | 2005-05-10 13:21:04 +0000 | [diff] [blame] | 283 | my $lib = $importlibs{$mod}; |
Alexandre Julliard | ada5e65 | 2002-12-12 22:03:14 +0000 | [diff] [blame] | 284 | my $spec = $mod; |
| 285 | $spec =~ s/\.dll$//; |
Alexandre Julliard | 15ac684 | 2005-05-10 13:21:04 +0000 | [diff] [blame] | 286 | printf NEWMAKE "%s/%s.\$(IMPLIBEXT): %s/%s.spec \$(WINEBUILD)\n", $dir, $lib, $dir, $spec; |
| 287 | printf NEWMAKE "\t\@cd %s && \$(MAKE) %s.\$(IMPLIBEXT)\n\n", $dir, $lib; |
| 288 | next unless $static_implibs{$mod}; |
| 289 | printf NEWMAKE "%s/%s.\$(STATIC_IMPLIBEXT): dummy\n", $dir, $lib, $dir, $spec; |
| 290 | printf NEWMAKE "\t\@cd %s && \$(MAKE) %s.\$(STATIC_IMPLIBEXT)\n\n", $dir, $lib; |
| 291 | } |
| 292 | foreach my $mod (sort @lib_symlinks) |
| 293 | { |
| 294 | my $dir = $directories{$mod}; |
| 295 | my $lib = $importlibs{$mod} . ".\$(IMPLIBEXT)"; |
| 296 | printf NEWMAKE "%s: %s/%s\n", $lib, $dir, $lib; |
| 297 | printf NEWMAKE "\t\$(RM) \$@ && \$(LN_S) %s/%s \$@\n\n", $dir, $lib; |
Alexandre Julliard | ada5e65 | 2002-12-12 22:03:14 +0000 | [diff] [blame] | 298 | } |
Alexandre Julliard | ada5e65 | 2002-12-12 22:03:14 +0000 | [diff] [blame] | 299 | |
| 300 | print NEWMAKE <<EOF; |
Alexandre Julliard | 06233cf | 2004-08-11 20:59:09 +0000 | [diff] [blame] | 301 | \$(BUILDSUBDIRS): \$(IMPORT_LIBS) |
Alexandre Julliard | 71ff4c4 | 2005-05-13 13:57:55 +0000 | [diff] [blame] | 302 | \$(INSTALLSUBDIRS:%=%/__install__) \$(INSTALLSUBDIRS:%=%/__install-lib__): \$(IMPORT_LIBS) |
Alexandre Julliard | ada5e65 | 2002-12-12 22:03:14 +0000 | [diff] [blame] | 303 | |
| 304 | EOF |
| 305 | |
| 306 | ################################################################ |
Alexandre Julliard | f33f7f0 | 2001-09-17 20:09:08 +0000 | [diff] [blame] | 307 | # output the inter-dll dependencies and rules |
| 308 | |
Alexandre Julliard | 45a795c | 2002-05-23 19:13:22 +0000 | [diff] [blame] | 309 | print NEWMAKE "# Map library name to the corresponding directory\n\n"; |
| 310 | |
| 311 | foreach my $mod (sort keys %directories) |
| 312 | { |
Alexandre Julliard | c2fbb40 | 2004-03-10 01:56:00 +0000 | [diff] [blame] | 313 | printf NEWMAKE "%s/%s.so: %s\n", $directories{$mod}, $mod, $directories{$mod}; |
Alexandre Julliard | 45a795c | 2002-05-23 19:13:22 +0000 | [diff] [blame] | 314 | } |
Alexandre Julliard | 15ac684 | 2005-05-10 13:21:04 +0000 | [diff] [blame] | 315 | foreach my $mod (sort keys %staticlib_dirs) |
Alexandre Julliard | c3eac43 | 2004-01-26 21:29:05 +0000 | [diff] [blame] | 316 | { |
Alexandre Julliard | 15ac684 | 2005-05-10 13:21:04 +0000 | [diff] [blame] | 317 | printf NEWMAKE "%s/%s: %s\n", $staticlib_dirs{$mod}, $mod, $staticlib_dirs{$mod}; |
Alexandre Julliard | c3eac43 | 2004-01-26 21:29:05 +0000 | [diff] [blame] | 318 | } |
Alexandre Julliard | 45a795c | 2002-05-23 19:13:22 +0000 | [diff] [blame] | 319 | |
Alexandre Julliard | f33f7f0 | 2001-09-17 20:09:08 +0000 | [diff] [blame] | 320 | ################################################################ |
| 321 | # makefile trailer |
| 322 | |
Alexandre Julliard | 7c3dec9 | 2001-06-08 19:09:44 +0000 | [diff] [blame] | 323 | print NEWMAKE <<EOF; |
Alexandre Julliard | c3eac43 | 2004-01-26 21:29:05 +0000 | [diff] [blame] | 324 | |
Alexandre Julliard | 78e3311 | 2003-04-12 00:05:27 +0000 | [diff] [blame] | 325 | # Rules for auto documentation |
| 326 | |
| 327 | \$(SUBDIRS:%=%/__man__): dummy |
| 328 | cd `dirname \$@` && \$(MAKE) man |
| 329 | |
| 330 | man: \$(SUBDIRS:%=%/__man__) |
| 331 | |
| 332 | \$(SUBDIRS:%=%/__doc_html__): dummy |
| 333 | cd `dirname \$@` && \$(MAKE) doc-html |
| 334 | |
| 335 | doc-html: \$(SUBDIRS:%=%/__doc_html__) |
| 336 | |
| 337 | \$(SUBDIRS:%=%/__doc_sgml__): dummy |
| 338 | cd `dirname \$@` && \$(MAKE) doc-sgml |
| 339 | |
| 340 | doc-sgml: \$(SUBDIRS:%=%/__doc_sgml__) |
| 341 | |
Alexandre Julliard | c2fbb40 | 2004-03-10 01:56:00 +0000 | [diff] [blame] | 342 | .PHONY: man doc-html doc-sgml \$(SUBDIRS:%=%/__man__) \$(SUBDIRS:%=%/__doc_html__) \$(SUBDIRS:%=%/__doc_sgml__) |
Alexandre Julliard | 78e3311 | 2003-04-12 00:05:27 +0000 | [diff] [blame] | 343 | |
Alexandre Julliard | f33f7f0 | 2001-09-17 20:09:08 +0000 | [diff] [blame] | 344 | # Misc rules |
Alexandre Julliard | 7c3dec9 | 2001-06-08 19:09:44 +0000 | [diff] [blame] | 345 | |
Alexandre Julliard | 34fa35d | 2005-05-09 14:42:30 +0000 | [diff] [blame] | 346 | install-lib:: \$(INSTALLSUBDIRS:%=%/__install-lib__) |
Alexandre Julliard | ada5e65 | 2002-12-12 22:03:14 +0000 | [diff] [blame] | 347 | |
Alexandre Julliard | 34fa35d | 2005-05-09 14:42:30 +0000 | [diff] [blame] | 348 | install-dev:: \$(INSTALLSUBDIRS:%=%/__install-dev__) |
Alexandre Julliard | e8dae9c | 2003-10-11 01:00:35 +0000 | [diff] [blame] | 349 | |
Alexandre Julliard | f673b71 | 2002-06-14 23:48:27 +0000 | [diff] [blame] | 350 | uninstall:: |
Mike Frysinger | 5392844 | 2006-02-14 13:51:38 +0100 | [diff] [blame] | 351 | -rmdir \$(DESTDIR)\$(dlldir) |
Alexandre Julliard | f33f7f0 | 2001-09-17 20:09:08 +0000 | [diff] [blame] | 352 | |
Alexandre Julliard | ada5e65 | 2002-12-12 22:03:14 +0000 | [diff] [blame] | 353 | clean:: |
Alexandre Julliard | 15ac684 | 2005-05-10 13:21:04 +0000 | [diff] [blame] | 354 | \$(RM) \$(IMPORT_SYMLINKS) |
Alexandre Julliard | ada5e65 | 2002-12-12 22:03:14 +0000 | [diff] [blame] | 355 | |
Alexandre Julliard | 5852f7a | 2002-05-23 02:47:16 +0000 | [diff] [blame] | 356 | check test:: \$(BUILDSUBDIRS:%=%/__test__) |
Alexandre Julliard | 9384184 | 2002-01-14 19:56:46 +0000 | [diff] [blame] | 357 | |
Alexandre Julliard | c3c587e | 2002-09-06 19:46:00 +0000 | [diff] [blame] | 358 | crosstest:: \$(BUILDSUBDIRS:%=%/__crosstest__) |
| 359 | |
Alexandre Julliard | 5852f7a | 2002-05-23 02:47:16 +0000 | [diff] [blame] | 360 | checklink:: \$(BUILDSUBDIRS:%=%/__checklink__) |
Alexandre Julliard | f673b71 | 2002-06-14 23:48:27 +0000 | [diff] [blame] | 361 | |
Alexandre Julliard | f673b71 | 2002-06-14 23:48:27 +0000 | [diff] [blame] | 362 | ### Dependencies: |
Alexandre Julliard | 7c3dec9 | 2001-06-08 19:09:44 +0000 | [diff] [blame] | 363 | EOF |
| 364 | |
| 365 | close NEWMAKE; |
| 366 | rename "Makefile.in.new", "Makefile.in"; |
| 367 | printf "Successfully updated Makefile.in\n"; |