Skip to content

Commit

Permalink
Fix PDB generation
Browse files Browse the repository at this point in the history
  • Loading branch information
davidrg committed Aug 18, 2024
1 parent 3081f57 commit 0636d85
Show file tree
Hide file tree
Showing 4 changed files with 77 additions and 38 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -522,6 +522,7 @@ jobs:
set CKF_SSH_DLL_VARIANT=g
call mksshdll.bat
ren k95ssh.dll k95sshg.dll
ren k95ssh.pdb k95sshg.pdb
del k95ssh.res
if "%CKB_XP_COMPATIBLE%" NEQ "yes" goto :noxp
Expand All @@ -530,13 +531,15 @@ jobs:
set CKF_SSH_DLL_VARIANT=x
call mksshdll.bat
ren k95ssh.dll k95sshx.dll
ren k95ssh.pdb k95sshx.pdb
del k95ssh.res
REM XP, GSSAPI-enabled
set SSH_LIB=sshgx.lib
set CKF_SSH_DLL_VARIANT=gx
call mksshdll.bat
ren k95ssh.dll k95sshgx.dll
ren k95ssh.pdb k95sshgx.pdb
del k95ssh.res
:noxp
Expand Down
82 changes: 44 additions & 38 deletions kermit/k95/ckoker.mak
Original file line number Diff line number Diff line change
Expand Up @@ -187,11 +187,11 @@ CKB_STATIC_CRT = yes
# Standard windows headers from MinGW that don't come with OpenWatcom:
INCLUDE = $(INCLUDE);ow\;

!endif
!endif # EndIf CMP == OWCL

!if ($(MSC_VER) < 80)
!error Unsupported compiler version. Visual C++ 1.0 32-bit edition or newer required.
!endif
!endif # EndIf MSC_VER < 80

# TODO: Much of this compiler flag work should be applied to the KUI Makefile
# too
Expand All @@ -200,18 +200,18 @@ INCLUDE = $(INCLUDE);ow\;
# then tell the linker we're targeting x86-64
!if "$(TARGET_CPU)" == "x86-64"
LDFLAGS = $(LDFLAGS) /MACHINE:X64
!endif
!endif # EndIf TARGET_CPU == x86-64

!if "$(TARGET_CPU)" == "AXP64"
# This compiler is capable of targeting AXP64, so add the build flag to do that.
COMMON_CFLAGS = $(COMMON_CFLAGS) /Ap64
LINKFLAGS = $(LINKFLAGS) /MACHINE:ALPHA64
!endif
!endif # EndIf TARGET_CPU == AXP64

!if ("$(DEBUG)" != "-DNDEBUG") && ($(MSC_VER) <= 130)
# This debug flag is only valid on Visual C++ 6.0 and older.
LINKFLAGS = $(LINKFLAGS) /debugtype:both
!endif
!endif # EndIf DEBUG != -DNDEBUG and MSC_VER <= 130

!if ($(MSC_VER) >= 170) && ($(MSC_VER) <= 192)
# Starting with Visual C++ 2012, the default subsystem version is set to 6.0
Expand All @@ -221,66 +221,72 @@ LINKFLAGS = $(LINKFLAGS) /debugtype:both
# version to 5.1 so the generated binaries are compatible.
SUBSYSTEM_CONSOLE=console,5.1
SUBSYSTEM_WIN32=windows,5.1
!endif
!endif # EndIf MSC_VER >= 170 and MSC_VER <= 192

!if ($(MSC_VER) == 80) && ("$(MSC_VER)" == "AXP")
!if ($(MSC_VER) == 80) && ("$(TARGET_CPU)" == "AXP")
# The linker included with the NT 3.50 SDK for Alpha can't handle
# K95 (complains "LINK : error LNK1155: Special symbol 'end' already defined.")
# So to support using a newer linker that has less problems, we'll set
# the subsystem version so the result still works on NT 3.1/3.50
SUBSYSTEM_CONSOLE=console,3.1
SUBSYSTEM_WIN32=windows,3.1
!endif
!endif # EndIf MSC_VER == 80 and TARGET_CPU == AXP

