build: Add ms rc file to put extra metatdata on dll

Change-Id: Idf687c6b2f8d1dea203f01bf57c5158d19ed519e
Signed-off-by: Ranjit Menon <ranjit.menon@intel.com>
Signed-off-by: Greg Tucker <greg.b.tucker@intel.com>
This commit is contained in:
Greg Tucker 2021-09-02 18:27:51 -07:00
parent 908726e255
commit 066940a9a7
3 changed files with 102 additions and 0 deletions

View File

@ -185,11 +185,20 @@ isa-l_static.lib: $(objs)
$? $?
<< <<
!IF [rc] == 0
isa-l.dll: isa-l.res
!ELSE
!MESSAGE Optionally install rc to set file version info
!ENDIF
isa-l.dll: $(objs) isa-l.dll: $(objs)
link -out:$@ -dll -def:isa-l.def $(LINKFLAGS) @<< link -out:$@ -dll -def:isa-l.def $(LINKFLAGS) @<<
$? $?
<< <<
isa-l.res: isa-l.h
rc /fo $@ isa-l.rc
{erasure_code}.c.obj: {erasure_code}.c.obj:
$(CC) $(CFLAGS) /c -Fo$@ $? $(CC) $(CFLAGS) /c -Fo$@ $?
{erasure_code}.asm.obj: {erasure_code}.asm.obj:
@ -321,6 +330,7 @@ isa-l.h:
@echo #define ISAL_MAKE_VERSION(maj, min, patch) ((maj) * 0x10000 + (min) * 0x100 + (patch))>> $@ @echo #define ISAL_MAKE_VERSION(maj, min, patch) ((maj) * 0x10000 + (min) * 0x100 + (patch))>> $@
@echo #define ISAL_VERSION ISAL_MAKE_VERSION(ISAL_MAJOR_VERSION, ISAL_MINOR_VERSION, ISAL_PATCH_VERSION)>> $@ @echo #define ISAL_VERSION ISAL_MAKE_VERSION(ISAL_MAJOR_VERSION, ISAL_MINOR_VERSION, ISAL_PATCH_VERSION)>> $@
@echo.>> $@ @echo.>> $@
@echo #ifndef RC_INVOKED>> $@
@echo #include ^<isa-l/crc.h^>>> $@ @echo #include ^<isa-l/crc.h^>>> $@
@echo #include ^<isa-l/crc64.h^>>> $@ @echo #include ^<isa-l/crc64.h^>>> $@
@echo #include ^<isa-l/erasure_code.h^>>> $@ @echo #include ^<isa-l/erasure_code.h^>>> $@
@ -328,6 +338,7 @@ isa-l.h:
@echo #include ^<isa-l/igzip_lib.h^>>> $@ @echo #include ^<isa-l/igzip_lib.h^>>> $@
@echo #include ^<isa-l/mem_routines.h^>>> $@ @echo #include ^<isa-l/mem_routines.h^>>> $@
@echo #include ^<isa-l/raid.h^>>> $@ @echo #include ^<isa-l/raid.h^>>> $@
@echo #endif // RC_INVOKED>> $@
@echo #endif //_ISAL_H_>> $@ @echo #endif //_ISAL_H_>> $@
clean: clean:
@ -339,6 +350,7 @@ clean:
-if exist isa-l.lib del isa-l.lib -if exist isa-l.lib del isa-l.lib
-if exist isa-l.dll del isa-l.dll -if exist isa-l.dll del isa-l.dll
-if exist isa-l.exp del isa-l.exp -if exist isa-l.exp del isa-l.exp
-if exist isa-l.res del isa-l.res
zlib.lib: zlib.lib:
igzip_perf.exe: zlib.lib igzip_perf.exe: zlib.lib

78
isa-l.rc Normal file
View File

@ -0,0 +1,78 @@
/**********************************************************************
Copyright(c) 2021 Intel Corporation All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in
the documentation and/or other materials provided with the
distribution.
* Neither the name of Intel Corporation nor the names of its
contributors may be used to endorse or promote products derived
from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
**********************************************************************/
#include <windows.h>
#include "isa-l.h"
#define _MAKE_VER_STRING(major, minor, patch, buildnum) \
#major "." \
#minor "." \
#patch "." \
#buildnum
#define MAKE_VER_STRING(major, minor, patch, buildnum) _MAKE_VER_STRING(major, minor, patch, buildnum)
#define VER_FILEVERSION ISAL_MAJOR_VERSION,ISAL_MINOR_VERSION,ISAL_PATCH_VERSION,0
#define VER_FILEVERSION_STR MAKE_VER_STRING(ISAL_MAJOR_VERSION, ISAL_MINOR_VERSION, ISAL_PATCH_VERSION, 0)
#define VER_PRODUCTVERSION VER_FILEVERSION
#define VER_PRODUCTVERSION_STR VER_FILEVERSION_STR
#define VER_COMPANYNAME_STR "Intel Corporation"
#define VER_FILEDESCRIPTION_STR "Intel(R) Intelligent Storage Acceleration Library"
#define VER_INTERNALNAME_STR "Intel(R) Intelligent Storage Acceleration Library"
#define VER_LEGALCOPYRIGHT_STR "Copyright (C) Intel Corporation 2021"
#define VER_LEGALTRADEMARKS1_STR "All Rights Reserved"
#define VER_ORIGINALFILENAME_STR "isa-l.dll"
#define VER_PRODUCTNAME_STR VER_FILEDESCRIPTION_STR
VS_VERSION_INFO VERSIONINFO
FILEVERSION VER_FILEVERSION
PRODUCTVERSION VER_PRODUCTVERSION
BEGIN
BLOCK "StringFileInfo"
BEGIN
BLOCK "040904B0"
BEGIN
VALUE "CompanyName", VER_COMPANYNAME_STR
VALUE "FileDescription", VER_FILEDESCRIPTION_STR
VALUE "FileVersion", VER_FILEVERSION_STR
VALUE "InternalName", VER_INTERNALNAME_STR
VALUE "LegalCopyright", VER_LEGALCOPYRIGHT_STR
VALUE "LegalTrademarks1", VER_LEGALTRADEMARKS1_STR
VALUE "OriginalFilename", VER_ORIGINALFILENAME_STR
VALUE "ProductName", VER_PRODUCTNAME_STR
VALUE "ProductVersion", VER_PRODUCTVERSION_STR
END
END
BLOCK "VarFileInfo"
BEGIN
VALUE "Translation", 0x409, 0x04B0
END
END

