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