!if ($(MSC_VER) > 90)
!if "$(TARGET_CPU)" != "MIPS"
# This flag isn't valid on Visual C++ 4.0 MIPS (or, I assume, any other version)
COMMON_OPTS = $(COMMON_OPTS) /GA
!endif
!endif
!endif # EndIf TARGET_CPU != MIPS
!endif # EndIf MSC_VER > 90

!if ($(MSC_VER) < 140)
# These flags and options are deprecated or unsupported
# from Visual C++ 2005 (v8.0) and up.

# /GX- is new in Visual C++ 2.0
!if ($(MSC_VER) > 80)
COMMON_CFLAGS = $(COMMON_CFLAGS) /GX-
!endif

!if ($(MSC_VER) < 100)
# Visual C++ 2.0 and 1.0 32-bit edition don't support these flags, so don't
# use them.
CFLAG_GF=
!endif
# PDB Generation Stuff

!if ($(MSC_VER) < 180) && ("$(ISJOM)" == "yes") && ("$(CKB_MAKE_PDB)" != "yes")
!message Make is JOM and compiler is older than Visual C++ 2013. Can't reliably
!message synchronise writes to a PDB file with this compiler. Disabling PDB
!message generation. override with: set CKB_MAKE_PDB=yes but you may get build
!message errors.
CKB_MAKE_PDB=no
!endif
!endif # EndIf MSC_VER < 180 and ISJOM == yes and CKB_MAKE_PDB != yes

!if "$(CKB_MAKE_PDB)" != "no"
# Lets see if we can make a PDB file! This requires Visual C++ 4.0 or newer.
!if ($(MSC_VER) > 90)
!message Enabling PDB generation

COMMON_CFLAGS = $(COMMON_CFLAGS) /Zi
LINKFLAGS = $(LINKFLAGS) /DEBUG /INCREMENTAL:NO /OPT:REF
LDDEBUG = $(LDDEBUG) /DEBUG /INCREMENTAL:NO /OPT:REF

# /OPT:ICF is new in Visual C++ 5.0
!if ($(MSC_VER) >= 110)
LINKFLAGS = $(LINKFLAGS) /OPT:ICF
!endif
LDDEBUG = $(LDDEBUG) /OPT:ICF
!endif # EndIf MSC_VER >= 110

# /FS is required to synchronise writes to a PDB when doing parallel builds with
# something like JOM. It was introduced in Visual C++ 2013.
!if ($(MSC_VER) >= 180)
COMMON_CFLAGS = $(COMMON_CFLAGS) /FS
!endif
!endif # EndIf MSC_VER >= 180

!endif
!endif
!endif # EndIf MSC_VER > 90
!endif # EndIf CKB_MAKE_PDB != no

# End PDB Generation Stuff

!if ($(MSC_VER) < 140)
# These flags and options are deprecated or unsupported
# from Visual C++ 2005 (v8.0) and up.

# /GX- is new in Visual C++ 2.0
!if ($(MSC_VER) > 80)
COMMON_CFLAGS = $(COMMON_CFLAGS) /GX-
!endif # EndIf MSC_VER > 80

!if ($(MSC_VER) < 100)
# Visual C++ 2.0 and 1.0 32-bit edition don't support these flags, so don't
# use them.
CFLAG_GF=
!endif # EndIf MSC_VER < 100

COMMON_CFLAGS = $(COMMON_CFLAGS) /Ze
# These are: /Ze Enable extensions (default)
Expand All @@ -291,19 +297,19 @@ COMMON_CFLAGS = $(COMMON_CFLAGS) /Ze
# So only generate PCH files when nmake instead of jom.
!if "$(ISJOM)" == "no"
COMMON_CFLAGS = $(COMMON_CFLAGS) /YX
!endif
!endif # EndIf ISJOM == no

!if "$(TARGET_CPU)" == "x86"
# Optimise for Pentium
COMMON_OPTS = $(COMMON_OPTS) /G5
!endif
!endif # EndIf TARGET_CPU == x86