View File

@ -41,11 +41,20 @@ Makefile.nmake tst.nmake: FORCE
@echo '$$?' >> $@ @echo '$$?' >> $@
@echo '<<' >> $@ @echo '<<' >> $@
@echo '' >> $@ @echo '' >> $@
@echo '!IF [rc] == 0' >> $@
@echo 'isa-l.dll: isa-l.res' >> $@
@echo '!ELSE' >> $@
@echo '!MESSAGE Optionally install rc to set file version info' >> $@
@echo '!ENDIF' >> $@
@echo '' >> $@
@echo 'isa-l.dll: $$(objs)' >> $@ @echo 'isa-l.dll: $$(objs)' >> $@
@echo ' link -out:$$@ -dll -def:isa-l.def $$(LINKFLAGS) @<<' >> $@ @echo ' link -out:$$@ -dll -def:isa-l.def $$(LINKFLAGS) @<<' >> $@
@echo '$$?' >> $@ @echo '$$?' >> $@
@echo '<<' >> $@ @echo '<<' >> $@
@echo '' >> $@ @echo '' >> $@
@echo 'isa-l.res: isa-l.h' >> $@
@echo ' rc /fo $$@ isa-l.rc' >> $@
@echo '' >> $@
@$(foreach b, $(units), \ @$(foreach b, $(units), \
printf "{%s}.c.obj:\n\t\$$(CC) \$$(CFLAGS) /c -Fo\$$@ \$$?\n{%s}.asm.obj:\n\t\$$(AS) \$$(AFLAGS) -o \$$@ \$$?\n\n" $(b) $(b) >> $@; ) printf "{%s}.c.obj:\n\t\$$(CC) \$$(CFLAGS) /c -Fo\$$@ \$$?\n{%s}.asm.obj:\n\t\$$(AS) \$$(AFLAGS) -o \$$@ \$$?\n\n" $(b) $(b) >> $@; )
@echo '' >> $@ @echo '' >> $@
@ -114,7 +123,9 @@ endif
@echo ' @echo #define ISAL_MAKE_VERSION(maj, min, patch) ((maj) * 0x10000 + (min) * 0x100 + (patch))>> $$@' >> $@ @echo ' @echo #define ISAL_MAKE_VERSION(maj, min, patch) ((maj) * 0x10000 + (min) * 0x100 + (patch))>> $$@' >> $@
@echo ' @echo #define ISAL_VERSION ISAL_MAKE_VERSION(ISAL_MAJOR_VERSION, ISAL_MINOR_VERSION, ISAL_PATCH_VERSION)>> $$@' >> $@ @echo ' @echo #define ISAL_VERSION ISAL_MAKE_VERSION(ISAL_MAJOR_VERSION, ISAL_MINOR_VERSION, ISAL_PATCH_VERSION)>> $$@' >> $@
@echo ' @echo.>> $$@' >> $@ @echo ' @echo.>> $$@' >> $@
@echo ' @echo #ifndef RC_INVOKED>> $$@' >> $@
@for unit in $(sort $(extern_hdrs)); do echo " @echo #include ^<isa-l/$$unit^>>> \$$@" | sed -e 's;include/;;' >> $@; done @for unit in $(sort $(extern_hdrs)); do echo " @echo #include ^<isa-l/$$unit^>>> \$$@" | sed -e 's;include/;;' >> $@; done
@echo ' @echo #endif // RC_INVOKED>> $$@' >> $@
@echo ' @echo #endif //_ISAL_H_>> $$@' >> $@ @echo ' @echo #endif //_ISAL_H_>> $$@' >> $@
@echo '' >> $@ @echo '' >> $@
@echo 'clean:' >> $@ @echo 'clean:' >> $@
@ -126,6 +137,7 @@ endif
@echo ' -if exist isa-l.lib del isa-l.lib' >> $@ @echo ' -if exist isa-l.lib del isa-l.lib' >> $@
@echo ' -if exist isa-l.dll del isa-l.dll' >> $@ @echo ' -if exist isa-l.dll del isa-l.dll' >> $@
@echo ' -if exist isa-l.exp del isa-l.exp' >> $@ @echo ' -if exist isa-l.exp del isa-l.exp' >> $@
@echo ' -if exist isa-l.res del isa-l.res' >> $@
@echo '' >> $@ @echo '' >> $@
$(if $(findstring igzip,$(units)),@echo 'zlib.lib:' >> $@ ) $(if $(findstring igzip,$(units)),@echo 'zlib.lib:' >> $@ )
@cat $(foreach unit,$(units), $(unit)/Makefile.am) | sed \ @cat $(foreach unit,$(units), $(unit)/Makefile.am) | sed \