-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
34 lines (25 loc) · 986 Bytes
/
Makefile
File metadata and controls
34 lines (25 loc) · 986 Bytes
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
# This little makefile compiles a kernel32.dll replacement that DiscordMessenger can link against.
LIBNAME = dimeke32
XL = -Xlinker
MJSSV = $(XL) --major-subsystem-version $(XL)
MNSSV = $(XL) --minor-subsystem-version $(XL)
MJOSV = $(XL) --major-os-version $(XL)
MNOSV = $(XL) --minor-os-version $(XL)
# Give it a subsystem version of 3.10 and an OS version of 1.0
SSYSVER = $(MJSSV) 3 $(MNSSV) 10 $(MJOSV) 1 $(MNOSV) 0
HEADERS = src/forward.h
SOURCES = src/main.c src/forward.c src/hacks.c src/main.def src/reimpl.c
OBJECTS = $(patsubst src/%.c,bld/%.o,$(SOURCES))
.PHONY: clean
$(LIBNAME).dll: $(OBJECTS)
gcc -shared $^ -o $@ -O3 -ffreestanding -nodefaultlibs -nostartfiles -lkernel32 -luser32 -Wl,--enable-stdcall-fixup $(SSYSVER) -Wl,--out-implib,lib$(LIBNAME).a
bld/%.o: src/%.c $(HEADERS)
mkdir -p $(dir $@)
gcc -c $< -o $@
bld/%.o: src/%.S
mkdir -p $@
as $^ -o $@
clean:
rm -rf bld
rm -rf $(LIBNAME).dll
rm -rf lib$(LIBNAME).a