[openssl-commits] [openssl] master update

Richard Levitte levitte at openssl.org
Tue Dec 12 16:19:42 UTC 2017


The branch master has been updated
       via  5f0e171a10325ec4502c2ce41b56d46f3c121fcb (commit)
       via  6e0e432cf287332cb0de43f301cdc99befdaa530 (commit)
       via  8dd0ff1c55972241040a8570b85632058c80b9ef (commit)
       via  7a061312038ce909a214edc4e21c8981c77bc650 (commit)
       via  81183680797f16bc05d39c1e9c1bf007fdbe4e19 (commit)
       via  ccce3e1db5132e472d1871c6a02caec5c71db72a (commit)
       via  793077d0beccfa20c9962546393128b92a7e68e4 (commit)
       via  3b6c4b07364797566c2c1fd75e499b2d9dd73506 (commit)
      from  cbade36108267fc551d0ec50d897a954b55672ac (commit)


- Log -----------------------------------------------------------------
commit 5f0e171a10325ec4502c2ce41b56d46f3c121fcb
Author: Richard Levitte <levitte at openssl.org>
Date:   Mon Dec 4 16:57:36 2017 +0100

    Note the removal of Makefile.shared in CHANGES
    
    Reviewed-by: Andy Polyakov <appro at openssl.org>
    Reviewed-by: Rich Salz <rsalz at openssl.org>
    (Merged from https://github.com/openssl/openssl/pull/4840)

commit 6e0e432cf287332cb0de43f301cdc99befdaa530
Author: Richard Levitte <levitte at openssl.org>
Date:   Mon Dec 4 16:33:59 2017 +0100

    Remove Makefile.shared, as it's now entirely unused
    
    Reviewed-by: Andy Polyakov <appro at openssl.org>
    Reviewed-by: Rich Salz <rsalz at openssl.org>
    (Merged from https://github.com/openssl/openssl/pull/4840)

commit 8dd0ff1c55972241040a8570b85632058c80b9ef
Author: Richard Levitte <levitte at openssl.org>
Date:   Mon Dec 4 16:31:26 2017 +0100

    Configure et al: cleanups
    
    Remove some config attributes that just duplicate values that are
    already there in other attributes.
    
    Remove the special runs of mkdef.pl and mkrc.pl from build file
    templates, as these are now done via GENERATE statements in
    build.info.
    
    Remove all references to ordinal files from build file templates, as
    these are now treated via the GENERATE statements in build.info.
    
    Also remove -shared flags and similar that are there in shared-info.pl
    anyway.  (in the case of darwin, it's mandatory, as -bundle and
    -dynamiclib don't mix)
    
    Reviewed-by: Andy Polyakov <appro at openssl.org>
    Reviewed-by: Rich Salz <rsalz at openssl.org>
    (Merged from https://github.com/openssl/openssl/pull/4840)

commit 7a061312038ce909a214edc4e21c8981c77bc650
Author: Richard Levitte <levitte at openssl.org>
Date:   Mon Dec 4 14:59:27 2017 +0100

    build.info: adapt to the new handling of .rc / .def / .map / .opt files
    
    Reviewed-by: Andy Polyakov <appro at openssl.org>
    Reviewed-by: Rich Salz <rsalz at openssl.org>
    (Merged from https://github.com/openssl/openssl/pull/4840)

commit 81183680797f16bc05d39c1e9c1bf007fdbe4e19
Author: Richard Levitte <levitte at openssl.org>
Date:   Mon Dec 4 14:27:58 2017 +0100

    Build file templates: Replace the use of Makefile.shared
    
    Because this also includes handling all sorts of non-object files when
    linking a program, shared library or DSO, this also includes allowing
    general recognition of files such as .res files (compiled from .rc
    files), or .def / .map / .opt files (for export and possibly
    versioning of public symbols only).
    
    This does mean that there's a tangible change for all build file
    templates: they must now recognise and handle the `.o` extension,
    which is used internally to recognise object files internally.  This
    extension was removed by common.tmpl before this change, but would
    mean that the platform specific templates wouldn't know if "foo.map"
    was originally "foo.map.o" (i.e. an object file in its own right) or
    "foo.map" (an export definition file that should be treated as such,
    not as an object file).
    
    For the sake of simplifying things, we also modify util/mkdef.pl to
    produce .def (Windows) and .opt (VMS) files that don't need additional
    hackery.
    
    Reviewed-by: Andy Polyakov <appro at openssl.org>
    Reviewed-by: Rich Salz <rsalz at openssl.org>
    (Merged from https://github.com/openssl/openssl/pull/4840)

commit ccce3e1db5132e472d1871c6a02caec5c71db72a
Author: Richard Levitte <levitte at openssl.org>
Date:   Fri Dec 1 15:43:43 2017 +0100

    Configure: Recognise .rc and .def / .map / .opt as source files
    
    This makes it possible to add build.info statements for using resource
    files as well as linker scripts (.def for Windows, .map for Unix, and
    .opt for VMS) is if they were source files.  This requires changes in
    the build file templates.
    
    Reviewed-by: Andy Polyakov <appro at openssl.org>
    Reviewed-by: Rich Salz <rsalz at openssl.org>
    (Merged from https://github.com/openssl/openssl/pull/4840)

commit 793077d0beccfa20c9962546393128b92a7e68e4
Author: Richard Levitte <levitte at openssl.org>
Date:   Fri Dec 1 15:40:43 2017 +0100

    Configure: Read in extra information to help create shared libraries
    
    This will replace the use of Makefile.shared
    
    This also means a small adjustment on how the attributes dso_cflags,
    dso_cxxflags and dso_lflags are treated.  They were previously treated
    as an extension to shared_cflag, shared_cxxflag and shared_ldflag, but
    they should really be regarded as alternatives instead, for example
    for darwin, where -dynamiclib is used for shared libraries and -bundle
    for DSOs.
    
    We take the opportunity to clean out things that are redundant or
    otherwise superfluous (for example the check of GNU ld on platforms
    where it never existed).
    
    Reviewed-by: Andy Polyakov <appro at openssl.org>
    Reviewed-by: Rich Salz <rsalz at openssl.org>
    (Merged from https://github.com/openssl/openssl/pull/4840)

commit 3b6c4b07364797566c2c1fd75e499b2d9dd73506
Author: Richard Levitte <levitte at openssl.org>
Date:   Fri Dec 1 15:29:05 2017 +0100

    Configure: Add read_eval_file, a general purpose perl file reader/evaluator
    
    It will return the last expression from the input file.
    
    We also use this in read_config, which slightly changes what's
    expected of Configurations/*.conf.  They do not have to assign
    %targets specifically.  On the other hand, the table of configs MUST
    be the last expression in each of those files.
    
    Reviewed-by: Andy Polyakov <appro at openssl.org>
    Reviewed-by: Rich Salz <rsalz at openssl.org>
    (Merged from https://github.com/openssl/openssl/pull/4840)

-----------------------------------------------------------------------

Summary of changes:
 CHANGES                               |   6 +
 Configurations/00-base-templates.conf |   2 +-
 Configurations/10-main.conf           |  51 +---
 Configurations/50-djgpp.conf          |   2 +-
 Configurations/50-haiku.conf          |   2 +-
 Configurations/50-masm.conf           |   2 +-
 Configurations/90-team.conf           |   2 +-
 Configurations/common.tmpl            |  36 ++-
 Configurations/descrip.mms.tmpl       |  47 ++-
 Configurations/shared-info.pl         | 102 +++++++
 Configurations/unix-Makefile.tmpl     | 157 +++++-----
 Configurations/windows-makefile.tmpl  |  85 +++---
 Configure                             |  98 ++++++-
 Makefile.shared                       | 521 ----------------------------------
 build.info                            |  48 +++-
 util/mkdef.pl                         |  19 +-
 16 files changed, 419 insertions(+), 761 deletions(-)
 create mode 100644 Configurations/shared-info.pl
 delete mode 100644 Makefile.shared

diff --git a/CHANGES b/CHANGES
index 691cbcd..92ae965 100644
--- a/CHANGES
+++ b/CHANGES
@@ -9,6 +9,12 @@
 
  Changes between 1.1.0f and 1.1.1 [xx XXX xxxx]
 
+  *) Get rid of Makefile.shared, and in the process, make the processing
+     of certain files (rc.obj, or the .def/.map/.opt files produced from
+     the ordinal files) more visible and hopefully easier to trace and
+     debug (or make silent).
+     [Richard Levitte]
+
   *) Make it possible to have environment variable assignments as
      arguments to config / Configure.
      [Richard Levitte]
diff --git a/Configurations/00-base-templates.conf b/Configurations/00-base-templates.conf
index f2d7f6a..ce59fbf 100644
--- a/Configurations/00-base-templates.conf
+++ b/Configurations/00-base-templates.conf
@@ -1,5 +1,5 @@
 # -*- Mode: perl -*-
-%targets=(
+my %targets=(
     DEFAULTS => {
 	template	=> 1,
 
diff --git a/Configurations/10-main.conf b/Configurations/10-main.conf
index 28cfd30..1bdb723 100644
--- a/Configurations/10-main.conf
+++ b/Configurations/10-main.conf
@@ -144,7 +144,7 @@ sub vms_info {
     return $vms_info;
 }
 
-%targets = (
+my %targets = (
 
 #### Basic configs that should work on any 32-bit box
     "gcc" => {
@@ -218,7 +218,7 @@ sub vms_info {
         bn_ops           => "SIXTY_FOUR_BIT_LONG",
         perlasm_scheme   => "elf",
         shared_cflag     => "-fPIC",
-        shared_ldflag    => "-m64 -shared -static-libgcc",
+        shared_ldflag    => "-shared -static-libgcc",
         multilib         => "/64",
     },
 
@@ -243,12 +243,12 @@ sub vms_info {
                                               release => "-xO5 -xdepend -xbuiltin"),
                                        threads("-D_REENTRANT")),
         thread_scheme    => "pthreads",
-        lflags           => add("-xarch=generic64",threads("-mt")),
+        lflags           => add(threads("-mt")),
         ex_libs          => add(threads("-lpthread")),
         bn_ops           => "SIXTY_FOUR_BIT_LONG",
         perlasm_scheme   => "elf",
         shared_cflag     => "-KPIC",
-        shared_ldflag    => "-xarch=generic64 -G -dy -z text",
+        shared_ldflag    => "-G -dy -z text",
         multilib         => "/64",
     },
 
@@ -278,7 +278,6 @@ sub vms_info {
         inherit_from     => [ "solaris-sparcv9-gcc" ],
         cflags           => sub { my $f=join(" ", at _); $f =~ s/\-m32/-m64/; $f; },
         bn_ops           => "BN_LLONG RC4_CHAR",
-        shared_ldflag    => "-m64 -shared",
         multilib         => "/64",
     },
 
@@ -311,9 +310,7 @@ sub vms_info {
     "solaris64-sparcv9-cc" => {
         inherit_from     => [ "solaris-sparcv7-cc", asm("sparcv9_asm") ],
         cflags           => add_before("-xarch=v9"),
-        lflags           => add_before("-xarch=v9"),
         bn_ops           => "BN_LLONG RC4_CHAR",
-        shared_ldflag    => "-xarch=v9 -G -dy -z text",
         multilib         => "/64",
     },
 
@@ -332,7 +329,6 @@ sub vms_info {
         perlasm_scheme   => "n32",
         dso_scheme       => "dlfcn",
         shared_target    => "irix-shared",
-        shared_ldflag    => "-mabi=n32",
         shared_extension => ".so.\$(SHLIB_VERSION_NUMBER)",
         multilib         => "32",
     },
@@ -349,7 +345,6 @@ sub vms_info {
         perlasm_scheme   => "n32",
         dso_scheme       => "dlfcn",
         shared_target    => "irix-shared",
-        shared_ldflag    => "-n32",
         shared_extension => ".so.\$(SHLIB_VERSION_NUMBER)",
         multilib         => "32",
     },
@@ -367,7 +362,6 @@ sub vms_info {
         perlasm_scheme   => "64",
         dso_scheme       => "dlfcn",
         shared_target    => "irix-shared",
-        shared_ldflag    => "-mabi=64",
         shared_extension => ".so.\$(SHLIB_VERSION_NUMBER)",
         multilib         => "64",
     },
@@ -384,7 +378,6 @@ sub vms_info {
         perlasm_scheme   => "64",
         dso_scheme       => "dlfcn",
         shared_target    => "irix-shared",
-        shared_ldflag    => "-64",
         shared_extension => ".so.\$(SHLIB_VERSION_NUMBER)",
         multilib         => "64",
     },
@@ -489,7 +482,7 @@ sub vms_info {
         dso_scheme       => "dlfcn",
         shared_target    => "hpux-shared",
         shared_cflag     => "+Z",
-        shared_ldflag    => "+DD64 -b",
+        shared_ldflag    => "-b",
         shared_extension => ".sl.\$(SHLIB_VERSION_NUMBER)",
         multilib         => "/pa20_64",
     },
@@ -508,7 +501,7 @@ sub vms_info {
         dso_scheme       => "dlfcn",
         shared_target    => "hpux-shared",
         shared_cflag     => "+Z",
-        shared_ldflag    => "+DD32 -b",
+        shared_ldflag    => "-b",
         shared_extension => ".so.\$(SHLIB_VERSION_NUMBER)",
         multilib         => "/hpux32",
     },
@@ -525,7 +518,7 @@ sub vms_info {
         dso_scheme       => "dlfcn",
         shared_target    => "hpux-shared",
         shared_cflag     => "+Z",
-        shared_ldflag    => "+DD64 -b",
+        shared_ldflag    => "-b",
         shared_extension => ".so.\$(SHLIB_VERSION_NUMBER)",
         multilib         => "/hpux64",
     },
@@ -560,7 +553,7 @@ sub vms_info {
         dso_scheme       => "dlfcn",
         shared_target    => "hpux-shared",
         shared_cflag     => "-fpic",
-        shared_ldflag    => "-mlp64 -shared",
+        shared_ldflag    => "-shared",
         shared_extension => ".so.\$(SHLIB_VERSION_NUMBER)",
         multilib         => "/hpux64",
     },
@@ -641,14 +634,12 @@ sub vms_info {
         inherit_from     => [ "linux-generic64", asm("ppc64_asm") ],
         cflags           => add("-m64 -DB_ENDIAN"),
         perlasm_scheme   => "linux64",
-        shared_ldflag    => add("-m64"),
         multilib         => "64",
     },
     "linux-ppc64le" => {
         inherit_from     => [ "linux-generic64", asm("ppc64_asm") ],
         cflags           => add("-m64 -DL_ENDIAN"),
         perlasm_scheme   => "linux64le",
-        shared_ldflag    => add("-m64"),
     },
 
     "linux-armv4" => {
@@ -695,7 +686,6 @@ sub vms_info {
         cflags           => add("-mabi=ilp32"),
         bn_ops           => "SIXTY_FOUR_BIT RC4_CHAR",
         perlasm_scheme   => "linux64",
-        shared_ldflag    => add("-mabi=ilp32"),
     },
 
     "linux-mips32" => {
@@ -704,7 +694,6 @@ sub vms_info {
         inherit_from     => [ "linux-generic32", asm("mips32_asm") ],
         cflags           => add("-mabi=32 -DBN_DIV3W"),
         perlasm_scheme   => "o32",
-        shared_ldflag    => add("-mabi=32"),
     },
     # mips32 and mips64 below refer to contemporary MIPS Architecture
     # specifications, MIPS32 and MIPS64, rather than to kernel bitness.
@@ -713,14 +702,12 @@ sub vms_info {
         cflags           => add("-mabi=n32 -DBN_DIV3W"),
         bn_ops           => "SIXTY_FOUR_BIT RC4_CHAR",
         perlasm_scheme   => "n32",
-        shared_ldflag    => add("-mabi=n32"),
         multilib         => "32",
     },
     "linux64-mips64" => {
         inherit_from     => [ "linux-generic64", asm("mips64_asm") ],
         cflags           => add("-mabi=64 -DBN_DIV3W"),
         perlasm_scheme   => "64",
-        shared_ldflag    => add("-mabi=64"),
         multilib         => "64",
     },
 
@@ -751,7 +738,6 @@ sub vms_info {
                                        release => "-fomit-frame-pointer")),
         bn_ops           => "BN_LLONG",
         perlasm_scheme   => "elf",
-        shared_ldflag    => add("-m32"),
     },
     "linux-x86-clang" => {
         inherit_from     => [ "linux-x86" ],
@@ -764,7 +750,6 @@ sub vms_info {
         cflags           => add("-m64 -DL_ENDIAN"),
         bn_ops           => "SIXTY_FOUR_BIT_LONG",
         perlasm_scheme   => "elf",
-        shared_ldflag    => add("-m64"),
         multilib         => "64",
     },
     "linux-x86_64-clang" => {
@@ -778,7 +763,6 @@ sub vms_info {
         cflags           => add("-mx32 -DL_ENDIAN"),
         bn_ops           => "SIXTY_FOUR_BIT",
         perlasm_scheme   => "elf32",
-        shared_ldflag    => add("-mx32"),
         multilib         => "x32",
     },
 
@@ -791,7 +775,6 @@ sub vms_info {
         inherit_from     => [ "linux-generic64", asm("s390x_asm") ],
         cflags           => add("-m64 -DB_ENDIAN"),
         perlasm_scheme   => "64",
-        shared_ldflag    => add("-m64"),
         multilib         => "64",
     },
     "linux32-s390x" => {
@@ -815,7 +798,6 @@ sub vms_info {
         cflags           => add("-m31 -Wa,-mzarch -DB_ENDIAN"),
         bn_asm_src       => sub { my $r=join(" ", at _); $r=~s|asm/s390x\.S|bn_asm.c|; $r; },
         perlasm_scheme   => "31",
-        shared_ldflag    => add("-m31"),
         multilib         => "/highgprs",
     },
 
@@ -829,14 +811,12 @@ sub vms_info {
         # but -Wa,-Av8plus should do the trick no matter what.
         inherit_from     => [ "linux-generic32", asm("sparcv9_asm") ],
         cflags           => add("-m32 -mcpu=ultrasparc -Wa,-Av8plus -DB_ENDIAN -DBN_DIV2W"),
-        shared_ldflag    => add("-m32"),
     },
     "linux64-sparcv9" => {
         # GCC 3.1 is a requirement
         inherit_from     => [ "linux-generic64", asm("sparcv9_asm") ],
         cflags           => add("-m64 -mcpu=ultrasparc -DB_ENDIAN"),
         bn_ops           => "BN_LLONG RC4_CHAR",
-        shared_ldflag    => add("-m64"),
         multilib         => "64",
     },
 
@@ -1203,7 +1183,7 @@ sub vms_info {
         perlasm_scheme   => "aix64",
         dso_scheme       => "dlfcn",
         shared_target    => "aix-shared",
-        shared_ldflag    => "-maix64 -shared -static-libgcc -Wl,-G",
+        shared_ldflag    => "-shared -static-libgcc -Wl,-G",
         shared_extension => ".so.\$(SHLIB_VERSION_NUMBER)",
         arflags          => "-X64",
     },
@@ -1221,7 +1201,7 @@ sub vms_info {
         perlasm_scheme   => "aix32",
         dso_scheme       => "dlfcn",
         shared_target    => "aix-shared",
-        shared_ldflag    => "-q32 -G",
+        shared_ldflag    => "-G",
         shared_extension => ".so.\$(SHLIB_VERSION_NUMBER)",
         arflags          => "-X 32",
     },
@@ -1239,7 +1219,7 @@ sub vms_info {
         perlasm_scheme   => "aix64",
         dso_scheme       => "dlfcn",
         shared_target    => "aix-shared",
-        shared_ldflag    => "-q64 -G",
+        shared_ldflag    => "-G",
         shared_extension => ".so.\$(SHLIB_VERSION_NUMBER)",
         arflags          => "-X 64",
     },
@@ -1529,7 +1509,6 @@ sub vms_info {
         dso_scheme       => "dlfcn",
         shared_target    => "cygwin-shared",
         shared_cflag     => "-D_WINDLL",
-        shared_ldflag    => "-shared",
         shared_extension => ".dll",
     },
     "Cygwin-x86_64" => {
@@ -1545,7 +1524,6 @@ sub vms_info {
         dso_scheme       => "dlfcn",
         shared_target    => "cygwin-shared",
         shared_cflag     => "-D_WINDLL",
-        shared_ldflag    => "-shared",
         shared_extension => ".dll",
     },
     # Backward compatibility for those using this target
@@ -1584,7 +1562,6 @@ sub vms_info {
         ranlib           => "ranlib -c",
         shared_target    => "darwin-shared",
         shared_cflag     => "-fPIC",
-        shared_ldflag    => "-dynamiclib",
         shared_extension => ".\$(SHLIB_VERSION_NUMBER).dylib",
     },
     # Option "freeze" such as -std=gnu9x can't negatively interfere
@@ -1594,14 +1571,12 @@ sub vms_info {
         inherit_from     => [ "darwin-common", asm("ppc32_asm") ],
         cflags           => add("-arch ppc -std=gnu9x -DB_ENDIAN -Wa,-force_cpusubtype_ALL"),
         perlasm_scheme   => "osx32",
-        shared_ldflag    => "-arch ppc -dynamiclib",
     },
     "darwin64-ppc-cc" => {
         inherit_from     => [ "darwin-common", asm("ppc64_asm") ],
         cflags           => add("-arch ppc64 -std=gnu9x -DB_ENDIAN"),
         bn_ops           => "SIXTY_FOUR_BIT_LONG RC4_CHAR",
         perlasm_scheme   => "osx64",
-        shared_ldflag    => "-arch ppc64 -dynamiclib",
     },
     "darwin-i386-cc" => {
         inherit_from     => [ "darwin-common", asm("x86_asm") ],
@@ -1609,14 +1584,12 @@ sub vms_info {
                                        release => "-fomit-frame-pointer")),
         bn_ops           => "BN_LLONG RC4_INT",
         perlasm_scheme   => "macosx",
-        shared_ldflag    => "-arch i386 -dynamiclib",
     },
     "darwin64-x86_64-cc" => {
         inherit_from     => [ "darwin-common", asm("x86_64_asm") ],
         cflags           => add("-arch x86_64 -DL_ENDIAN -Wall"),
         bn_ops           => "SIXTY_FOUR_BIT_LONG",
         perlasm_scheme   => "macosx",
-        shared_ldflag    => "-arch x86_64 -dynamiclib",
     },
 
 #### iPhoneOS/iOS
@@ -1748,7 +1721,6 @@ sub vms_info {
         dso_scheme       => sub { env('LIBSSL_dlfcn') },
         shared_target    => "linux-shared",
         shared_cflag     => "-fPIC",
-        shared_ldflag    => "-shared",
         shared_extension => ".so.\$(SHLIB_VERSION_NUMBER)",
         ranlib           => sub { env('RANLIB') },
     },
@@ -1764,7 +1736,6 @@ sub vms_info {
         dso_scheme       => sub { env('LIBSSL_dlfcn') },
         shared_target    => "linux-shared",
         shared_cflag     => "-fPIC",
-        shared_ldflag    => "-shared",
         shared_extension => ".so.\$(SHLIB_VERSION_NUMBER)",
         ranlib           => sub { env('RANLIB') },
     },
diff --git a/Configurations/50-djgpp.conf b/Configurations/50-djgpp.conf
index f532bd1..fa8e662 100644
--- a/Configurations/50-djgpp.conf
+++ b/Configurations/50-djgpp.conf
@@ -2,7 +2,7 @@
 # and rely entirely on the OpenSSL community to help is fine
 # tune and test.
 
-%targets = (
+my %targets = (
     "DJGPP" => {
         inherit_from     => [ asm("x86_asm") ],
         cc               => "gcc",
diff --git a/Configurations/50-haiku.conf b/Configurations/50-haiku.conf
index aea5b2b..b57e148 100644
--- a/Configurations/50-haiku.conf
+++ b/Configurations/50-haiku.conf
@@ -1,4 +1,4 @@
-%targets = (
+my %targets = (
     "haiku-common" => {
         template         => 1,
         cc               => "cc",
diff --git a/Configurations/50-masm.conf b/Configurations/50-masm.conf
index 0ec5e95..e2b54e3 100644
--- a/Configurations/50-masm.conf
+++ b/Configurations/50-masm.conf
@@ -7,7 +7,7 @@
 # proven to be daunting task. This is experimental target, for
 # production builds stick with [up-to-date version of] nasm.
 
-%targets = (
+my %targets = (
     "VC-WIN64A-masm" => {
         inherit_from    => [ "VC-WIN64-common", asm("x86_64_asm"),
                              sub { $disabled{shared} ? () : "x86_64_uplink" } ],
diff --git a/Configurations/90-team.conf b/Configurations/90-team.conf
index beb6ad8..4d57f3f 100644
--- a/Configurations/90-team.conf
+++ b/Configurations/90-team.conf
@@ -1,7 +1,7 @@
 ## -*- mode: perl; -*-
 ## Build configuration targets for openssl-team members
 
-%targets = (
+my %targets = (
     "purify" => {
         cc               => "purify gcc",
         cflags           => "-g -Wall",
diff --git a/Configurations/common.tmpl b/Configurations/common.tmpl
index a03beb6..b9937bd 100644
--- a/Configurations/common.tmpl
+++ b/Configurations/common.tmpl
@@ -97,11 +97,10 @@
  sub doobj {
      my $obj = shift;
      return "" if $cache{$obj};
-     (my $obj_no_o = $obj) =~ s|\.o$||;
      my $bin = shift;
      my %opts = @_;
      if (@{$unified_info{sources}->{$obj}}) {
-         $OUT .= src2obj(obj => $obj_no_o,
+         $OUT .= src2obj(obj => $obj,
                          product => $bin,
                          srcs => $unified_info{sources}->{$obj},
                          deps => $unified_info{depends}->{$obj},
@@ -124,24 +123,25 @@
      my $lib = shift;
      return "" if $cache{$lib};
      unless ($disabled{shared} || $lib =~ /\.a$/) {
-         my %ordinals =
-             $unified_info{ordinals}->{$lib}
-             ? (ordinals => $unified_info{ordinals}->{$lib}) : ();
          $OUT .= libobj2shlib(shlib => $unified_info{sharednames}->{$lib},
                               lib => $lib,
-                              objs => [ map { (my $x = $_) =~ s|\.o$||; $x }
-                                        (@{$unified_info{sources}->{$lib}},
-                                         @{$unified_info{shared_sources}->{$lib}}) ],
+                              objs => [ @{$unified_info{shared_sources}->{$lib}},
+                                        @{$unified_info{sources}->{$lib}} ],
                               deps => [ reducedepends(resolvedepends($lib)) ],
-                              installed => is_installed($lib),
-                              %ordinals);
-         foreach (@{$unified_info{shared_sources}->{$lib}}) {
-             doobj($_, $lib, intent => "lib", installed => is_installed($lib));
+                              installed => is_installed($lib));
+         foreach ((@{$unified_info{shared_sources}->{$lib}},
+                   @{$unified_info{sources}->{$lib}})) {
+             # If this is somehow a compiled object, take care of it that way
+             # Otherwise, it might simply be generated
+             if (defined $unified_info{sources}->{$_}) {
+                 doobj($_, $lib, intent => "lib", installed => is_installed($lib));
+             } else {
+                 dogenerate($_, undef, undef, intent => "lib");
+             }
          }
      }
      $OUT .= obj2lib(lib => $lib,
-                     objs => [ map { (my $x = $_) =~ s|\.o$||; $x }
-                               @{$unified_info{sources}->{$lib}} ]);
+                     objs => [ @{$unified_info{sources}->{$lib}} ]);
      foreach (@{$unified_info{sources}->{$lib}}) {
          doobj($_, $lib, intent => "lib", installed => is_installed($lib));
      }
@@ -155,9 +155,8 @@
      my $lib = shift;
      return "" if $cache{$lib};
      $OUT .= obj2dso(lib => $lib,
-                     objs => [ map { (my $x = $_) =~ s|\.o$||; $x }
-                               (@{$unified_info{sources}->{$lib}},
-                                @{$unified_info{shared_sources}->{$lib}}) ],
+                     objs => [ @{$unified_info{sources}->{$lib}},
+                               @{$unified_info{shared_sources}->{$lib}} ],
                      deps => [ resolvedepends($lib) ],
                      installed => is_installed($lib));
      foreach ((@{$unified_info{sources}->{$lib}},
@@ -174,8 +173,7 @@
      return "" if $cache{$bin};
      my $deps = [ reducedepends(resolvedepends($bin)) ];
      $OUT .= obj2bin(bin => $bin,
-                     objs => [ map { (my $x = $_) =~ s|\.o$||; $x }
-                               @{$unified_info{sources}->{$bin}} ],
+                     objs => [ @{$unified_info{sources}->{$bin}} ],
                      deps => $deps,
                      installed => is_installed($bin));
      foreach (@{$unified_info{sources}->{$bin}}) {
diff --git a/Configurations/descrip.mms.tmpl b/Configurations/descrip.mms.tmpl
index cfa055b..2bd9ad4 100644
--- a/Configurations/descrip.mms.tmpl
+++ b/Configurations/descrip.mms.tmpl
@@ -337,7 +337,7 @@ uninstall : uninstall_docs uninstall_sw
 # use $(LIBS), $(PROGRAMS), $(GENERATED) and $(ENGINES)directly.
 libclean :
         {- join("\n\t", map { "- DELETE $_.OLB;*" } @libs) || "@ !" -}
-        {- join("\n\t", map { "- DELETE $_.EXE;*,$_.MAP;*,$_.OPT;*" } @shlibs) || "@ !" -}
+        {- join("\n\t", map { "- DELETE $_.EXE;*,$_.MAP;*" } @shlibs) || "@ !" -}
 
 clean : libclean
         {- join("\n\t", map { "- DELETE $_.EXE;*,$_.OPT;*" } @{$unified_info{programs}}) || "@ !" -}
@@ -589,7 +589,7 @@ EOF
 
   sub src2obj {
       my %args = @_;
-      my $obj = $args{obj};
+      (my $obj = $args{obj}) =~ s|\.o$||;
       my $deps = join(", -\n\t\t", @{$args{srcs}}, @{$args{deps}});
 
       # Because VMS C isn't very good at combining a /INCLUDE path with
@@ -661,17 +661,12 @@ EOF
       my $shlib = $args{shlib};
       my $libd = dirname($lib);
       my $libn = basename($lib);
-      (my $mkdef_key = $libn) =~ s/^${osslprefix_q}lib([^0-9]*)\d*/$1/i;
+      my @defs = grep { $_ =~ /\.opt$/ } @{$args{objs}};
       my @deps = compute_lib_depends(@{$args{deps}});
-      my $deps = join(", -\n\t\t", @deps);
+      die "More than one symbol vector" if scalar @defs > 1;
+      my $deps = join(", -\n\t\t", @defs, @deps);
       my $shlib_target = $disabled{shared} ? "" : $target{shared_target};
-      my $ordinalsfile = defined($args{ordinals}) ? $args{ordinals}->[1] : "";
-      my $engine_opt = abs2rel(rel2abs(catfile($config{sourcedir},
-                                               "VMS", "engine.opt")),
-                               rel2abs($config{builddir}));
-      my $mkdef_pl = abs2rel(rel2abs(catfile($config{sourcedir},
-                                             "util", "mkdef.pl")),
-                             rel2abs($config{builddir}));
+      my $shared_def = join(",", map { "$_/OPT" } @defs);
       my $translatesyms_pl = abs2rel(rel2abs(catfile($config{sourcedir},
                                                      "VMS", "translatesyms.pl")),
                                      rel2abs($config{builddir}));
@@ -686,19 +681,12 @@ EOF
                              "WRITE OPT_FILE \"$x\"" } @deps)
           || "\@ !";
       return <<"EOF"
-$shlib.EXE : $lib.OLB $deps $ordinalsfile
-        \$(PERL) $mkdef_pl "$mkdef_key" "VMS" > $shlib.SYMVEC-tmp
-        \$(PERL) $translatesyms_pl \$(BLDDIR)CXX\$DEMANGLER_DB. < $shlib.SYMVEC-tmp > $shlib.SYMVEC
-        DELETE $shlib.SYMVEC-tmp;*
-        OPEN/WRITE/SHARE=READ OPT_FILE $shlib.OPT
-        WRITE OPT_FILE "IDENTIFICATION=""V$config{version}"""
-        TYPE $shlib.SYMVEC /OUTPUT=OPT_FILE:
-        WRITE OPT_FILE "$lib.OLB/LIBRARY"
-        $write_opt
-        CLOSE OPT_FILE
-        LINK \$(LDFLAGS)/SHARE=\$\@ $shlib.OPT/OPT \$(EX_LIBS)
-        DELETE $shlib.SYMVEC;*
-        PURGE $shlib.EXE,$shlib.OPT,$shlib.MAP
+$shlib.EXE : $lib.OLB $deps
+        \$(PERL) $translatesyms_pl \$(BLDDIR)CXX\$DEMANGLER_DB. < $defs[0] > $defs[0]-translated
+        LINK \$(LDFLAGS)/SHARE=\$\@ $defs[0]-translated/OPT,$lib.OLB/LIBRARY
+             \$(EX_LIBS)
+        DELETE $defs[0]-translated;*
+        PURGE $shlib.EXE,$shlib.MAP
 EOF
         . ($config{target} =~ m|alpha| ? "" : <<"EOF"
         SET IMAGE/FLAGS=(NOCALL_DEBUG) \$\@
@@ -711,7 +699,7 @@ EOF
       my $libd = dirname($lib);
       my $libn = basename($lib);
       (my $libn_nolib = $libn) =~ s/^lib//;
-      my @objs = map { "$_.OBJ" } @{$args{objs}};
+      my @objs = map { (my $x = $_) =~ s|\.o$|.OBJ|; $x } @{$args{objs}};
       my @deps = compute_lib_depends(@{$args{deps}});
       my $deps = join(", -\n\t\t", @objs, @deps);
       my $shlib_target = $disabled{shared} ? "" : $target{shared_target};
@@ -750,9 +738,10 @@ EOF
   sub obj2lib {
       my %args = @_;
       (my $lib = $args{lib}) =~ s/\.a$//;
-      my $objs = join(", -\n\t\t", map { $_.".OBJ" } (@{$args{objs}}));
-      my $fill_lib = join("\n\t", (map { "LIBRARY/REPLACE $lib.OLB $_.OBJ" }
-                                    @{$args{objs}}));
+      my @objs = map { (my $x = $_) =~ s|\.o$|.OBJ|; $x } @{$args{objs}};
+      my $objs = join(", -\n\t\t", @objs);
+      my $fill_lib = join("\n\t", (map { "LIBRARY/REPLACE $lib.OLB $_" }
+                                   @objs));
       return <<"EOF";
 $lib.OLB : $objs
         LIBRARY/CREATE/OBJECT $lib.OLB
@@ -765,7 +754,7 @@ EOF
       my $bin = $args{bin};
       my $bind = dirname($bin);
       my $binn = basename($bin);
-      my @objs = map { "$_.OBJ" } @{$args{objs}};
+      my @objs = map { (my $x = $_) =~ s|\.o$|.OBJ|; $x } @{$args{objs}};
       my $objs = join(",", @objs);
       my @deps = compute_lib_depends(@{$args{deps}});
       my $deps = join(", -\n\t\t", @objs, @deps);
diff --git a/Configurations/shared-info.pl b/Configurations/shared-info.pl
new file mode 100644
index 0000000..c5ebfc6
--- /dev/null
+++ b/Configurations/shared-info.pl
@@ -0,0 +1,102 @@
+#! /usr/bin/env perl
+# -*- mode: perl; -*-
+# Copyright 2016-2017 The OpenSSL Project Authors. All Rights Reserved.
+#
+# Licensed under the OpenSSL license (the "License").  You may not use
+# this file except in compliance with the License.  You can obtain a copy
+# in the file LICENSE in the source distribution or at
+# https://www.openssl.org/source/license.html
+
+# This is a collection of extra attributes to be used as input for creating
+# shared libraries, currently on any Unix variant, including Unix like
+# environments on Windows.
+
+sub detect_gnu_ld {
+    my @lines =
+        `$config{cross_compile_prefix}$target{cc} -Wl,-V /dev/null 2>&1`;
+    return grep /^GNU ld/, @lines;
+}
+sub detect_gnu_cc {
+    my @lines =
+        `$config{cross_compile_prefix}$target{cc} -v 2>&1`;
+    return grep /gcc/, @lines;
+}
+
+my %shared_info;
+%shared_info = (
+    'gnu-shared' => {
+        shared_ldflag         => '-shared -Wl,-Bsymbolic',
+        shared_sonameflag     => '-Wl,-soname=',
+    },
+    'linux-shared' => sub {
+        return {
+            %{$shared_info{'gnu-shared'}},
+            shared_defflag    => '-Wl,--version-script=',
+        };
+    },
+    'bsd-gcc-shared' => sub { return $shared_info{'linux-shared'}; },
+    'bsd-shared' => sub {
+        return $shared_info{'gnu-shared'} if detect_gnu_ld();
+        return {
+            shared_ldflag     => '-shared -nostdlib',
+        };
+    },
+    'darwin-shared' => {
+        dso_lflags            => '-bundle',
+        shared_ldflag         => '-dynamiclib -current_version $(SHLIB_VERSION_NUMBER) -compatibility_version $(SHLIB_VERSION_NUMBER)',
+        shared_sonameflag     => '-install_name $(INSTALLTOP)/$(LIBDIR)/',
+    },
+    'cygwin-shared' => {
+        shared_ldflag         => '-shared -Wl,--enable-auto-image-base',
+        shared_impflag        => '-Wl,--out-implib=',
+    },
+    'mingw-shared' => sub {
+        return {
+            %{$shared_info{'cygwin-shared'}},
+            # def_flag made to empty string so  it still generates
+            # something
+            shared_defflag    => '',
+        };
+    },
+    'alpha-osf1-shared' => sub {
+        return $shared_info{'gnu-shared'} if detect_gnu_ld();
+        return {
+            dso_lflags        => '-shared -Wl,-Bsymbolic',
+            shared_ldflag     => '-shared -Wl,-Bsymbolic -set_version $(SHLIB_VERSION_NUMBER)',
+        };
+    },
+    'solaris-shared' => {
+        shared_ldflag     => '-Wl,-Bsymbolic',
+        shared_defflag    => '-Wl,-M,',
+    },
+    'svr3-shared' => sub {
+        return $shared_info{'gnu-shared'} if detect_gnu_ld();
+        return {
+            shared_ldflag     => '-G',
+            shared_sonameflag => '-h ',
+        };
+    },
+    'svr5-shared' => sub {
+        return $shared_info{'gnu-shared'} if detect_gnu_ld();
+        return {
+            shared_ldflag     => detect_gnu_cc() ? '-shared' : '-G',
+            shared_sonameflag => '-h ',
+        };
+    },
+    'irix-shared' => sub {
+        return $shared_info{'gnu-shared'} if detect_gnu_ld();
+        return {
+            shared_ldflag     => '-shared -Wl,-Bsymbolic',
+            shared_sonameflag => '-Wl,-soname=',
+        };
+    },
+    'hpux-shared' => {
+        bin_lflags        => '-Wl,+s,+cdp,../:,+cdp,./:',
+        shared_ldflag     => '-Wl,-B,symbolic,+vnocompatwarnings,-z,+s,+cdp,../:,+cdp,./:',
+        shared_sonameflag => '-Wl,+h,',
+    },
+    'aix-shared' => {
+        bin_lflags            => '-Wl,-bsvr4',
+        shared_ldflag         => '-Wl,-bexpall,-bnolibpath,-bM:SRE',
+    },
+);
diff --git a/Configurations/unix-Makefile.tmpl b/Configurations/unix-Makefile.tmpl
index d66160f..7f8a322 100644
--- a/Configurations/unix-Makefile.tmpl
+++ b/Configurations/unix-Makefile.tmpl
@@ -195,11 +195,12 @@ EX_LIBS= {- $target{ex_libs} -} {- $config{ex_libs} -}
 LIB_CFLAGS={- $target{shared_cflag} || "" -}
 LIB_CXXFLAGS={- $target{shared_cxxflag} || "" -}
 LIB_LDFLAGS={- $target{shared_ldflag}." ".$config{shared_ldflag} -}
-DSO_CFLAGS={- $target{shared_cflag} || "" -}
-DSO_CXXFLAGS={- $target{shared_cxxflag} || "" -}
-DSO_LDFLAGS=$(LIB_LDFLAGS)
-BIN_CFLAGS={- $target{bin_cflags} -}
-BIN_CXXFLAGS={- $target{bin_cxxflag} || "" -}
+DSO_CFLAGS={- $target{dso_cflags} || "" -}
+DSO_CXXFLAGS={- $target{dso_cxxflags} || "" -}
+DSO_LDFLAGS={- $target{dso_lflags} || "" -}
+BIN_CFLAGS={- $target{bin_cflags} || "" -}
+BIN_CXXFLAGS={- $target{bin_cxxflags} || "" -}
+BIN_LDFLAGS={- $target{bin_lflags} || "" -}
 
 PERL={- $config{perl} -}
 
@@ -868,7 +869,7 @@ EOF
   # last in the line.  We may therefore need to put back a line ending.
   sub src2obj {
       my %args = @_;
-      my $obj = $args{obj};
+      (my $obj = $args{obj}) =~ s|\.o$||;
       my @srcs = map { if ($unified_info{generate}->{$_}) {
                            (my $x = $_) =~ s/\.S$/.s/; $x
                        } else {
@@ -883,26 +884,30 @@ EOF
               $incs .= " -I".$withargs{zlib_include};
           }
       }
-      my $cc = '$(CC)';
-      my $cflags = '$(CFLAGS)';
-      if (grep /\.(cc|cpp)$/, @srcs) {
-          $cc = '$(CXX)';
-          $cflags = '$(CXXFLAGS)';
-          $cflags .= ' ' . { lib => '$(LIB_CXXFLAGS)',
-                             dso => '$(DSO_CXXFLAGS)',
-                             bin => '$(BIN_CXXFLAGS)' } -> {$args{intent}};
+      my $cmd = '$(CC)';
+      my $cmdflags = '$(CFLAGS) -c';
+      my $makedepprog = $disabled{makedepend} ? undef : $config{makedepprog};
+      if (grep /\.rc$/, @srcs) {
+          $cmd = '$(RC)';
+          $cmdflags = '$(RCFLAGS)';
+          $makedepprog = undef;
+      } elsif (grep /\.(cc|cpp)$/, @srcs) {
+          $cmd = '$(CXX)';
+          $cmdflags = '$(CXXFLAGS) -c';
+          $cmdflags .= ' ' . { lib => '$(LIB_CXXFLAGS)',
+                               dso => '$(DSO_CXXFLAGS)',
+                               bin => '$(BIN_CXXFLAGS)' } -> {$args{intent}};
       } else {
-          $cflags .= ' ' . { lib => '$(LIB_CFLAGS)',
-                             dso => '$(DSO_CFLAGS)',
-                             bin => '$(BIN_CFLAGS)' } -> {$args{intent}};
+          $cmdflags .= ' ' . { lib => '$(LIB_CFLAGS)',
+                               dso => '$(DSO_CFLAGS)',
+                               bin => '$(BIN_CFLAGS)' } -> {$args{intent}};
       }
-      my $makedepprog = $config{makedepprog};
       my $recipe = <<"EOF";
 $obj$objext: $deps
 EOF
-      if (!$disabled{makedepend} && $makedepprog !~ /\/makedepend/) {
+      if (defined $makedepprog && $makedepprog !~ /\/makedepend/) {
           $recipe .= <<"EOF";
-	$cc $incs $cflags -MMD -MF $obj$depext.tmp -MT \$\@ -c -o \$\@ $srcs
+	$cmd $incs $cmdflags -MMD -MF $obj$depext.tmp -MT \$\@ -c -o \$\@ $srcs
 	\@touch $obj$depext.tmp
 	\@if cmp $obj$depext.tmp $obj$depext > /dev/null 2> /dev/null; then \\
 		rm -f $obj$depext.tmp; \\
@@ -912,11 +917,11 @@ EOF
 EOF
       } else {
           $recipe .= <<"EOF";
-	$cc $incs $cflags -c -o \$\@ $srcs
+	$cmd $incs $cmdflags -o \$\@ $srcs
 EOF
-          if (!$disabled{makedepend} && $makedepprog =~ /\/makedepend/) {
+          if (defined $makedepprog  && $makedepprog =~ /\/makedepend/) {
               $recipe .= <<"EOF";
-	-\$(MAKEDEPEND) -f- -o"|\$\@" -- $incs $cflags -- $srcs \\
+	-\$(MAKEDEPEND) -f- -o"|\$\@" -- $incs $cmdflags -- $srcs \\
 	    >$obj$depext.tmp 2>/dev/null
 	-\$(PERL) -i -pe 's/^.*\\|//; s/ \\/(\\\\.|[^ ])*//; \$\$_ = undef if (/: *\$\$/ || /^(#.*| *)\$\$/); \$\$_.="\\n" unless !defined(\$\$_) or /\\R\$\$/g;' $obj$depext.tmp
 	\@if cmp $obj$depext.tmp $obj$depext > /dev/null 2> /dev/null; then \\
@@ -943,71 +948,78 @@ EOF
                                     my $f = basename($_);
                                     (my $l = $f) =~ s/^lib//;
                                     " -L$d -l$l" } @{$args{deps}});
-      my $deps = join(" ",compute_lib_depends(@{$args{deps}}));
-      my $shlib_target = $target{shared_target};
-      my $ordinalsfile = defined($args{ordinals}) ? $args{ordinals}->[1] : "";
+      my @objs = map { (my $x = $_) =~ s|\.o$|$objext|; $x }
+                 grep { $_ =~ m|\.o$| }
+                 @{$args{objs}};
+      my @defs = grep { $_ =~ /\.(def|map)$/ } @{$args{objs}};
+      my @deps = compute_lib_depends(@{$args{deps}});
+      die "More than one exported symbol map" if scalar @defs > 1;
+      my $objs = join(" ", @objs);
+      my $deps = join(" ", @objs, @defs, @deps);
       my $target = shlib_simple($lib);
       my $target_full = shlib($lib);
-      return <<"EOF"
-# With a build on a Windows POSIX layer (Cygwin or Mingw), we know for a fact
+      my $shared_soname = "";
+      $shared_soname .= ' '.$target{shared_sonameflag}.basename($target_full)
+          if defined $target{shared_sonameflag};
+      my $shared_imp = "";
+      $shared_imp .= ' '.$target{shared_impflag}.basename($target)
+          if defined $target{shared_impflag};
+      my $shared_def = join("", map { ' '.$target{shared_defflag}.$_ } @defs);
+      my $recipe = <<"EOF";
+# When building on a Windows POSIX layer (Cygwin or Mingw), we know for a fact
 # that two files get produced, {shlibname}.dll and {libname}.dll.a.
 # With all other Unix platforms, we often build a shared library with the
 # SO version built into the file name and a symlink without the SO version
 # It's not necessary to have both as targets.  The choice falls on the
 # simplest, {libname}\$(SHLIB_EXT_IMPORT) for Windows POSIX layers and
 # {libname}\$(SHLIB_EXT_SIMPLE) for the Unix platforms.
-$target: $lib$libext $deps $ordinalsfile
-	\$(MAKE) -f \$(SRCDIR)/Makefile.shared -e \\
-		ECHO=\$(ECHO) \\
-		PLATFORM=\$(PLATFORM) \\
-		PERL="\$(PERL)" SRCDIR='\$(SRCDIR)' DSTDIR="$libd" \\
-		INSTALLTOP='\$(INSTALLTOP)' LIBDIR='\$(LIBDIR)' \\
-		LIBDEPS='\$(PLIB_LDFLAGS) '"$linklibs"' \$(EX_LIBS)' \\
-		LIBNAME=$libname SHLIBVERSION=\$(SHLIB_VERSION_NUMBER) \\
-		STLIBNAME=$lib$libext \\
-		SHLIBNAME=$target SHLIBNAME_FULL=$target_full \\
-		CC='\$(CC)' CFLAGS='\$(CFLAGS) \$(LIB_CFLAGS)' \\
-		LDFLAGS='\$(LDFLAGS)' SHARED_LDFLAGS='\$(LIB_LDFLAGS)' \\
-		RC='\$(RC)' SHARED_RCFLAGS='\$(RCFLAGS)' \\
-		link_shlib.$shlib_target
+$target: $deps
+	\$(CC) \$(CFLAGS) \$(LIB_CFLAGS) \$(LIB_LDFLAGS)$shared_soname$shared_imp \\
+		-o $target_full$shared_def $objs \\
+                \$(PLIB_LDFLAGS) $linklibs \$(EX_LIBS)
 EOF
-	  . (windowsdll() ? <<"EOF" : "");
+      if (windowsdll()) {
+          $recipe .= <<"EOF";
 	rm -f apps/$shlib'\$(SHLIB_EXT)'
 	rm -f test/$shlib'\$(SHLIB_EXT)'
+	rm -f fuzz/$shlib'\$(SHLIB_EXT)'
 	cp -p $shlib'\$(SHLIB_EXT)' apps/
 	cp -p $shlib'\$(SHLIB_EXT)' test/
+	cp -p $shlib'\$(SHLIB_EXT)' fuzz/
 EOF
+      } else {
+          $recipe .= <<"EOF";
+	rm -f $target
+	ln -s $target_full $target
+EOF
+      }
   }
   sub obj2dso {
       my %args = @_;
       my $dso = $args{lib};
       my $dsod = dirname($dso);
       my $dson = basename($dso);
-      my $shlibdeps = join("", map { my $d = dirname($_);
-                                     my $f = basename($_);
-                                     (my $l = $f) =~ s/^lib//;
-                                     " -L$d -l$l" } @{$args{deps}});
-      my $deps = join(" ",compute_lib_depends(@{$args{deps}}));
-      my $shlib_target = $target{shared_target};
-      my $objs = join(" ", map { $_.$objext } @{$args{objs}});
+      my $linklibs = join("", map { my $d = dirname($_);
+                                    my $f = basename($_);
+                                    (my $l = $f) =~ s/^lib//;
+                                    " -L$d -l$l" } @{$args{deps}});
+      my @objs = map { (my $x = $_) =~ s|\.o$|$objext|; $x } @{$args{objs}};
+      my @deps = compute_lib_depends(@{$args{deps}});
+      my $objs = join(" ", @objs);
+      my $deps = join(" ", @deps);
       my $target = dso($dso);
       return <<"EOF";
 $target: $objs $deps
-	\$(MAKE) -f \$(SRCDIR)/Makefile.shared -e \\
-		PLATFORM=\$(PLATFORM) \\
-		PERL="\$(PERL)" SRCDIR='\$(SRCDIR)' DSTDIR="$dsod" \\
-		LIBDEPS='\$(PLIB_LDFLAGS) '"$shlibdeps"' \$(EX_LIBS)' \\
-		SHLIBNAME_FULL=$target LDFLAGS='\$(LDFLAGS)' \\
-		CC='\$(CC)' CFLAGS='\$(CFLAGS) \$(DSO_CFLAGS)' \\
-		SHARED_LDFLAGS='\$(DSO_LDFLAGS)' \\
-		LIBEXTRAS="$objs" \\
-		link_dso.$shlib_target
+	\$(CC) \$(CFLAGS) \$(DSO_CFLAGS) \$(DSO_LDFLAGS) \\
+		-o $target $objs \\
+                \$(PLIB_LDFLAGS) $linklibs \$(EX_LIBS)
 EOF
   }
   sub obj2lib {
       my %args = @_;
       (my $lib = $args{lib}) =~ s/\.a$//;
-      my $objs = join(" ", map { $_.$objext } @{$args{objs}});
+      my @objs = map { (my $x = $_) =~ s|\.o$|$objext|; $x } @{$args{objs}};
+      my $objs = join(" ", @objs);
       return <<"EOF";
 $lib$libext: $objs
 	\$(AR) \$\@ \$\?
@@ -1019,7 +1031,8 @@ EOF
       my $bin = $args{bin};
       my $bind = dirname($bin);
       my $binn = basename($bin);
-      my $objs = join(" ", map { $_.$objext } @{$args{objs}});
+      my $objs = join(" ", map { (my $x = $_) =~ s|\.o$|$objext|; $x }
+                           @{$args{objs}});
       my $deps = join(" ",compute_lib_depends(@{$args{deps}}));
       my $linklibs = join("", map { if ($_ =~ /\.a$/) {
                                         " $_";
@@ -1031,23 +1044,17 @@ EOF
                                         " -L$d -l$l"
                                     }
                                   } @{$args{deps}});
-      my $shlib_target = $disabled{shared} ? "" : $target{shared_target};
-      my $cc = '$(CC)';
-      my $cflags = '$(CFLAGS) $(BIN_CFLAGS)';
-      if (grep /_cc$/, @{$args{objs}}) {
-          $cc = '$(CXX)';
-          $cflags = '$(CXXFLAGS) $(BIN_CXXFLAGS)';
+      my $cmd = '$(CC)';
+      my $cmdflags = '$(CFLAGS) $(BIN_CFLAGS)';
+      if (grep /_cc\.o$/, @{$args{objs}}) {
+          $cmd = '$(CXX)';
+          $cmdflags = '$(CXXFLAGS) $(BIN_CXXFLAGS)';
       }
       return <<"EOF";
 $bin$exeext: $objs $deps
-	\$(RM) $bin$exeext
-	\$(MAKE) -f \$(SRCDIR)/Makefile.shared -e \\
-		PERL="\$(PERL)" SRCDIR=\$(SRCDIR) \\
-		APPNAME=$bin$exeext OBJECTS="$objs" \\
-		LIBDEPS='\$(PLIB_LDFLAGS) '"$linklibs"' \$(EX_LIBS)' \\
-		CC='$cc' CFLAGS='$cflags' \\
-		LDFLAGS='\$(LDFLAGS)' \\
-		link_app.$shlib_target
+	rm -f $bin$exeext
+	$cmd $cmdflags \$(LDFLAGS) \$(BIN_LDFLAGS) -o $bin$exeext $objs \\
+		\$(PLIB_LDFLAGS) $linklibs \$(EX_LIBS)
 EOF
   }
   sub in2script {
diff --git a/Configurations/windows-makefile.tmpl b/Configurations/windows-makefile.tmpl
index 0ea1bba..51094f7 100644
--- a/Configurations/windows-makefile.tmpl
+++ b/Configurations/windows-makefile.tmpl
@@ -4,6 +4,7 @@
 ## {- join("\n## ", @autowarntext) -}
 {-
  our $objext = $target{obj_extension} || ".obj";
+ our $resext = $target{res_extension} || ".res";
  our $depext = $target{dep_extension} || ".d";
  our $exeext = $target{exe_extension} || ".exe";
  our $libext = $target{lib_extension} || ".lib";
@@ -169,8 +170,8 @@ LDOUTFLAG={- $target{loutflag} || "/out:" -}$(OSSL_EMPTY)
 EX_LIBS={- $target{ex_libs} -}
 LIB_CFLAGS={- join(" ", $target{lib_cflags}, $target{shared_cflag}) || "" -}
 LIB_LDFLAGS={- $target{shared_ldflag} || "" -}
-DSO_CFLAGS={- join(" ", $target{dso_cflags}, $target{shared_cflag}) || "" -}
-DSO_LDFLAGS={- join(" ", $target{dso_lflags}, $target{shared_ldflag}) || "" -}
+DSO_CFLAGS={- $target{dso_cflags} || "" -}
+DSO_LDFLAGS={- $target{dso_ldflag} || "" -}
 BIN_CFLAGS={- $target{bin_cflags} -}
 BIN_LDFLAGS={- $target{bin_lflags} -}
 
@@ -445,7 +446,6 @@ EOF
 
  sub src2obj {
      my %args = @_;
-     my $obj = $args{obj};
      my @srcs = map { (my $x = $_) =~ s/\.s$/.asm/; $x
                     } ( @{$args{srcs}} );
      my $srcs = '"'.join('" "',  @srcs).'"';
@@ -460,6 +460,13 @@ EOF
 		     dso => '$(DSO_CFLAGS)',
 		     bin => '$(BIN_CFLAGS)' } -> {$args{intent}};
      my $makedepprog = $config{makedepprog};
+     if ($srcs[0] =~ /\.rc$/) {
+         return <<"EOF";
+$args{obj}: $deps
+	\$(RC) \$(RCOUTFLAG)\$\@ $srcs
+EOF
+     }
+     (my $obj = $args{obj}) =~ s|\.o$||;
      if ($srcs[0] =~ /\.asm$/) {
          return <<"EOF";
 $obj$objext: $deps
@@ -493,32 +500,24 @@ EOF
      my %args = @_;
      my $lib = $args{lib};
      my $shlib = $args{shlib};
-     (my $mkdef_key = $lib) =~ s/^lib//i;
-     my $objs = join("\n", map { $_.$objext } @{$args{objs}});
-     my $linklibs = join("",
-			 map { "\n$_" } compute_lib_depends(@{$args{deps}}));
-     my $deps = join(" ",
-		     (map { $_.$objext } @{$args{objs}}),
-		     compute_lib_depends(@{$args{deps}}));
-     my $ordinalsfile = defined($args{ordinals}) ? $args{ordinals}->[1] : "";
-     my $mkdef_pl = abs2rel(rel2abs(catfile($config{sourcedir},
-					    "util", "mkdef.pl")),
-			    rel2abs($config{builddir}));
-     my $mkrc_pl = abs2rel(rel2abs(catfile($config{sourcedir},
-					   "util", "mkrc.pl")),
-			   rel2abs($config{builddir}));
+     my @objs = map { (my $x = $_) =~ s|\.o$|$objext|; $x }
+                grep { $_ =~ m|\.o$| }
+                @{$args{objs}};
+     my @defs = grep { $_ =~ /\.def$/ } @{$args{objs}};
+     my @deps = compute_lib_depends(@{$args{deps}});
+     die "More than one exported symbols list" if scalar @defs > 1;
+     my $linklibs = join("", map { "$_\n" } @deps);
+     my $objs = join("\n", @objs);
+     my $deps = join(" ", @objs, @defs, @deps);
      my $target = shlib_import($lib);
+     my $shared_def = join("", map { " /def:$_" } @defs);
      return <<"EOF"
-$target: $deps "$ordinalsfile" "$mkdef_pl"
-	"\$(PERL)" "$mkdef_pl" "$mkdef_key" 32 > $shlib.def
-	"\$(PERL)" -i.tmp -pe "s|^LIBRARY\\s+${mkdef_key}32|LIBRARY $shlib|;" $shlib.def
-	DEL $shlib.def.tmp
-	"\$(PERL)" "$mkrc_pl" $shlib$shlibext > $shlib.rc
-	\$(RC) \$(RCOUTFLAG)$shlib.res $shlib.rc
+$target: $deps
 	IF EXIST $shlib$shlibext.manifest DEL /F /Q $shlib$shlibext.manifest
 	\$(LD) \$(LDFLAGS) \$(LIB_LDFLAGS) \\
-		/implib:\$@ \$(LDOUTFLAG)$shlib$shlibext /def:$shlib.def @<< || (DEL /Q \$(\@B).* $shlib.* && EXIT 1)
-$objs $shlib.res$linklibs \$(EX_LIBS)
+		/implib:\$@ \$(LDOUTFLAG)$shlib$shlibext$shared_def @<< || (DEL /Q \$(\@B).* $shlib.* && EXIT 1)
+$objs
+$linklibs\$(EX_LIBS)
 <<
 	IF EXIST $shlib$shlibext.manifest \\
 	   \$(MT) \$(MTFLAGS) \$(MTINFLAG)$shlib$shlibext.manifest \$(MTOUTFLAG)$shlib$shlibext
@@ -534,12 +533,11 @@ EOF
      my %args = @_;
      my $dso = $args{lib};
      my $dso_n = basename($dso);
-     my $objs = join("\n", map { $_.$objext } @{$args{objs}});
-     my $linklibs = join("",
-			 map { "\n$_" } compute_lib_depends(@{$args{deps}}));
-     my $deps = join(" ",
-		     (map { $_.$objext } @{$args{objs}}),
-		     compute_lib_depends(@{$args{deps}}));
+     my @objs = map { (my $x = $_) =~ s|\.o$|$objext|; $x } @{$args{objs}};
+     my @deps = compute_lib_depends(@{$args{deps}});
+     my $objs = join("\n", @objs);
+     my $linklibs = join("", map { "$_\n" } @deps);
+     my $deps = join(" ", @objs, @deps);
      return <<"EOF";
 $dso$dsoext: $deps
 	IF EXIST $dso$dsoext.manifest DEL /F /Q $dso$dsoext.manifest
@@ -549,7 +547,8 @@ EXPORTS
     bind_engine		@1
     v_check		@2
 <<
-$objs$linklibs \$(EX_LIBS)
+$objs
+$linklibs \$(EX_LIBS)
 <<
 	IF EXIST $dso$dsoext.manifest \\
 	   \$(MT) \$(MTFLAGS) \$(MTINFLAG)$dso$dsoext.manifest \$(MTOUTFLAG)$dso$dsoext
@@ -565,29 +564,31 @@ EOF
      return "" unless $disabled{"shared"} || $lib =~ /\.a$/;
 
      $lib =~ s/\.a$//;
-     my $objs = join("\n", map { $_.$objext } @{$args{objs}});
-     my $deps = join(" ", map { $_.$objext } @{$args{objs}});
+     my @objs = map { (my $x = $_) =~ s|\.o$|$objext|; $x } @{$args{objs}};
+     my $objs = join("\n", @objs);
+     my $deps = join(" ", @objs);
      return <<"EOF";
 $lib$libext: $deps
 	\$(AR) \$(ARFLAGS) \$(AROUTFLAG)$lib$libext @<<
-\$**
+$objs
 <<
 EOF
  }
  sub obj2bin {
      my %args = @_;
      my $bin = $args{bin};
-     my $objs = join("\n", map { $_.$objext } @{$args{objs}});
-     my $linklibs = join("",
-			 map { "\n$_" } compute_lib_depends(@{$args{deps}}));
-     my $deps = join(" ",
-		     (map { $_.$objext } @{$args{objs}}),
-		     compute_lib_depends(@{$args{deps}}));
+     my @objs = map { (my $x = $_) =~ s|\.o$|$objext|; $x } @{$args{objs}};
+     my @deps = compute_lib_depends(@{$args{deps}});
+     my $objs = join("\n", @objs);
+     my $linklibs = join("", map { "$_\n" } @deps);
+     my $deps = join(" ", @objs, @deps);
      return <<"EOF";
 $bin$exeext: $deps
 	IF EXIST $bin$exeext.manifest DEL /F /Q $bin$exeext.manifest
 	\$(LD) \$(LDFLAGS) \$(BIN_LDFLAGS) \$(LDOUTFLAG)$bin$exeext @<<
-$objs setargv.obj$linklibs \$(EX_LIBS)
+$objs
+setargv.obj
+$linklibs\$(EX_LIBS)
 <<
 	IF EXIST $bin$exeext.manifest \\
 	   \$(MT) \$(MTFLAGS) \$(MTINFLAG)$bin$exeext.manifest \$(MTOUTFLAG)$bin$exeext
diff --git a/Configure b/Configure
index db19121..5abbd72 100755
--- a/Configure
+++ b/Configure
@@ -879,9 +879,48 @@ my %target = resolve_config($target);
 
 &usage if (!%target || $target{template});
 
+%target = ( %{$table{DEFAULTS}}, %target );
+
+# Make the flags to build DSOs the same as for shared libraries unless they
+# are already defined
+$target{dso_cflags} = $target{shared_cflag} unless defined $target{dso_cflags};
+$target{dso_cxxflags} = $target{shared_cxxflag} unless defined $target{dso_cxxflags};
+$target{dso_lflags} = $target{shared_ldflag} unless defined $target{dso_lflags};
+{
+    my $shared_info_pl =
+        catfile(dirname($0), "Configurations", "shared-info.pl");
+    my %shared_info = read_eval_file($shared_info_pl);
+    push @{$target{_conf_fname_int}}, $shared_info_pl;
+    my $si = $target{shared_target};
+    while (ref $si ne "HASH") {
+        last if ! defined $si;
+        if (ref $si eq "CODE") {
+            $si = $si->();
+        } else {
+            $si = $shared_info{$si};
+        }
+    }
+
+    # Some of the 'shared_target' values don't have any entried in
+    # %shared_info.  That's perfectly fine, AS LONG AS the build file
+    # template knows how to handle this.  That is currently the case for
+    # Windows and VMS.
+    if (defined $si) {
+        # Just as above, copy certain shared_* attributes to the corresponding
+        # dso_ attribute unless the latter is already defined
+        $si->{dso_cflags} = $si->{shared_cflag} unless defined $si->{dso_cflags};
+        $si->{dso_cxxflags} = $si->{shared_cxxflag} unless defined $si->{dso_cxxflags};
+        $si->{dso_lflags} = $si->{shared_ldflag} unless defined $si->{dso_lflags};
+        foreach (sort keys %$si) {
+            $target{$_} = defined $target{$_}
+                ? add($si->{$_})->($target{$_})
+                : $si->{$_};
+        }
+    }
+}
+
 my %conf_files = map { $_ => 1 } (@{$target{_conf_fname_int}});
 $config{conf_files} = [ sort keys %conf_files ];
-%target = ( %{$table{DEFAULTS}}, %target );
 
 foreach my $feature (@{$target{disable}}) {
     if (exists $deprecated_disablables{$feature}) {
@@ -1163,8 +1202,11 @@ unless ($disabled{"fuzz-libfuzzer"} && $disabled{"fuzz-afl"}
 # This saves the build files from having to check
 if ($disabled{pic})
 	{
-	$target{shared_cflag} = $target{shared_ldflag} =
-		$target{shared_rcflag} = "";
+	foreach (qw(shared_cflag shared_cxxflag shared_ldflag
+		    dso_cflags dso_cxxflags dso_lflags))
+		{
+		$target{$_} = "";
+		}
 	}
 else
 	{
@@ -1833,14 +1875,27 @@ EOF
                 if (! -f $s) {
                     $s = cleanfile($buildd, $_, $blddir);
                 }
-                # We recognise C++, C and asm files
+
                 if ($s =~ /\.(cc|cpp|c|s|S)$/) {
+                    # We recognise C++, C and asm files
                     my $o = $_;
                     $o =~ s/\.[csS]$/.o/; # C and assembler
                     $o =~ s/\.(cc|cpp)$/_cc.o/; # C++
                     $o = cleanfile($buildd, $o, $blddir);
                     $unified_info{shared_sources}->{$ddest}->{$o} = 1;
                     $unified_info{sources}->{$o}->{$s} = 1;
+                } elsif ($s =~ /\.rc$/) {
+                    # We also recognise resource files
+                    my $o = $_;
+                    $o =~ s/\.rc$/.res/; # Resource configuration
+                    my $o = cleanfile($buildd, $o, $blddir);
+                    $unified_info{shared_sources}->{$ddest}->{$o} = 1;
+                    $unified_info{sources}->{$o}->{$s} = 1;
+                } elsif ($s =~ /\.(def|map|opt)$/) {
+                    # We also recognise .def / .map / .opt files
+                    # We know they are generated files
+                    my $def = cleanfile($buildd, $s, $blddir);
+                    $unified_info{shared_sources}->{$ddest}->{$def} = 1;
                 } else {
                     die "unrecognised source file type for shared library: $s\n";
                 }
@@ -2292,25 +2347,38 @@ sub add {
     sub { _add($separator, @_, @x) };
 }
 
+sub read_eval_file {
+    my $fname = shift;
+    my $content;
+    my @result;
+
+    open F, "< $fname" or die "Can't open '$fname': $!\n";
+    {
+        undef local $/;
+        $content = <F>;
+    }
+    close F;
+    {
+        local $@;
+
+        @result = ( eval $content );
+        warn $@ if $@;
+    }
+    return wantarray ? @result : $result[0];
+}
+
 # configuration reader, evaluates the input file as a perl script and expects
 # it to fill %targets with target configurations.  Those are then added to
 # %table.
 sub read_config {
     my $fname = shift;
-    open(CONFFILE, "< $fname")
-	or die "Can't open configuration file '$fname'!\n";
-    my $x = $/;
-    undef $/;
-    my $content = <CONFFILE>;
-    $/ = $x;
-    close(CONFFILE);
-    my %targets = ();
+    my %targets;
+
     {
 	# Protect certain tables from tampering
-	local %table = %::table;
+	local %table = ();
 
-	eval $content;
-	warn $@ if $@;
+	%targets = read_eval_file($fname);
     }
 
     # For each target, check that it's configured with a hash table.
diff --git a/Makefile.shared b/Makefile.shared
deleted file mode 100644
index 1053989..0000000
--- a/Makefile.shared
+++ /dev/null
@@ -1,521 +0,0 @@
-#
-# Helper makefile to link shared libraries in a portable way.
-# This is much simpler than libtool, and hopefully not too error-prone.
-#
-# The following variables need to be set on the command line to build
-# properly
-
-# CC contains the current compiler.  This one MUST be defined
-CC=cc
-CFLAGS=$(CFLAG)
-# LDFLAGS contains flags to be used when temporary object files (when building
-# shared libraries) are created, or when an application is linked.
-# SHARED_LDFLAGS contains flags to be used when the shared library is created.
-LDFLAGS=$(LDFLAG)
-SHARED_LDFLAGS=$(SHARED_LDFLAG)
-
-RC=windres
-# SHARED_RCFLAGS are flags used with windres, i.e. when build for Cygwin
-# or Mingw.
-SHARED_RCFLAGS=$(SHARED_RCFLAG)
-
-NM=nm
-ECHO=echo
-
-# LIBNAME contains just the name of the library, without prefix ("lib"
-# on Unix, "cyg" for certain forms under Cygwin...) or suffix (.a, .so,
-# .dll, ...).  This one MUST have a value when using this makefile to
-# build shared libraries.
-# For example, to build libfoo.so, you need to do the following:
-#LIBNAME=foo
-LIBNAME=
-
-# STLIBNAME contains the path of the static library to build the shared
-# library from, for example:
-#STLIBNAME=libfoo.a
-STLIBNAME=
-
-# On most Unix platforms, SHLIBNAME contains the path of the short name of
-# the shared library to build, for example
-#SHLIBNAME=libfoo.so
-# On Windows POSIX layers (cygwin and mingw), SHLIBNAME contains the import
-# library name for the shared library to be built, for example:
-#SHLIBNAME=libfoo.dll.a
-
-# SHLIBNAME_FULL contains the path of the full name of the shared library to
-# build, for example:
-#SHLIBNAME_FULL=libfoo.so.1.2
-# When building DSOs, SHLIBNAME_FULL contains path of the full DSO name, for
-# example:
-#SHLIBNAME_FULL=dir/dso.so
-SHLIBNAME_FULL=
-
-# SHLIBVERSION contains the current version of the shared library (not to
-# be confused with the project version)
-#SHLIBVERSION=1.2
-SHLIBVERSION=
-
-# NOTE: to build shared libraries, LIBNAME, STLIBNAME, SHLIBNAME and
-# SHLIBNAME_FULL MUST have values when using this makefile, and in some
-# cases, SHLIBVERSION as well.  To build DSOs, SHLIBNAME_FULL MUST have
-# a value, the rest can be left alone.
-
-
-# APPNAME contains just the name of the application, without suffix (""
-# on Unix, ".exe" on Windows, ...).  This one MUST have a value when using
-# this makefile to build applications.
-# For example, to build foo, you need to do the following:
-#APPNAME=foo
-APPNAME=
-
-# SRCDIR is the top directory of the source tree.
-SRCDIR=.
-
-# OBJECTS contains all the object files to link together into the application.
-# This must contain at least one object file.
-#OBJECTS=foo.o
-OBJECTS=
-
-# LIBEXTRAS contains extra modules to link together with the library.
-# For example, if a second library, say libbar.a needs to be linked into
-# libfoo.so, you need to do the following:
-#LIBEXTRAS=libbar.a
-# Note that this MUST be used when using the link_dso targets, to hold the
-# names of all object files that go into the target shared object.
-LIBEXTRAS=
-
-# LIBDEPS contains all the flags necessary to cover all necessary
-# dependencies to other libraries.
-LIBDEPS=
-
-#------------------------------------------------------------------------------
-# The rest is private to this makefile.
-
-SET_X=:
-#SET_X=set -x
-
-top:
-	echo "Trying to use this makefile interactively?  Don't." ; exit 1
-
-LINK_APP=	\
-  ( $(SET_X);   \
-    LIBDEPS="$${LIBDEPS:-$(LIBDEPS)}"; \
-    LDCMD="$${LDCMD:-$(CC)}"; LDFLAGS="$${LDFLAGS:-$(CFLAGS) $(LDFLAGS)}"; \
-    LIBPATH=`for x in $$LIBDEPS; do echo $$x; done | sed -e 's/^ *-L//;t' -e d | uniq`; \
-    LIBPATH=`echo $$LIBPATH | sed -e 's/ /:/g'`; \
-    $(ECHO) LD_LIBRARY_PATH=$$LIBPATH:$$LD_LIBRARY_PATH \
-        $${LDCMD} $${LDFLAGS} -o $${APPNAME:=$(APPNAME)} $(OBJECTS) $${LIBDEPS}; \
-    LD_LIBRARY_PATH=$$LIBPATH:$$LD_LIBRARY_PATH \
-    $${LDCMD} $${LDFLAGS} -o $${APPNAME:=$(APPNAME)} $(OBJECTS) $${LIBDEPS} )
-
-LINK_SO=	\
-  ( $(SET_X);   \
-    LIBDEPS="$${LIBDEPS:-$(LIBDEPS)}"; \
-    SHAREDCMD="$${SHAREDCMD:-$(CC)}"; \
-    SHAREDFLAGS="$${SHAREDFLAGS:-$(CFLAGS) $(SHARED_LDFLAGS)}"; \
-    LIBPATH=`for x in $$LIBDEPS; do echo $$x; done | sed -e 's/^ *-L//;t' -e d | uniq`; \
-    LIBPATH=`echo $$LIBPATH | sed -e 's/ /:/g'`; \
-    $(ECHO) LD_LIBRARY_PATH=$$LIBPATH:$$LD_LIBRARY_PATH \
-         $${SHAREDCMD} $${SHAREDFLAGS} \
-	     -o $(SHLIBNAME_FULL) \
-	     $$ALLSYMSFLAGS $$SHOBJECTS $$NOALLSYMSFLAGS $$LIBDEPS; \
-    LD_LIBRARY_PATH=$$LIBPATH:$$LD_LIBRARY_PATH \
-    $${SHAREDCMD} $${SHAREDFLAGS} \
-	-o $(SHLIBNAME_FULL) \
-	$$ALLSYMSFLAGS $$SHOBJECTS $$NOALLSYMSFLAGS $$LIBDEPS \
-  ) && $(SYMLINK_SO)
-
-SYMLINK_SO=	\
-	if [ -n "$$INHIBIT_SYMLINKS" ]; then :; else \
-		if [ -n "$(SHLIBNAME_FULL)" -a -n "$(SHLIBNAME)" -a \
-		     "$(SHLIBNAME_FULL)" != "$(SHLIBNAME)" ]; then \
-			( $(SET_X); \
-			  rm -f $(SHLIBNAME); \
-			  ln -s $(SHLIBNAME_FULL) $(SHLIBNAME) ); \
-		fi; \
-	fi
-
-LINK_SO_SHLIB=	SHOBJECTS="$(STLIBNAME) $(LIBEXTRAS)"; $(LINK_SO)
-LINK_SO_DSO=	INHIBIT_SYMLINKS=yes; SHOBJECTS="$(LIBEXTRAS)"; $(LINK_SO)
-
-LINK_SO_SHLIB_VIA_O=	\
-  SHOBJECTS=$(STLIBNAME).o; \
-  ALL=$$ALLSYMSFLAGS; ALLSYMSFLAGS=; NOALLSYMSFLAGS=; \
-  ( $(ECHO) ld $(LDFLAGS) -r -o $$SHOBJECTS $$ALL $(STLIBNAME) $(LIBEXTRAS); \
-    ld $(LDFLAGS) -r -o $$SHOBJECTS $$ALL $(STLIBNAME) $(LIBEXTRAS) ); \
-  $(LINK_SO) && ( $(ECHO) rm -f $$SHOBJECTS; rm -f $$SHOBJECTS )
-
-LINK_SO_SHLIB_UNPACKED=	\
-  UNPACKDIR=link_tmp.$$$$; rm -rf $$UNPACKDIR; mkdir $$UNPACKDIR; \
-  (cd $$UNPACKDIR; ar x ../$(STLIBNAME)) && \
-  ([ -z "$(LIBEXTRAS)" ] || cp $(LIBEXTRAS) $$UNPACKDIR) && \
-  SHOBJECTS=$$UNPACKDIR/*.o; \
-  $(LINK_SO) && rm -rf $$UNPACKDIR
-
-DETECT_GNU_LD=($(CC) -Wl,-V /dev/null 2>&1 | grep '^GNU ld' )>/dev/null
-
-DO_GNU_SO_COMMON=\
-	SHAREDFLAGS="$(CFLAGS) $(SHARED_LDFLAGS) -shared -Wl,-Bsymbolic -Wl,-soname=$(SHLIBNAME_FULL)"
-DO_GNU_DSO=\
-	$(DO_GNU_SO_COMMON)
-DO_GNU_SO=\
-	ALLSYMSFLAGS='-Wl,--whole-archive'; \
-	NOALLSYMSFLAGS='-Wl,--no-whole-archive'; \
-	$(DO_GNU_SO_COMMON)
-DO_GNU_APP=LDFLAGS="$(CFLAGS) $(LDFLAGS)"
-
-#This is rather special.  It's a special target with which one can link
-#applications without bothering with any features that have anything to
-#do with shared libraries, for example when linking against static
-#libraries.  It's mostly here to avoid a lot of conditionals everywhere
-#else...
-link_app.:
-	$(LINK_APP)
-
-link_dso.gnu:
-	@ $(DO_GNU_DSO); $(LINK_SO_DSO)
-link_shlib.gnu:
-	@ $(DO_GNU_SO); $(LINK_SO_SHLIB)
-link_app.gnu:
-	@ $(DO_GNU_APP); $(LINK_APP)
-
-link_shlib.linux-shared:
-	@$(PERL) $(SRCDIR)/util/mkdef.pl $(LIBNAME) linux >$(LIBNAME).map; \
-	$(DO_GNU_SO); \
-	ALLSYMSFLAGS='-Wl,--whole-archive,--version-script=$(LIBNAME).map'; \
-	$(LINK_SO_SHLIB)
-
-link_dso.bsd:
-	@if $(DETECT_GNU_LD); then $(DO_GNU_DSO); else \
-	LIBDEPS=" "; \
-	ALLSYMSFLAGS=; \
-	NOALLSYMSFLAGS=; \
-	SHAREDFLAGS="$(CFLAGS) $(SHARED_LDFLAGS) -shared -nostdlib"; \
-	fi; $(LINK_SO_DSO)
-link_shlib.bsd:
-	@if $(DETECT_GNU_LD); then $(DO_GNU_SO); else \
-	LIBDEPS=" "; \
-	ALLSYMSFLAGS="-Wl,-Bforcearchive"; \
-	NOALLSYMSFLAGS=; \
-	SHAREDFLAGS="$(CFLAGS) $(SHARED_LDFLAGS) -shared -nostdlib"; \
-	fi; $(LINK_SO_SHLIB)
-link_app.bsd:
-	@if $(DETECT_GNU_LD); then $(DO_GNU_APP); else \
-	LDFLAGS="$(CFLAGS) $(LDFLAGS)"; \
-	fi; $(LINK_APP)
-
-# For Darwin AKA Mac OS/X (dyld)
-# Originally link_dso.darwin produced .so, because it was hard-coded
-# in dso_dlfcn module. At later point dso_dlfcn switched to .dylib
-# extension in order to allow for run-time linking with vendor-
-# supplied shared libraries such as libz, so that link_dso.darwin had
-# to be harmonized with it. This caused minor controversy, because
-# it was believed that dlopen can't be used to dynamically load
-# .dylib-s, only so called bundle modules (ones linked with -bundle
-# flag). The belief seems to be originating from pre-10.4 release,
-# where dlfcn functionality was emulated by dlcompat add-on. In
-# 10.4 dlopen was rewritten as native part of dyld and is documented
-# to be capable of loading both dynamic libraries and bundles. In
-# order to provide compatibility with pre-10.4 dlopen, modules are
-# linked with -bundle flag, which makes .dylib extension misleading.
-# It works, because dlopen is [and always was] extension-agnostic.
-# Alternative to this heuristic approach is to develop specific
-# MacOS X dso module relying on whichever "native" dyld interface.
-link_dso.darwin:
-	@ ALLSYMSFLAGS=''; \
-	NOALLSYMSFLAGS=''; \
-	SHAREDFLAGS="$(CFLAGS) `echo $(SHARED_LDFLAGS) | sed s/dynamiclib/bundle/`"; \
-	$(LINK_SO_DSO)
-link_shlib.darwin:
-	@ ALLSYMSFLAGS='-all_load'; \
-	NOALLSYMSFLAGS=''; \
-	SHAREDFLAGS="$(CFLAGS) $(SHARED_LDFLAGS) -current_version $(SHLIBVERSION) -compatibility_version $(SHLIBVERSION) -install_name $(INSTALLTOP)/$(LIBDIR)/$(SHLIBNAME_FULL)"; \
-	$(LINK_SO_SHLIB)
-link_app.darwin:	# is there run-path on darwin?
-	$(LINK_APP)
-
-link_dso.cygwin:
-	@ALLSYMSFLAGS=''; \
-	NOALLSYMSFLAGS=''; \
-	base=-Wl,--enable-auto-image-base; \
-	SHAREDFLAGS="$(CFLAGS) $(SHARED_LDFLAGS) -shared $$base -Wl,-Bsymbolic"; \
-	$(LINK_SO_DSO)
-link_shlib.cygwin:
-	@ INHIBIT_SYMLINKS=yes; \
-	$(ECHO) "$(PERL) $(SRCDIR)/util/mkrc.pl $(SHLIBNAME_FULL) |" \
-		     "$(RC) $(SHARED_RCFLAGS) -o rc.o"; \
-	$(PERL) $(SRCDIR)/util/mkrc.pl $(SHLIBNAME_FULL) | \
-		$(RC) $(SHARED_RCFLAGS) -o rc.o; \
-	ALLSYMSFLAGS='-Wl,--whole-archive'; \
-	NOALLSYMSFLAGS='-Wl,--no-whole-archive'; \
-	SHAREDFLAGS="$(CFLAGS) $(SHARED_LDFLAGS) -shared -Wl,--enable-auto-image-base -Wl,-Bsymbolic -Wl,--out-implib,$(SHLIBNAME) rc.o"; \
-	$(LINK_SO_SHLIB) || exit 1; \
-	rm rc.o
-link_app.cygwin:
-	$(LINK_APP)
-
-# link_dso.mingw-shared and link_app.mingw-shared are mapped to the
-# corresponding cygwin targets, as they do the exact same thing.
-link_shlib.mingw:
-	@ INHIBIT_SYMLINKS=yes; \
-	$(PERL) $(SRCDIR)/util/mkdef.pl 32 $(LIBNAME) \
-		| sed -e 's|^\(LIBRARY  *\)$(LIBNAME)32|\1$(SHLIBNAME_FULL)|' \
-		> $(LIBNAME).def; \
-	echo "$(PERL) $(SRCDIR)/util/mkrc.pl $(SHLIBNAME_FULL) |" \
-		"$(RC) $(SHARED_RCFLAGS) -o rc.o"; \
-	$(PERL) $(SRCDIR)/util/mkrc.pl $(SHLIBNAME_FULL) | \
-		$(RC) $(SHARED_RCFLAGS) -o rc.o; \
-	ALLSYMSFLAGS='-Wl,--whole-archive'; \
-	NOALLSYMSFLAGS='-Wl,--no-whole-archive'; \
-	SHAREDFLAGS="$(CFLAGS) $(SHARED_LDFLAGS) -shared -Wl,-Bsymbolic -Wl,--out-implib,$(SHLIBNAME) $(LIBNAME).def rc.o"; \
-	$(LINK_SO_SHLIB) || exit 1; \
-	rm $(LIBNAME).def rc.o
-
-link_dso.alpha-osf1:
-	@ if $(DETECT_GNU_LD); then \
-		$(DO_GNU_DSO); \
-	else \
-		ALLSYMSFLAGS=''; \
-		NOALLSYMSFLAGS=''; \
-		SHAREDFLAGS="$(CFLAGS) $(SHARED_LDFLAGS) -shared -Wl,-B,symbolic"; \
-	fi; \
-	$(LINK_SO_DSO)
-link_shlib.alpha-osf1:
-	@ if $(DETECT_GNU_LD); then \
-		$(DO_GNU_SO); \
-	else \
-		ALLSYMSFLAGS='-all'; \
-		NOALLSYMSFLAGS='-none'; \
-		SHAREDFLAGS="$(CFLAGS) $(SHARED_LDFLAGS) -shared -Wl,-B,symbolic -set_version $(SHLIBVERSION)"; \
-	fi; \
-	$(LINK_SO_SHLIB)
-link_app.alpha-osf1:
-	@if $(DETECT_GNU_LD); then \
-		$(DO_GNU_APP); \
-	else \
-		LDFLAGS="$(CFLAGS) $(LDFLAGS)"; \
-	fi; \
-	$(LINK_APP)
-
-link_dso.solaris:
-	@ if $(DETECT_GNU_LD); then \
-		$(DO_GNU_DSO); \
-	else \
-		ALLSYMSFLAGS=""; \
-		NOALLSYMSFLAGS=""; \
-		SHAREDFLAGS="$(CFLAGS) $(SHARED_LDFLAGS) -h $(SHLIBNAME_FULL) -Wl,-Bsymbolic"; \
-	fi; \
-	$(LINK_SO_DSO)
-link_shlib.solaris:
-	@ if $(DETECT_GNU_LD); then \
-		$(DO_GNU_SO); \
-	else \
-		$(PERL) $(SRCDIR)/util/mkdef.pl $(LIBNAME) linux >$(LIBNAME).map; \
-		ALLSYMSFLAGS="-Wl,-z,allextract,-M,$(LIBNAME).map"; \
-		NOALLSYMSFLAGS="-Wl,-z,defaultextract"; \
-		SHAREDFLAGS="$(CFLAGS) $(SHARED_LDFLAGS) -h $(SHLIBNAME_FULL) -Wl,-Bsymbolic"; \
-	fi; \
-	$(LINK_SO_SHLIB)
-link_app.solaris:
-	@ if $(DETECT_GNU_LD); then \
-		$(DO_GNU_APP); \
-	else \
-		LDFLAGS="$(CFLAGS) $(LDFLAGS)"; \
-	fi; \
-	$(LINK_APP)
-
-# OpenServer 5 native compilers used
-link_dso.svr3:
-	@ if $(DETECT_GNU_LD); then \
-		$(DO_GNU_DSO); \
-	else \
-		ALLSYMSFLAGS=''; \
-		NOALLSYMSFLAGS=''; \
-		SHAREDFLAGS="$(CFLAGS) -G -h $(SHLIBNAME_FULL)"; \
-	fi; \
-	$(LINK_SO_DSO)
-link_shlib.svr3:
-	@ if $(DETECT_GNU_LD); then \
-		$(DO_GNU_SO); \
-	else \
-		ALLSYMSFLAGS=''; \
-		NOALLSYMSFLAGS=''; \
-		SHAREDFLAGS="$(CFLAGS) -G -h $(SHLIBNAME_FULL)"; \
-	fi; \
-	$(LINK_SO_SHLIB_UNPACKED)
-link_app.svr3:
-	@$(DETECT_GNU_LD) && $(DO_GNU_APP); \
-	$(LINK_APP)
-
-# UnixWare 7 and OpenUNIX 8 native compilers used
-link_dso.svr5:
-	@ if $(DETECT_GNU_LD); then \
-		$(DO_GNU_DSO); \
-	else \
-		SHARE_FLAG='-G'; \
-		($(CC) -v 2>&1 | grep gcc) > /dev/null && SHARE_FLAG='-shared'; \
-		ALLSYMSFLAGS=''; \
-		NOALLSYMSFLAGS=''; \
-		SHAREDFLAGS="$(CFLAGS) $${SHARE_FLAG} -h $(SHLIBNAME_FULL)"; \
-	fi; \
-	$(LINK_SO_DSO)
-link_shlib.svr5:
-	@ if $(DETECT_GNU_LD); then \
-		$(DO_GNU_SO); \
-	else \
-		SHARE_FLAG='-G'; \
-		($(CC) -v 2>&1 | grep gcc) > /dev/null && SHARE_FLAG='-shared'; \
-		ALLSYMSFLAGS=''; \
-		NOALLSYMSFLAGS=''; \
-		SHAREDFLAGS="$(CFLAGS) $${SHARE_FLAG} -h $(SHLIBNAME_FULL)"; \
-	fi; \
-	$(LINK_SO_SHLIB_UNPACKED)
-link_app.svr5:
-	@$(DETECT_GNU_LD) && $(DO_GNU_APP); \
-	$(LINK_APP)
-
-link_dso.irix:
-	@ if $(DETECT_GNU_LD); then \
-		$(DO_GNU_DSO); \
-	else \
-		ALLSYMSFLAGS=""; \
-		NOALLSYMSFLAGS=""; \
-		SHAREDFLAGS="$(CFLAGS) $(SHARED_LDFLAGS) -shared -Wl,-soname,$(SHLIBNAME_FULL),-B,symbolic"; \
-	fi; \
-	$(LINK_SO_DSO)
-link_shlib.irix:
-	@ if $(DETECT_GNU_LD); then \
-		$(DO_GNU_SO); \
-	else \
-		MINUSWL=""; \
-		($(CC) -v 2>&1 | grep gcc) > /dev/null && MINUSWL="-Wl,"; \
-		ALLSYMSFLAGS="$${MINUSWL}-all"; \
-		NOALLSYMSFLAGS="$${MINUSWL}-none"; \
-		SHAREDFLAGS="$(CFLAGS) $(SHARED_LDFLAGS) -shared -Wl,-soname,$(SHLIBNAME_FULL),-B,symbolic"; \
-	fi; \
-	$(LINK_SO_SHLIB)
-link_app.irix:
-	@LDFLAGS="$(CFLAGS) $(LDFLAGS)"; \
-	$(LINK_APP)
-
-# 32-bit PA-RISC HP-UX embeds the -L pathname of libs we link with, so
-# we compensate for it with +cdp ../: and +cdp ./:. Yes, these rewrite
-# rules imply that we can only link one level down in catalog structure,
-# but that's what takes place for the moment of this writing. +cdp option
-# was introduced in HP-UX 11.x and applies in 32-bit PA-RISC link
-# editor context only [it's simply ignored in other cases, which are all
-# ELFs by the way].
-#
-link_dso.hpux:
-	@if $(DETECT_GNU_LD); then $(DO_GNU_DSO); else \
-	ALLSYMSFLAGS=''; \
-	NOALLSYMSFLAGS=''; \
-	expr $(PLATFORM) : 'hpux64' > /dev/null && ALLSYMSFLAGS='-Wl,+forceload'; \
-	SHAREDFLAGS="$(CFLAGS) $(SHARED_LDFLAGS) -Wl,-B,symbolic,+vnocompatwarnings,-z,+s,+h,$(SHLIBNAME_FULL),+cdp,../:,+cdp,./:"; \
-	fi; \
-	rm -f $(SHLIBNAME_FULL) || :; \
-	$(LINK_SO_DSO) && chmod a=rx $(SHLIBNAME_FULL)
-link_shlib.hpux:
-	@if $(DETECT_GNU_LD); then $(DO_GNU_SO); else \
-	ALLSYMSFLAGS='-Wl,-Fl'; \
-	NOALLSYMSFLAGS=''; \
-	expr $(PLATFORM) : 'hpux64' > /dev/null && ALLSYMSFLAGS='-Wl,+forceload'; \
-	SHAREDFLAGS="$(CFLAGS) $(SHARED_LDFLAGS) -Wl,-B,symbolic,+vnocompatwarnings,-z,+s,+h,$(SHLIBNAME_FULL),+cdp,../:,+cdp,./:"; \
-	fi; \
-	rm -f $(SHLIBNAME_FULL) || :; \
-	$(LINK_SO_SHLIB) && chmod a=rx $(SHLIBNAME_FULL)
-link_app.hpux:
-	@if $(DETECT_GNU_LD); then $(DO_GNU_APP); else \
-	LDFLAGS="$(CFLAGS) $(LDFLAGS) -Wl,+s,+cdp,../:,+cdp,./:"; \
-	fi; \
-	$(LINK_APP)
-
-link_dso.aix:
-	@OBJECT_MODE=`expr "x$(SHARED_LDFLAGS)" : 'x\-[a-z]*\(64\)'` || :; \
-	OBJECT_MODE=$${OBJECT_MODE:-32}; export OBJECT_MODE; \
-	ALLSYMSFLAGS=''; \
-	NOALLSYMSFLAGS=''; \
-	SHAREDFLAGS='$(CFLAGS) $(SHARED_LDFLAGS) -Wl,-bexpall,-bnolibpath,-bM:SRE'; \
-	rm -f $(SHLIBNAME_FULL) 2>&1 > /dev/null ; \
-	$(LINK_SO_DSO);
-link_shlib.aix:
-	@ OBJECT_MODE=`expr "x$(SHARED_LDFLAGS)" : 'x\-[a-z]*\(64\)'` || : ; \
-	OBJECT_MODE=$${OBJECT_MODE:-32}; export OBJECT_MODE; \
-	ALLSYMSFLAGS='-bnogc'; \
-	NOALLSYMSFLAGS=''; \
-	SHAREDFLAGS='$(CFLAGS) $(SHARED_LDFLAGS) -Wl,-bexpall,-bnolibpath,-bM:SRE'; \
-	rm -f $(SHLIBNAME_FULL) 2>&1 > /dev/null ; \
-	$(LINK_SO_SHLIB_VIA_O)
-link_app.aix:
-	LDFLAGS="$(CFLAGS) -Wl,-bsvr4 $(LDFLAGS)"; \
-	$(LINK_APP)
-
-
-# Targets to build symbolic links when needed
-symlink.gnu symlink.solaris symlink.svr3 symlink.svr5 symlink.irix \
-symlink.aix:
-	@ $(SYMLINK_SO)
-symlink.darwin:
-	@ $(SYMLINK_SO)
-symlink.hpux:
-	@ $(SYMLINK_SO)
-# The following lines means those specific architectures do no symlinks
-symlink.cygwin symlink.alpha-osf1 symlink.tru64 symlink.tru64-rpath:
-
-# Compatibility targets
-link_dso.bsd-gcc-shared link_dso.linux-shared link_dso.gnu-shared: link_dso.gnu
-link_shlib.bsd-gcc-shared: link_shlib.linux-shared
-link_shlib.gnu-shared: link_shlib.gnu
-link_app.bsd-gcc-shared link_app.linux-shared link_app.gnu-shared: link_app.gnu
-symlink.bsd-gcc-shared symlink.bsd-shared symlink.linux-shared symlink.gnu-shared: symlink.gnu
-link_dso.bsd-shared: link_dso.bsd
-link_shlib.bsd-shared: link_shlib.bsd
-link_app.bsd-shared: link_app.bsd
-link_dso.darwin-shared: link_dso.darwin
-link_shlib.darwin-shared: link_shlib.darwin
-link_app.darwin-shared: link_app.darwin
-symlink.darwin-shared: symlink.darwin
-link_dso.cygwin-shared: link_dso.cygwin
-link_shlib.cygwin-shared: link_shlib.cygwin
-link_app.cygwin-shared: link_app.cygwin
-symlink.cygwin-shared: symlink.cygwin
-link_dso.mingw-shared: link_dso.cygwin
-link_shlib.mingw-shared: link_shlib.mingw
-link_app.mingw-shared: link_app.cygwin
-symlink.mingw-shared: symlink.cygwin
-link_dso.alpha-osf1-shared: link_dso.alpha-osf1
-link_shlib.alpha-osf1-shared: link_shlib.alpha-osf1
-link_app.alpha-osf1-shared: link_app.alpha-osf1
-symlink.alpha-osf1-shared: symlink.alpha-osf1
-link_dso.tru64-shared: link_dso.tru64
-link_shlib.tru64-shared: link_shlib.tru64
-link_app.tru64-shared: link_app.tru64
-symlink.tru64-shared: symlink.tru64
-link_dso.tru64-shared-rpath: link_dso.tru64-rpath
-link_shlib.tru64-shared-rpath: link_shlib.tru64-rpath
-link_app.tru64-shared-rpath: link_app.tru64-rpath
-symlink.tru64-shared-rpath: symlink.tru64-rpath
-link_dso.solaris-shared: link_dso.solaris
-link_shlib.solaris-shared: link_shlib.solaris
-link_app.solaris-shared: link_app.solaris
-symlink.solaris-shared: symlink.solaris
-link_dso.svr3-shared: link_dso.svr3
-link_shlib.svr3-shared: link_shlib.svr3
-link_app.svr3-shared: link_app.svr3
-symlink.svr3-shared: symlink.svr3
-link_dso.svr5-shared: link_dso.svr5
-link_shlib.svr5-shared: link_shlib.svr5
-link_app.svr5-shared: link_app.svr5
-symlink.svr5-shared: symlink.svr5
-link_dso.irix-shared: link_dso.irix
-link_shlib.irix-shared: link_shlib.irix
-link_app.irix-shared: link_app.irix
-symlink.irix-shared: symlink.irix
-link_dso.hpux-shared: link_dso.hpux
-link_shlib.hpux-shared: link_shlib.hpux
-link_app.hpux-shared: link_app.hpux
-symlink.hpux-shared: symlink.hpux
-link_dso.aix-shared: link_dso.aix
-link_shlib.aix-shared: link_shlib.aix
-link_app.aix-shared: link_app.aix
-symlink.aix-shared: symlink.aix
diff --git a/build.info b/build.info
index d00673f..fdf1d10 100644
--- a/build.info
+++ b/build.info
@@ -9,8 +9,6 @@
      "";
 -}
 LIBS=libcrypto libssl
-ORDINALS[libcrypto]=crypto
-ORDINALS[libssl]=ssl
 INCLUDE[libcrypto]=. crypto/include include
 INCLUDE[libssl]=. include
 DEPEND[libssl]=libcrypto
@@ -26,6 +24,52 @@ GENERATE[crypto/include/internal/bn_conf.h]=crypto/include/internal/bn_conf.h.in
 DEPEND[crypto/include/internal/dso_conf.h]=configdata.pm
 GENERATE[crypto/include/internal/dso_conf.h]=crypto/include/internal/dso_conf.h.in
 
+IF[{- defined $target{shared_defflag} -}]
+  IF[{- $config{target} =~ /^mingw/ -}]
+    GENERATE[libcrypto.def]=util/mkdef.pl crypto 32
+    DEPEND[libcrypto.def]=util/libcrypto.num
+    GENERATE[libssl.def]=util/mkdef.pl ssl 32
+    DEPEND[libssl.def]=util/libssl.num
+
+    SHARED_SOURCE[libcrypto]=libcrypto.def
+    SHARED_SOURCE[libssl]=libssl.def
+  ELSE
+    GENERATE[libcrypto.map]=util/mkdef.pl crypto linux
+    DEPEND[libcrypto.map]=util/libcrypto.num
+    GENERATE[libssl.map]=util/mkdef.pl ssl linux
+    DEPEND[libssl.map]=util/libssl.num
+
+    SHARED_SOURCE[libcrypto]=libcrypto.map
+    SHARED_SOURCE[libssl]=libssl.map
+  ENDIF
+ENDIF
+# VMS and VC don't have parametrised .def / .symvec generation, so they get
+# special treatment, since we know they do use these files
+IF[{- $config{target} =~ /^VC-/ -}]
+  GENERATE[libcrypto.def]=util/mkdef.pl crypto 32
+  DEPEND[libcrypto.def]=util/libcrypto.num
+  GENERATE[libssl.def]=util/mkdef.pl ssl 32
+  DEPEND[libssl.def]=util/libssl.num
+
+  SHARED_SOURCE[libcrypto]=libcrypto.def
+  SHARED_SOURCE[libssl]=libssl.def
+ELSIF[{- $config{target} =~ /^vms/ -}]
+  GENERATE[libcrypto.opt]=util/mkdef.pl crypto 32
+  DEPEND[libcrypto.opt]=util/libcrypto.num
+  GENERATE[libssl.opt]=util/mkdef.pl ssl 32
+  DEPEND[libssl.opt]=util/libssl.num
+
+  SHARED_SOURCE[libcrypto]=libcrypto.opt
+  SHARED_SOURCE[libssl]=libssl.opt
+ENDIF
+
+IF[{- $config{target} =~ /^(?:Cygwin|mingw|VC-)/ -}]
+  GENERATE[libcrypto.rc]=util/mkrc.pl libcrypto
+  GENERATE[libssl.rc]=util/mkrc.pl libssl
+
+  SHARED_SOURCE[libcrypto]=libcrypto.rc
+  SHARED_SOURCE[libssl]=libssl.rc
+ENDIF
 
 IF[{- $config{target} =~ /^Cygwin/ -}]
  SHARED_NAME[libcrypto]=cygcrypto-{- $sover_filename -}
diff --git a/util/mkdef.pl b/util/mkdef.pl
index 1e0da1c..828ddc0 100755
--- a/util/mkdef.pl
+++ b/util/mkdef.pl
@@ -228,16 +228,9 @@ foreach (@ARGV, split(/ /, $config{options}))
 		$zlib = 1;
 	}
 
-	$do_ssl=1 if $_ eq "libssl";
-	if ($_ eq "ssl") {
-		$do_ssl=1;
-		$libname=$_
-	}
-	$do_crypto=1 if $_ eq "libcrypto";
-	if ($_ eq "crypto") {
-		$do_crypto=1;
-		$libname=$_;
-	}
+	$do_crypto=1 if $_ eq "libcrypto" || $_ eq "crypto";
+	$do_ssl=1 if $_ eq "libssl" || $_ eq "ssl";
+
 	$do_update=1 if $_ eq "update";
 	$do_rewrite=1 if $_ eq "rewrite";
 	$do_ctest=1 if $_ eq "ctest";
@@ -252,6 +245,8 @@ foreach (@ARGV, split(/ /, $config{options}))
 	}
 
 	}
+$libname = $unified_info{sharednames}->{libcrypto} if $do_crypto;
+$libname = $unified_info{sharednames}->{libssl} if $do_ssl;
 
 if (!$libname) {
 	if ($do_ssl) {
@@ -1210,9 +1205,6 @@ sub print_def_file
         my $prevnum = 0;
         my $symvtextcount = 0;
 
-	if ($W32)
-		{ $libname.="32"; }
-
         if ($W32)
                 {
                 print OUT <<"EOF";
@@ -1229,6 +1221,7 @@ EOF
         elsif ($VMS)
                 {
                 print OUT <<"EOF";
+IDENTIFICATION=$version
 CASE_SENSITIVE=YES
 SYMBOL_VECTOR=(-
 EOF


More information about the openssl-commits mailing list