Skip to content

win32: separate $Config{ccflags} and $Config{optimize} #17224

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 27, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 15 additions & 7 deletions win32/GNUmakefile
Original file line number Diff line number Diff line change
Expand Up @@ -600,8 +600,9 @@ LIBFILES = $(LIBC) -lmoldname -lkernel32 -luser32 -lgdi32 -lwinspool \
-luuid -lws2_32 -lmpr -lwinmm -lversion -lodbc32 -lodbccp32 -lcomctl32

ifeq ($(CFG),Debug)
OPTIMIZE = -g -O2 -DDEBUGGING
OPTIMIZE = -g -O2
LINK_DBG = -g
DEFINES += -DDEBUGGING
else
OPTIMIZE = -s -O2
LINK_DBG = -s
Expand Down Expand Up @@ -681,6 +682,7 @@ INCLUDES = -I.\include -I. -I..
DEFINES = -DWIN32 -D_CONSOLE -DNO_STRICT
LOCDEFS = -DPERLDLL -DPERL_CORE
CXX_FLAG = -TP -EHsc
EXTRACFLAGS = -nologo -GF -W3

ifeq ($(CCTYPE),MSVC140)
LIBC = ucrt.lib
Expand All @@ -693,11 +695,14 @@ LIBC = msvcrt.lib
endif

ifeq ($(CFG),Debug)
OPTIMIZE = -Od -MD -Zi -DDEBUGGING
OPTIMIZE = -Od -Zi
LINK_DBG = -debug
DEFINES += -DDEBUGGING
EXTRACFLAGS += -MD
else ifeq ($(CFG),DebugSymbols)
OPTIMIZE = -Od -MD -Zi
OPTIMIZE = -Od -Zi
LINK_DBG = -debug
EXTRACFLAGS += -MD
else ifeq ($(CFG),DebugFull)
ifeq ($(CCTYPE),MSVC140)
LIBC = ucrtd.lib
Expand All @@ -708,12 +713,15 @@ LIBC = ucrtd.lib
else
LIBC = msvcrtd.lib
endif
OPTIMIZE = -Od -MDd -Zi -D_DEBUG -DDEBUGGING
OPTIMIZE = -Od -Zi
LINK_DBG = -debug
DEFINES += -D_DEBUG -DDEBUGGING
EXTRACFLAGS += -MDd

else
# Enable Whole Program Optimizations (WPO) and Link Time Code Generation (LTCG).
# -O1 yields smaller code, which turns out to be faster than -O2 on x86 and x64
OPTIMIZE = -O1 -MD -Zi -DNDEBUG -GL
OPTIMIZE = -O1 -Zi -GL
# we enable debug symbols in release builds also
LINK_DBG = -debug -opt:ref,icf -ltcg
# you may want to enable this if you want COFF symbols in the executables
Expand All @@ -723,6 +731,7 @@ LINK_DBG = -debug -opt:ref,icf -ltcg
# avoid the bloat of COFF symbols by default.
#LINK_DBG += -debugtype:both
LIB_FLAGS = -ltcg
EXTRACFLAGS += -MD
endif

ifeq ($(WIN64),define)
Expand Down Expand Up @@ -811,7 +820,6 @@ endif

LIBFILES = $(LIBBASEFILES) $(LIBC)

EXTRACFLAGS = -nologo -GF -W3
ifeq ($(__ICC),define)
EXTRACFLAGS += -Qstd=c99
endif
Expand Down Expand Up @@ -1185,7 +1193,7 @@ CFG_VARS = \
"archname=$(ARCHNAME)" \
"cc=$(CC)" \
"ld=$(LINK32)" \
"ccflags=$(subst ",\",$(EXTRACFLAGS) $(OPTIMIZE) $(DEFINES) $(BUILDOPT))" \
"ccflags=$(subst ",\",$(EXTRACFLAGS) $(DEFINES) $(BUILDOPT))" \
"usecplusplus=$(USE_CPLUSPLUS)" \
"cf_email=$(EMAIL)" \
"d_mymalloc=$(PERL_MALLOC)" \
Expand Down
19 changes: 12 additions & 7 deletions win32/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -475,6 +475,7 @@ INCLUDES = -I$(COREDIR) -I.\include -I. -I..
DEFINES = -DWIN32 -D_CONSOLE -DNO_STRICT
LOCDEFS = -DPERLDLL -DPERL_CORE
CXX_FLAG = -TP -EHsc
EXTRACFLAGS = -nologo -GF -W3

