Skip to content

Commit

Permalink
Fixes and greatly simplified build
Browse files Browse the repository at this point in the history
  • Loading branch information
skeeto committed Jun 3, 2022
1 parent 75974cb commit 66c4d1b
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 92 deletions.
102 changes: 12 additions & 90 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,90 +1,12 @@
#
# makefile to be used with NMAKE for building source and
# installation packages
#
# prerequisites:
# - environment variable VSINSTALLDIR must point to your Visual Studio
# or VCExpress installation folder
# - Info-zip must be found in the PATH
#
# run
# nmake src
# to create a source package with name cv2pdb_src_<VERSION>.zip in
# ..\downloads
#
# run
# nmake bin
# to create a binary package with name cv2pdb_<VERSION>.zip in
# ..\downloads

SRC = src\cv2pdb.cpp \
src\cv2pdb.h \
src\demangle.cpp \
src\demangle.h \
src\dwarf2pdb.cpp \
src\dwarf.h \
src\LastError.h \
src\main.cpp \
src\mscvpdb.h \
src\mspdb.h \
src\mspdb.cpp \
src\PEImage.cpp \
src\PEImage.h \
src\symutil.cpp \
src\symutil.h \
src\dviewhelper\dviewhelper.cpp

ADD = Makefile \
src\cv2pdb.vcproj \
src\dviewhelper\dviewhelper.vcproj \
src\cv2pdb.sln

DOC = VERSION README INSTALL LICENSE CHANGES TODO FEATURES autoexp.expand autoexp.visualizer

BIN = bin\Release\cv2pdb.exe bin\Release\dviewhelper.dll

TEST = test\cvtest.d \
test\cvtest.vcproj \
test\Makefile \

all: bin src

###############################
include VERSION

DOWNLOADS = ..\downloads

$(DOWNLOADS):
if not exist $(DOWNLOADS)\nul mkdir $(DOWNLOADS)

###############################
ZIP = zip
SRC_ZIP = $(DOWNLOADS)\cv2pdb_src_$(VERSION).zip

src: $(DOWNLOADS) $(SRC_ZIP)

$(SRC_ZIP): $(SRC) $(ADD) $(DOC) $(TEST)
if exist $(SRC_ZIP) del $(SRC_ZIP)
$(ZIP) $(SRC_ZIP) -X $(SRC) $(ADD) $(DOC) $(TEST)

###############################
BIN_ZIP = $(DOWNLOADS)\cv2pdb_$(VERSION).zip

bin: $(DOWNLOADS) $(BIN_ZIP)

$(BIN_ZIP): $(BIN) $(DOC) Makefile
if exist $(BIN_ZIP) del $(BIN_ZIP)
$(ZIP) $(BIN_ZIP) -j -X $(BIN) $(DOC)

IDEDIR = $(VSINSTALLDIR)\Common7\IDE

$(BIN): $(SRC) $(ADD) $(TEST) VERSION
if exist "$(IDEDIR)\VCExpress.exe" "$(IDEDIR)\VCExpress.exe" /Build Release src\cv2pdb.sln
if not exist "$(IDEDIR)\VCExpress.exe" "$(IDEDIR)\devenv.exe" /Build Release src\cv2pdb.sln

###############################
cv2pdb_exe:
devenv /Project "cv2pdb" /Build "Release|Win32" src\cv2pdb_vs12.sln

test: cv2pdb_exe
cd ..\test && nmake test
CPPFLAGS = /nologo /EHsc /O2
LDLIBS = advapi32.lib
src = src/PEImage.cpp src/cv2pdb.cpp src/cvutil.cpp src/demangle.cpp \
src/dwarf2pdb.cpp src/dwarflines.cpp src/main.cpp src/mspdb.cpp \
src/readDwarf.cpp src/symutil.cpp
cv2pdb.exe: $(src) cvt80to64.obj
$(CC) /nologo /EHsc /O2 /Fe:$@ $(src) cvt80to64.obj $(LDLIBS)
cvt80to64.obj: src/cvt80to64.asm
$(AS) /nologo /c src/cvt80to64.asm
clean:
del *.obj
if exist cv2pdb.exe del cv2pdb.exe
2 changes: 1 addition & 1 deletion src/dwarflines.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -365,7 +365,7 @@ bool interpretDWARFLines(const PEImage& img, mspdb::Mod* mod, DebugLevel debug_)
default:
fprintf(stderr, "%s:%d: ERROR: invalid form=%d for path lineHdrOffs=%x\n", __FUNCTION__, __LINE__,
typeForm.form, off);
assert(false, "invalid path form");
assert(false);
return false;
}
break;
Expand Down
2 changes: 1 addition & 1 deletion src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ int T_main(int argc, TCHAR* argv[])
// try DBG file alongside executable
changeExtension(dbgname, argv[1], TEXT(".dbg"));
struct _stat buffer;
if (T_stat(dbgname, &buffer) != 0)
if (_stat(dbgname, &buffer) != 0)
fatal(SARG ": no codeview debug entries found", argv[1]);
if (!dbg.loadExe(dbgname))
fatal(SARG ": %s", dbgname, dbg.getLastError());
Expand Down

0 comments on commit 66c4d1b

Please sign in to comment.