!else
!else # Else MSC_VER < 140
COMMON_CFLAGS = $(COMMON_CFLAGS) /EHs-c-
# These are: /EHs-c- Enable C++ Exception handling (replaces /GX-)
!endif
!endif # EndIf MSC_VER < 140

!endif
!endif # EndIf PLATFORM == NT

RCDEFINES=$(RC_FEATURE_DEFS) /dCOMPILER_$(CMP)
!if "$(SSH_LIB)" == ""
Expand Down Expand Up @@ -414,7 +420,7 @@ msvc:
LDFLAGS="" \
PLATFORM="NT" \
NOLINK="/c" \
LINKFLAGS="/nologo /SUBSYSTEM:$(SUBSYSTEM_CONSOLE) /MAP /OPT:REF" DEF="cknker.def"
LINKFLAGS="/nologo /SUBSYSTEM:$(SUBSYSTEM_CONSOLE) /MAP /OPT:REF $(LDDEBUG)" DEF="cknker.def"

!if "$(CKF_DYNAMIC_SSH)" == "yes"
msvc-sshdll:
Expand Down Expand Up @@ -583,7 +589,7 @@ k95g:
LDFLAGS="" \
PLATFORM="NT" \
NOLINK="-c" \
LINKFLAGS="/nologo /SUBSYSTEM:$(SUBSYSTEM_WIN32)" \
LINKFLAGS="/nologo /SUBSYSTEM:$(SUBSYSTEM_WIN32) $(LDDEBUG)" \
DEF="cknker.def"

################### OS/2 TARGETS ###################
Expand Down
28 changes: 28 additions & 0 deletions kermit/k95/kui/makefile
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,34 @@ COMMON_CFLAGS = /D_MT /QmipsOb5000
CKB_STATIC_CRT = yes
!endif

# PDB Generation Stuff

!if ($(MSC_VER) < 180) && ("$(ISJOM)" == "yes") && ("$(CKB_MAKE_PDB)" != "yes")
!message Make is JOM and compiler is older than Visual C++ 2013. Can't reliably
!message synchronise writes to a PDB file with this compiler. Disabling PDB
!message generation. override with: set CKB_MAKE_PDB=yes but you may get build
!message errors.
CKB_MAKE_PDB=no
!endif # EndIf MSC_VER < 180 and ISJOM == yes and CKB_MAKE_PDB != yes

!if "$(CKB_MAKE_PDB)" != "no"
# Lets see if we can make a PDB file! This requires Visual C++ 4.0 or newer.
!if ($(MSC_VER) > 90)
!message Enabling PDB generation

COMMON_CFLAGS = $(COMMON_CFLAGS) /Zi

# /FS is required to synchronise writes to a PDB when doing parallel builds with
# something like JOM. It was introduced in Visual C++ 2013.
!if ($(MSC_VER) >= 180)
COMMON_CFLAGS = $(COMMON_CFLAGS) /FS
!endif # EndIf MSC_VER >= 180

!endif # EndIf MSC_VER > 90
!endif # EndIf CKB_MAKE_PDB != no

# End PDB Generation Stuff

all: $(OUTDIR)\$(PROJ).exe

KUIOBJS = \
Expand Down
2 changes: 2 additions & 0 deletions kermit/k95/mkdist.bat
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,13 @@ if not exist dist\users\NUL mkdir dist\users
@echo Move build outputs...
move *.exe dist
move *.pdb dist
if exist dist\nullssh.pdb delete dist\nullssh.pdb
move k95ssh*.dll dist
if exist k95crypt.dll move k95crypt.dll dist
copy *.manifest dist
copy iksd.ksc dist\iksd.ksc.sample
ren dist\cknker.exe k95.exe
ren dist\cknker.pdb k95.pdb
ren dist\cknker.exe.manifest k95.exe.manifest
del dist\cknker.exe.manifest
REM del dist\ctl3dins.exe -- this can trip up virus scanners but its required by the dialer
Expand Down

0 comments on commit 0636d85

Please sign in to comment.