-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmakefile
More file actions
42 lines (30 loc) · 1.3 KB
/
Copy pathmakefile
File metadata and controls
42 lines (30 loc) · 1.3 KB
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
# Compiler
CC := x86_64-w64-mingw32-g++
# Common flags
COMMON := -Iincludes -fno-exceptions -fno-rtti -fno-stack-protector
# Release flags
REL := -Os -s -fno-asynchronous-unwind-tables -fno-ident -ffunction-sections -fdata-sections
# Debug flags
DBG := -O0 -g -DDEBUG
# Linker flags (stub.bin removes DOS stub string)
LD_REL := -nostdlib -nostartfiles -nodefaultlibs -mwindows \
-Wl,--subsystem,windows -Wl,--entry,_Start -Wl,--gc-sections -Wl,--no-seh -Wl,-s
LD_DBG := -nostdlib -nostartfiles -nodefaultlibs -mconsole \
-Wl,--subsystem,console -Wl,--entry,_Start
LD_DLL := -nostdlib -nostartfiles -nodefaultlibs -shared \
-Wl,--entry,DllMain -Wl,--gc-sections -Wl,--no-seh -Wl,-s -Wl,--exclude-all-symbols
# Targets
all: release
release:
$(CC) $(REL) $(COMMON) $(LD_REL) -o bin/loader.exe src/*.cc
@python tools/strip_stub.py bin/loader.exe 2>nul || true
debug:
$(CC) $(DBG) $(COMMON) $(LD_DBG) -o bin/loader_dbg.exe src/*.cc
dll:
$(CC) $(REL) $(COMMON) $(LD_DLL) -DBUILD_DLL loader.def -o bin/loader.dll src/*.cc
@python tools/strip_stub.py bin/loader.dll 2>nul || true
dll_dbg:
$(CC) $(DBG) $(COMMON) -DBUILD_DLL -shared -nostdlib -nostartfiles -nodefaultlibs \
-Wl,--entry,DllMain -o bin/loader_dbg.dll src/*.cc
clean:
del bin\*.exe bin\*.dll 2>nul || true