'Modifying OpenSSL Version 1.1.1g makefile to prefix DLLS with Custom Nomenclature

I am trying to build and install OpenSSL 1.1.1g using ZLIB 1.2.11 according to the following steps:

$ perl Configure { VC-WIN32 }
        $ nmake
        $ nmake test
        $ nmake install

In the past (using Openssl 1.0.2g) I had always prefixed all the DLLS with the NTCSS prefix. i.e. NTCSS_zlib1.dll, NTCSS_LIBEAY32.dll, NTCSS_SSLEAY32.dll. Now that OpenSSL 1.1.1g uses libcrypto-1_1.dll and libssl-1_1.dll for the OpenSSL DLL names and I want to add our "NTCSS" prefix to these OpenSSL DLL names. After I untar the OpenSSL source, I generate the make files by calling the "Configure" command from my batch file i.e.

call C:\Strawberry\perl\bin\perl.exe Configure VC-WIN32 zlib-dynamic ^
--with-zlib-include=%ZLIB_INCLUDE_DIR% ^
--prefix=%OPENSSL_INSTALL_DIR% ^
--openssldir=%OPENSSL_INSTALL_DIR%

Before with openssl-1.0.2g I patched the openssl-1.0.2g/ms/libeay32.def, the openssl-1.0.2g/ms/ssleay32.def files and the openssl-1.0.2g/ms/ntdll.mak files making these changes to the openssl-1.0.2g/ms/ntdll.mak i.e.

-SSL=ssleay32
-CRYPTO=libeay32
+SSL=NTCSS_SSLEAY32
+CRYPTO=NTCSS_LIBEAY32

and these changes to the openssl-1.0.2g/ms/libeay32.def file

-LIBRARY         LIBEAY32   
+LIBRARY         NTCSS_LIBEAY32

and these changes to the openssl-1.0.2g/ms/libeay32.def

-LIBRARY         SSLEAY32   
+LIBRARY         NTCSS_SSLEAY32 

Question (1) How do I patch OpenSSL 1.1.1g's makefile to achieve the same result? I don't see an option documented in the "Configure" help or when I run the configdata.pm dump so I need help to determine how to Patch the makefile to achieve this change. Also, I am trying to set /DYNAMICBASE (Use address space layout randomization) to "NO" using the "Configure" command without Success i.e.

call C:\Strawberry\perl\bin\perl.exe Configure VC-WIN32 -L"/DYNAMICBASE:NO /MT" zlib-dynamic ^
--with-zlib-include=%ZLIB_INCLUDE_DIR% ^
--prefix=%OPENSSL_INSTALL_DIR% ^
--openssldir=%OPENSSL_INSTALL_DIR%

Before with openssl-1.0.2g I patched the openssl-1.0.2g/ms/ntdll.mak file making these changes i.e.

-LFLAGS=/nologo /subsystem:console /opt:ref /debug
+LFLAGS=/nologo /subsystem:console /opt:ref /debug /DYNAMICBASE:NO

and

-MLFLAGS= /nologo /subsystem:console /opt:ref /debug /dll
+MLFLAGS= /nologo /subsystem:console /opt:ref /debug /dll /DYNAMICBASE:NO

Question (2) How do I pass this -L"/DYNAMICBASE:NO and MT options via the "Configure" command?

call C:\Strawberry\perl\bin\perl.exe Configure VC-WIN32 -L"/DYNAMICBASE:NO /MT" zlib-dynamic ^
--with-zlib-include=%ZLIB_INCLUDE_DIR% ^
--prefix=%OPENSSL_INSTALL_DIR% ^
--openssldir=%OPENSSL_INSTALL_DIR%

Passing these options gives me the following warnings when I run nmake:

LINK : warning LNK4044: unrecognized option '/L/DYNAMICBASE:NO'; ignored
LINK : warning LNK4044: unrecognized option '/MT'; ignored


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source