!IF "$(CCTYPE)" == "MSVC140" || "$(CCTYPE)" == "MSVC141" || "$(CCTYPE)" == "MSVC142"
LIBC = ucrt.lib
Expand All @@ -483,23 +484,28 @@ LIBC = msvcrt.lib
!ENDIF

!IF "$(CFG)" == "Debug"
OPTIMIZE = -Od -MD -Zi -DDEBUGGING
OPTIMIZE = -Od -Zi
LINK_DBG = -debug
DEFINES = $(DEFINES) -DDEBUGGING
EXTRACFLAGS = $(EXTRACFLAGS) -MD
!ELSEIF "$(CFG)" == "DebugSymbols"
OPTIMIZE = -Od -MD -Zi
OPTIMIZE = -Od -Zi
LINK_DBG = -debug
EXTRACFLAGS = $(EXTRACFLAGS) -MD
!ELSEIF "$(CFG)" == "DebugFull"
! IF "$(CCTYPE)" == "MSVC140" || "$(CCTYPE)" == "MSVC141" || "$(CCTYPE)" == "MSVC142"
LIBC = ucrtd.lib
! ELSE
LIBC = msvcrtd.lib
! ENDIF
OPTIMIZE = -Od -MDd -Zi -D_DEBUG -DDEBUGGING
OPTIMIZE = -Od -Zi
LINK_DBG = -debug
DEFINES = $(DEFINES) -D_DEBUG -DDEBUGGING
EXTRACFLAGS = $(EXTRACFLAGS) -MDd
!ELSE
# Enable Whole Program Optimizations (WPO) and Link Time Code Generation (LTCG).
# -O1 yields smaller code, which turns out to be faster than -O2 on x86 and x64
OPTIMIZE = -O1 -MD -Zi -DNDEBUG -GL
OPTIMIZE = -O1 -Zi -GL
# we enable debug symbols in release builds also
LINK_DBG = -debug -opt:ref,icf -ltcg
# you may want to enable this if you want COFF symbols in the executables
Expand All @@ -509,6 +515,7 @@ LINK_DBG = -debug -opt:ref,icf -ltcg
# avoid the bloat of COFF symbols by default.
#LINK_DBG = $(LINK_DBG) -debugtype:both
LIB_FLAGS = -ltcg
EXTRACFLAGS = $(EXTRACFLAGS) -MD
!ENDIF

!IF "$(WIN64)" == "define"
Expand Down Expand Up @@ -580,8 +587,6 @@ LIBBASEFILES = $(LIBBASEFILES) bufferoverflowU.lib

LIBFILES = $(LIBBASEFILES) $(LIBC)

#EXTRACFLAGS = -nologo -GF -W4 -wd4127 -wd4706
EXTRACFLAGS = -nologo -GF -W3
!IF "$(__ICC)" == "define"
EXTRACFLAGS = $(EXTRACFLAGS) -Qstd=c99
!ENDIF
Expand Down Expand Up @@ -893,7 +898,7 @@ CFG_VARS = \
"archname=$(ARCHNAME)" \
"cc=$(CC)" \
"ld=$(LINK32)" \
"ccflags=$(EXTRACFLAGS) $(OPTIMIZE:"=\") $(DEFINES) $(BUILDOPT)" \
"ccflags=$(EXTRACFLAGS) $(DEFINES) $(BUILDOPT)" \
"usecplusplus=$(USE_CPLUSPLUS)" \
"cf_email=$(EMAIL)" \
"d_mymalloc=$(PERL_MALLOC)" \
Expand Down
21 changes: 14 additions & 7 deletions win32/makefile.mk
Original file line number Diff line number Diff line change
Expand Up @@ -576,8 +576,9 @@ LIBFILES = $(LIBC) -lmoldname -lkernel32 -luser32 -lgdi32 -lwinspool \
-luuid -lws2_32 -lmpr -lwinmm -lversion -lodbc32 -lodbccp32 -lcomctl32

