build file templates: have targets for all shared library names
[openssl.git] / Configurations / windows-makefile.tmpl
index 9d23ec2f4af3ba3ceeb78a3339cc80b7cb7b130b..663aefc9fd121f923d448ee655085d0e2057f770 100644 (file)
@@ -630,13 +630,12 @@ $obj$objext: $deps
 EOF
  }
 
- # On Unix, we build shlibs from static libs, so we're ignoring the
- # object file array.  We *know* this routine is only called when we've
- # configure 'shared'.
+ # We *know* this routine is only called when we've configure 'shared'.
+ # Also, note that even though the import library built here looks like
+ # a static library, it really isn't.
  sub obj2shlib {
      my %args = @_;
      my $lib = $args{lib};
-     my $shlib = $args{shlib};
      my @objs = map { (my $x = $_) =~ s|\.o$|$objext|; $x }
                 grep { $_ =~ m/\.(?:o|res)$/ }
                 @{$args{objs}};
@@ -648,25 +647,30 @@ EOF
      my $linklibs = join("", map { "$_\n" } @deps);
      my $objs = join("\n", @objs);
      my $deps = join(" ", @objs, @defs, @deps);
-     my $target = shlib_import($lib);
+     my $import = shlib_import($lib);
+     my $dll =  shlib($lib);
      my $shared_def = join("", map { " /def:$_" } @defs);
      return <<"EOF"
-$target: $deps
-       IF EXIST $shlib$shlibext.manifest DEL /F /Q $shlib$shlibext.manifest
+# The import library may look like a static library, but it is not.
+# We MUST make the import library depend on the DLL, in case someone
+# mistakenly removes the latter.
+$import: $dll
+$dll: $deps
+       IF EXIST $full.manifest DEL /F /Q $full.manifest
        IF EXIST \$@ DEL /F /Q \$@
        \$(LD) \$(LDFLAGS) \$(LIB_LDFLAGS) \\
-               /implib:\$@ \$(LDOUTFLAG)$shlib$shlibext$shared_def @<< || (DEL /Q \$(\@B).* $shlib.* && EXIT 1)
+               /implib:$import \$(LDOUTFLAG)$dll$shared_def @<< || (DEL /Q \$(\@B).* $import && EXIT 1)
 $objs
 $linklibs\$(LIB_EX_LIBS)
 <<
-       IF EXIST $shlib$shlibext.manifest \\
-          \$(MT) \$(MTFLAGS) \$(MTINFLAG)$shlib$shlibext.manifest \$(MTOUTFLAG)$shlib$shlibext
-       IF EXIST apps\\$shlib$shlibext DEL /Q /F apps\\$shlib$shlibext
-       IF EXIST test\\$shlib$shlibext DEL /Q /F test\\$shlib$shlibext
-       IF EXIST fuzz\\$shlib$shlibext DEL /Q /F fuzz\\$shlib$shlibext
-       COPY $shlib$shlibext apps
-       COPY $shlib$shlibext test
-       COPY $shlib$shlibext fuzz
+       IF EXIST $dll.manifest \\
+          \$(MT) \$(MTFLAGS) \$(MTINFLAG)$dll.manifest \$(MTOUTFLAG)$dll
+       IF EXIST apps\\$dll DEL /Q /F apps\\$dll
+       IF EXIST test\\$dll DEL /Q /F test\\$dll
+       IF EXIST fuzz\\$dll DEL /Q /F fuzz\\$dll
+       COPY $dll apps
+       COPY $dll test
+       COPY $dll fuzz
 EOF
  }
  sub obj2dso {