-
Notifications
You must be signed in to change notification settings - Fork 16
/
Makefile
67 lines (55 loc) · 1.23 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
#
# Builds the shellcode for AMD64/x86.
#
CC_X64 := x86_64-w64-mingw32-gcc
CC_X86 := i686-w64-mingw32-gcc
LINK64 := misc/link_x64.ld
LINK32 := misc/link_x86.ld
OUTX64 := patch.x64.exe
OUTX86 := patch.x86.exe
EXTX64 := EntryPointSc.x64.o
EXTX86 := EntryPointSc.x86.o
BINX64 := patch.x64.bin
BINX86 := patch.x86.bin
SOURCE := source/*.c
EXTASM := source/asm/EntryPointSc.asm
CFLAGS := -ffunction-sections -Os -fno-asynchronous-unwind-tables
CFLAGS := $(CFLAGS) -nostdlib -fno-ident -fno-align-functions
CFLAGS := $(CFLAGS) -falign-functions=1 -fpack-struct=8
LFLAGS := -Wl,-s,--no-seh,--enable-stdcall-fixup
all: $(EXTX86) $(EXTX64) $(OUTX86) $(OUTX64) $(BINX86) $(BINX64)
python3 misc/create_transform_block.py $(BINX64) $(BINX86)
clean:
rm -rf $(OUTX64) $(OUTX86)
rm -rf $(EXTX64) $(EXTX86)
rm -rf $(BINX64) $(BINX86)
#
# x86 BIN
#
$(BINX86):
python3 misc/pedump.py $(OUTX86) $@
#
# x86 OBJ
#
$(EXTX86):
nasm -f win32 $(EXTASM) -o $@
#
# x86 EXE
#
$(OUTX86):
$(CC_X86) $(SOURCE) $(EXTX86) -o $@ $(CFLAGS) $(LFLAGS),-T$(LINK32)
#
# x64 BIN
#
$(BINX64):
python3 misc/pedump.py $(OUTX64) $@
#
# x64 OBJ
#
$(EXTX64):
nasm -f win64 $(EXTASM) -o $@
#
# x64 EXE
#
$(OUTX64):
$(CC_X64) $(SOURCE) $(EXTX64) -o $@ $(CFLAGS) $(LFLAGS),-T$(LINK64)