.IF "$(CFG)" == "Debug"
OPTIMIZE = -g -O2 -DDEBUGGING
OPTIMIZE = -g -O2
LINK_DBG = -g
DEFINES += -DDEBUGGING
.ELIF "$(CFG)" == "DebugSymbols"
OPTIMIZE = -g -O2
LINK_DBG = -g
Expand Down Expand Up @@ -656,6 +657,7 @@ INCLUDES = -I.\include -I. -I..
DEFINES = -DWIN32 -D_CONSOLE -DNO_STRICT
LOCDEFS = -DPERLDLL -DPERL_CORE
CXX_FLAG = -TP -EHsc
EXTRACFLAGS = -nologo -GF -W3

.IF "$(CCTYPE)" == "MSVC140" || "$(CCTYPE)" == "MSVC141" || "$(CCTYPE)" == "MSVC142"
LIBC = ucrt.lib
Expand All @@ -664,23 +666,28 @@ LIBC = msvcrt.lib
.ENDIF

.IF "$(CFG)" == "Debug"
OPTIMIZE = -Od -MD -Zi -DDEBUGGING
OPTIMIZE = -Od -Zi
LINK_DBG = -debug
DEFINES += -DDEBUGGING
EXTRACFLAGS += -MD
.ELIF "$(CFG)" == "DebugSymbols"
OPTIMIZE = -Od -MD -Zi
OPTIMIZE = -Od -Zi
LINK_DBG = -debug
EXTRACFLAGS += -MD
.ELIF "$(CFG)" == "DebugFull"
.IF "$(CCTYPE)" == "MSVC140" || "$(CCTYPE)" == "MSVC141" || "$(CCTYPE)" == "MSVC142"
LIBC = ucrtd.lib
.ELSE
LIBC = msvcrtd.lib
.ENDIF
OPTIMIZE = -Od -MDd -Zi -D_DEBUG -DDEBUGGING
OPTIMIZE = -Od -Zi
LINK_DBG = -debug
DEFINES += -D_DEBUG -DDEBUGGING
EXTRACFLAGS += -MDd
.ELSE
# Enable Whole Program Optimizations (WPO) and Link Time Code Generation (LTCG).
# -O1 yields smaller code, which turns out to be faster than -O2 on x86 and x64
OPTIMIZE = -O1 -MD -Zi -DNDEBUG -GL
OPTIMIZE = -O1 -Zi -GL
# we enable debug symbols in release builds also
LINK_DBG = -debug -opt:ref,icf -ltcg
# you may want to enable this if you want COFF symbols in the executables
Expand All @@ -690,6 +697,7 @@ LINK_DBG = -debug -opt:ref,icf -ltcg
# avoid the bloat of COFF symbols by default.
#LINK_DBG += -debugtype:both
LIB_FLAGS = -ltcg
EXTRACFLAGS += -MD
.ENDIF

.IF "$(WIN64)" == "define"
Expand Down Expand Up @@ -762,7 +770,6 @@ LIBBASEFILES += bufferoverflowU.lib

LIBFILES = $(LIBBASEFILES) $(LIBC)

EXTRACFLAGS = -nologo -GF -W3
.IF "$(__ICC)" == "define"
EXTRACFLAGS += -Qstd=c99
.ENDIF
Expand Down Expand Up @@ -1129,7 +1136,7 @@ CFG_VARS = \
archname=$(ARCHNAME) ~ \
cc=$(CC) ~ \
ld=$(LINK32) ~ \
ccflags=$(EXTRACFLAGS) $(OPTIMIZE) $(DEFINES) $(BUILDOPT) ~ \
ccflags=$(EXTRACFLAGS) $(DEFINES) $(BUILDOPT) ~ \
usecplusplus=$(USE_CPLUSPLUS) ~ \
cf_email=$(EMAIL) ~ \
d_mymalloc=$(PERL_MALLOC) ~ \
Expand Down