From 5b39dc76f1bc82f941d5c800ab9f34407a06b53a Mon Sep 17 00:00:00 2001 From: Igor Pavlov <87184205+ip7z@users.noreply.github.com> Date: Wed, 21 Jun 2023 00:00:00 +0000 Subject: 23.01 --- CPP/Build.mak | 87 +++++++++++++++++++++++++++++++++++++++-------------------- 1 file changed, 58 insertions(+), 29 deletions(-) (limited to 'CPP/Build.mak') diff --git a/CPP/Build.mak b/CPP/Build.mak index 1ef676e..393fa2c 100644 --- a/CPP/Build.mak +++ b/CPP/Build.mak @@ -4,6 +4,11 @@ LIBS = $(LIBS) oleaut32.lib ole32.lib CFLAGS = $(CFLAGS) -DUNICODE -D_UNICODE !ENDIF +!IF "$(CC)" != "clang-cl" +# for link time code generation: +# CFLAGS = $(CFLAGS) -GL +!ENDIF + !IFNDEF O !IFDEF PLATFORM O=$(PLATFORM) @@ -51,33 +56,22 @@ COMPL_ASM = $(MY_ML) $** $O/$(*B).obj COMPL_ASM = $(MY_ML) -c -Fo$O/ $** !ENDIF -CFLAGS = $(CFLAGS) -nologo -c -Fo$O/ -W4 -WX -EHsc -Gy -GR- -GF +!IFDEF OLD_COMPILER +CFLAGS_WARN_LEVEL = -W4 +!ELSE +CFLAGS_WARN_LEVEL = -Wall +!ENDIF + +CFLAGS = $(CFLAGS) -nologo -c -Fo$O/ $(CFLAGS_WARN_LEVEL) -WX -EHsc -Gy -GR- -GF !IF "$(CC)" == "clang-cl" CFLAGS = $(CFLAGS) \ -Werror \ - -Wextra \ -Wall \ + -Wextra \ -Weverything \ - -Wno-extra-semi-stmt \ - -Wno-extra-semi \ - -Wno-zero-as-null-pointer-constant \ - -Wno-sign-conversion \ - -Wno-old-style-cast \ - -Wno-reserved-id-macro \ - -Wno-deprecated-dynamic-exception-spec \ - -Wno-language-extension-token \ - -Wno-global-constructors \ - -Wno-non-virtual-dtor \ - -Wno-deprecated-copy-dtor \ - -Wno-exit-time-destructors \ - -Wno-switch-enum \ - -Wno-covered-switch-default \ - -Wno-nonportable-system-include-path \ - -Wno-c++98-compat-pedantic \ - -Wno-cast-qual \ - -Wc++11-extensions \ + -Wfatal-errors \ !ENDIF @@ -92,8 +86,21 @@ CFLAGS = $(CFLAGS) -MT CFLAGS = $(CFLAGS_COMMON) $(CFLAGS) + !IFNDEF OLD_COMPILER -CFLAGS = $(CFLAGS) -GS- -Zc:forScope -Zc:wchar_t + +CFLAGS = $(CFLAGS) -GS- -Zc:wchar_t +!IFDEF VCTOOLSVERSION +!IF "$(VCTOOLSVERSION)" >= "14.00" +!IF "$(CC)" != "clang-cl" +CFLAGS = $(CFLAGS) -Zc:throwingNew +!ENDIF +!ENDIF +!ELSE +# -Zc:forScope is default in VS2010. so we need it only for older versions +CFLAGS = $(CFLAGS) -Zc:forScope +!ENDIF + !IFNDEF UNDER_CE !IF "$(CC)" != "clang-cl" CFLAGS = $(CFLAGS) -MP4 @@ -102,10 +109,10 @@ CFLAGS = $(CFLAGS) -MP4 # CFLAGS = $(CFLAGS) -arch:IA32 !ENDIF !ENDIF -!ELSE -CFLAGS = $(CFLAGS) + !ENDIF + !IFDEF MY_CONSOLE CFLAGS = $(CFLAGS) -D_CONSOLE !ENDIF @@ -123,7 +130,7 @@ CFLAGS_O1 = $(CFLAGS) -O1 !ENDIF CFLAGS_O2 = $(CFLAGS) -O2 -LFLAGS = $(LFLAGS) -nologo -OPT:REF -OPT:ICF +LFLAGS = $(LFLAGS) -nologo -OPT:REF -OPT:ICF -INCREMENTAL:NO !IFNDEF UNDER_CE LFLAGS = $(LFLAGS) /LARGEADDRESSAWARE @@ -140,6 +147,12 @@ LFLAGS = $(LFLAGS) /FIXED:NO # /BASE:0x400000 !ENDIF +!IF "$(PLATFORM)" == "arm64" +# we can get better compression ratio with ARM64 filter if we change alignment to 4096 +# LFLAGS = $(LFLAGS) /FILEALIGN:4096 +!ENDIF + + # !IF "$(PLATFORM)" == "x64" @@ -162,21 +175,23 @@ COMPL_O1 = $(CC) $(CFLAGS_O1) $** COMPL_O2 = $(CC) $(CFLAGS_O2) $** COMPL_PCH = $(CC) $(CFLAGS_O1) -Yc"StdAfx.h" -Fp$O/a.pch $** COMPL = $(CC) $(CFLAGS_O1) -Yu"StdAfx.h" -Fp$O/a.pch $** - -COMPLB = $(CC) $(CFLAGS_O1) -Yu"StdAfx.h" -Fp$O/a.pch $< -# COMPLB_O2 = $(CC) $(CFLAGS_O2) -Yu"StdAfx.h" -Fp$O/a.pch $< -COMPLB_O2 = $(CC) $(CFLAGS_O2) $< +COMPLB = $(CC) $(CFLAGS_O1) -Yu"StdAfx.h" -Fp$O/a.pch $< +COMPLB_O2 = $(CC) $(CFLAGS_O2) $< +# COMPLB_O2 = $(CC) $(CFLAGS_O2) -Yu"StdAfx.h" -Fp$O/a.pch $< CFLAGS_C_ALL = $(CFLAGS_O2) $(CFLAGS_C_SPEC) + CCOMPL_PCH = $(CC) $(CFLAGS_C_ALL) -Yc"Precomp.h" -Fp$O/a.pch $** CCOMPL_USE = $(CC) $(CFLAGS_C_ALL) -Yu"Precomp.h" -Fp$O/a.pch $** +CCOMPLB_USE = $(CC) $(CFLAGS_C_ALL) -Yu"Precomp.h" -Fp$O/a.pch $< CCOMPL = $(CC) $(CFLAGS_C_ALL) $** CCOMPLB = $(CC) $(CFLAGS_C_ALL) $< !IF "$(CC)" == "clang-cl" COMPL = $(COMPL) -FI StdAfx.h COMPLB = $(COMPLB) -FI StdAfx.h -CCOMPL_USE = $(CCOMPL_USE) -FI Precomp.h +CCOMPL_USE = $(CCOMPL_USE) -FI Precomp.h +CCOMPLB_USE = $(CCOMPLB_USE) -FI Precomp.h !ENDIF all: $(PROGPATH) @@ -189,6 +204,11 @@ $O: $O/asm: if not exist "$O/asm" mkdir "$O/asm" +!IF "$(CC)" != "clang-cl" +# for link time code generation: +# LFLAGS = $(LFLAGS) -LTCG +!ENDIF + $(PROGPATH): $O $O/asm $(OBJS) $(DEF_FILE) link $(LFLAGS) -out:$(PROGPATH) $(OBJS) $(LIBS) @@ -198,3 +218,12 @@ $O\resource.res: $(*B).rc !ENDIF $O\StdAfx.obj: $(*B).cpp $(COMPL_PCH) + +predef: empty.c + $(CCOMPL) /EP /Zc:preprocessor /PD +predef2: A.cpp + $(COMPL) -EP -Zc:preprocessor -PD +predef3: A.cpp + $(COMPL) -E -dM +predef4: A.cpp + $(COMPL_O2) -E -- cgit v1.2.3-55-g6feb