From 5e586843ebcc072c638894b3c099ec617a852fe1 Mon Sep 17 00:00:00 2001 From: Greg Tucker Date: Mon, 30 Mar 2020 15:41:31 -0700 Subject: [PATCH] build: Change ms nmake default to nasm and add pdb gen The nmake default is changed for a modern nasm. Older nasm and yasm versions will still work with windows but the nmake options must be changed appropriately for max AS_FEATURE_LEVEL to match. Also now generates debug symbol pdb files. Change-Id: I94a2dd7ecf541c6564ccbd4a184c33995d7b31ad Signed-off-by: Poornima Kumar Signed-off-by: Greg Tucker --- Makefile.nmake | 21 ++++++++++++++------- tools/gen_nmake.mk | 21 ++++++++++++++------- 2 files changed, 28 insertions(+), 14 deletions(-) diff --git a/Makefile.nmake b/Makefile.nmake index 8ae4223..660722a 100644 --- a/Makefile.nmake +++ b/Makefile.nmake @@ -161,12 +161,17 @@ objs = \ bin\mem_zero_detect_sse.obj \ bin\mem_multibinary.obj -INCLUDES = -I./ -Ierasure_code/ -Iraid/ -Icrc/ -Iigzip/ -Iprograms/ -Imem/ -Iinclude/ -Itests/fuzz/ -Iexamples/ec/ -LINKFLAGS = /nologo -CFLAGS = -O2 -D NDEBUG /nologo -D_USE_MATH_DEFINES -Qstd=c99 $(INCLUDES) $(D) -AFLAGS = -f win64 $(INCLUDES) $(D) -CC = icl -AS = yasm +INCLUDES = -I./ -Ierasure_code/ -Iraid/ -Icrc/ -Iigzip/ -Iprograms/ -Imem/ -Iinclude/ -Itests/fuzz/ -Iexamples/ec/ +# Modern asm feature level, consider upgrading nasm/yasm before decreasing feature_level +FEAT_FLAGS = -DHAVE_AS_KNOWS_AVX512 -DAS_FEATURE_LEVEL=10 +CFLAGS_REL = -O2 -DNDEBUG /Z7 /MD /Gy +CFLAGS_DBG = -Od -DDEBUG /Z7 /MDd +LINKFLAGS = -nologo -incremental:no -debug +CFLAGS = $(CFLAGS_REL) -nologo -D_USE_MATH_DEFINES $(FEAT_FLAGS) $(INCLUDES) $(D) +AFLAGS = -f win64 $(FEAT_FLAGS) $(INCLUDES) $(D) +CC = cl +# or CC = icl -Qstd=c99 +AS = nasm lib: bin static dll static: bin isa-l_static.lib @@ -180,7 +185,7 @@ $? << isa-l.dll: $(objs) - link -out:$@ -dll -def:isa-l.def @<< + link -out:$@ -dll -def:isa-l.def $(LINKFLAGS) @<< $? << @@ -302,8 +307,10 @@ clean: -if exist bin\*.obj del bin\*.obj -if exist isa-l_static.lib del isa-l_static.lib -if exist *.exe del *.exe + -if exist *.pdb del *.pdb -if exist isa-l.lib del isa-l.lib -if exist isa-l.dll del isa-l.dll + -if exist isa-l.exp del isa-l.exp zlib.lib: igzip_perf.exe: zlib.lib diff --git a/tools/gen_nmake.mk b/tools/gen_nmake.mk index b998ee5..dedea90 100644 --- a/tools/gen_nmake.mk +++ b/tools/gen_nmake.mk @@ -11,12 +11,17 @@ Makefile.nmake: FORCE @$(foreach o, $(subst /,\\,$(objs:.o=.obj)), printf " %s\n\t%s" \\ $(o) >> $@; ) @echo '' >> $@ @echo '' >> $@ - @echo 'INCLUDES = $(INCLUDE)' >> $@ - @echo 'LINKFLAGS = /nologo' >> $@ - @echo 'CFLAGS = -O2 -D NDEBUG /nologo -D_USE_MATH_DEFINES -Qstd=c99 $$(INCLUDES) $$(D)' >> $@ - @echo 'AFLAGS = -f win64 $$(INCLUDES) $$(D)' >> $@ - @echo 'CC = icl' >> $@ - @echo 'AS = yasm' >> $@ + @echo 'INCLUDES = $(INCLUDE)' >> $@ + @echo '# Modern asm feature level, consider upgrading nasm/yasm before decreasing feature_level' >> $@ + @echo 'FEAT_FLAGS = -DHAVE_AS_KNOWS_AVX512 -DAS_FEATURE_LEVEL=10' >> $@ + @echo 'CFLAGS_REL = -O2 -DNDEBUG /Z7 /MD /Gy' >> $@ + @echo 'CFLAGS_DBG = -Od -DDEBUG /Z7 /MDd' >> $@ + @echo 'LINKFLAGS = -nologo -incremental:no -debug' >> $@ + @echo 'CFLAGS = $$(CFLAGS_REL) -nologo -D_USE_MATH_DEFINES $$(FEAT_FLAGS) $$(INCLUDES) $$(D)' >> $@ + @echo 'AFLAGS = -f win64 $$(FEAT_FLAGS) $$(INCLUDES) $$(D)' >> $@ + @echo 'CC = cl' >> $@ + @echo '# or CC = icl -Qstd=c99' >> $@ + @echo 'AS = nasm' >> $@ @echo '' >> $@ @echo 'lib: bin static dll' >> $@ @echo 'static: bin isa-l_static.lib' >> $@ @@ -30,7 +35,7 @@ Makefile.nmake: FORCE @echo '<<' >> $@ @echo '' >> $@ @echo 'isa-l.dll: $$(objs)' >> $@ - @echo ' link -out:$$@ -dll -def:isa-l.def @<<' >> $@ + @echo ' link -out:$$@ -dll -def:isa-l.def $$(LINKFLAGS) @<<' >> $@ @echo '$$?' >> $@ @echo '<<' >> $@ @echo '' >> $@ @@ -90,8 +95,10 @@ endif @echo ' -if exist bin\*.obj del bin\*.obj' >> $@ @echo ' -if exist isa-l_static.lib del isa-l_static.lib' >> $@ @echo ' -if exist *.exe del *.exe' >> $@ + @echo ' -if exist *.pdb del *.pdb' >> $@ @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.exp del isa-l.exp' >> $@ @echo '' >> $@ $(if $(findstring igzip,$(units)),@echo 'zlib.lib:' >> $@ ) @cat $(foreach unit,$(units), $(unit)/Makefile.am) | sed \