Skip to content

Commit 01ffa41

Browse files
committed
disas cpp
1 parent 54325d7 commit 01ffa41

File tree

6 files changed

+23
-36
lines changed

6 files changed

+23
-36
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
.vscode
22
*.exe
3+
*.o

disas-cpp/Makefile

Lines changed: 20 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,31 @@
1-
# folder names 'bin' and 'obj' are hardcoded
2-
# tdm-gcc
1+
# folder names 'obj' are hardcoded
32

4-
CCFLAGS = -D_GLIBCXX_DEBUG -O2 -std=c++14 -Wall -Wextra -Werror -pedantic
5-
CCFLAGS2 = -D_GLIBCXX_DEBUG -O2 -std=c++14 -Wall -Wextra -pedantic
3+
CXX ?= g++
4+
RM ?= rm -f
5+
CCFLAGS ?= -D_GLIBCXX_DEBUG -O2 -std=c++14 -Wall -Wextra -Werror -pedantic
6+
7+
_dummy := $(shell mkdir -p obj)
68

79
all: u8-disas u8-disas-split
810

911
u8-disas: nX-U8_is.txt main Makefile example.cpp
10-
main $< temp.cpp
11-
g++ $(CCFLAGS) temp.cpp -o $@
12-
del temp.cpp
12+
@main $< temp.cpp
13+
@$(CXX) $(CCFLAGS) temp.cpp -o $@
14+
@$(RM) temp.cpp
1315

1416
u8-disas-split: nX-U8_is_split.txt main Makefile example.cpp
15-
main $< temp.cpp
16-
g++ $(CCFLAGS) temp.cpp -o $@
17-
del temp.cpp
17+
@main $< temp.cpp
18+
@$(CXX) $(CCFLAGS) temp.cpp -o $@
19+
@$(RM) temp.cpp
1820

19-
u8-disas-brief: nX-U8_brief.txt main Makefile example.cpp
20-
main $< temp.cpp
21-
g++ $(CCFLAGS2) temp.cpp -o $@
22-
del temp.cpp
21+
main: obj/main.o obj/lib.o Makefile
22+
@$(CXX) obj/main.o obj/lib.o -o $@
2323

24-
main: main.cpp lib.h lib.cpp
25-
g++ $(CCFLAGS) main.cpp lib.cpp -o $@
24+
obj/%.o: %.cpp lib.h Makefile
25+
@$(CXX) -c $(CCFLAGS) $< -o $@
2626

2727
clean:
28-
if exist main.exe del main.exe
29-
if exist u8-disas.exe del u8-disas.exe
30-
if exist u8-disas-split.exe del u8-disas-split.exe
31-
if exist u8-disas-split.exe del u8-disas-brief.exe
32-
if exist temp.cpp del temp.cpp
28+
@$(RM) main.exe
29+
@$(RM) u8-disas.exe
30+
@$(RM) u8-disas-split.exe
31+
@$(RM) obj/*

disas-cpp/README.md

Lines changed: 0 additions & 13 deletions
This file was deleted.

disas-cpp/example.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
#include <string>
66
#include <deque>
77
#include <cstring>
8+
#include <cstdint>
89

910
#define ip (totallen - length - buf.size())
1011

disas-cpp/help.txt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@ Disassembler instruction_set_file_name.txt output_file_name.cpp
66

77
*
88

9-
??? disassembler
10-
119
Usage:
1210

1311
a.exe file_to_disassemble start_position length output_file_name.txt

disas-cpp/main.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
#include <fstream>
33
#include <string>
44
#include <cstring>
5+
#include <cstdint>
56
#include <sstream>
67
#include "lib.h"
78

0 commit comments

Comments
 (0)