-
Notifications
You must be signed in to change notification settings - Fork 82
/
Makefile
39 lines (28 loc) · 1.16 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
TARGET = hid
HELPER = helper
LEAK = leak
POC = poc
SRCDIR = src
MIGDIR = mig
OSFMK ?= /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include
CFLAGS ?= -O3 -Wall
.PHONY: all clean fullclean
all: $(TARGET) $(LEAK) $(POC)
$(TARGET): $(SRCDIR)/$(TARGET)/*.c $(SRCDIR)/$(HELPER)/$(HELPER)_bin.c $(MIGDIR)/iokitUser.c
$(CC) -o $@ $^ $(CFLAGS) -DIOKIT=1 -framework IOKit -framework CoreFoundation -I$(MIGDIR)
$(SRCDIR)/$(HELPER)/$(HELPER)_bin.c: $(SRCDIR)/$(HELPER)/$(HELPER)
cd $(SRCDIR)/$(HELPER) && xxd -i $(HELPER) > $(HELPER)_bin.c
$(SRCDIR)/$(HELPER)/$(HELPER): $(SRCDIR)/$(HELPER)/$(HELPER).c
$(CC) -o $@ $^ $(CFLAGS)
$(MIGDIR)/iokitUser.c: | $(MIGDIR)
cd $(MIGDIR) && mig -arch x86_64 -DIOKIT=1 $(OSFMK)/device/device.defs
$(MIGDIR):
mkdir $(MIGDIR)
$(LEAK): $(SRCDIR)/$(LEAK)/*.c $(MIGDIR)/iokitUser.c
$(CC) -o $@ $^ $(CFLAGS) -DIOKIT=1 -framework IOKit -framework CoreFoundation -I$(MIGDIR)
$(POC): $(SRCDIR)/$(POC)/*.c
$(CC) -o $@ $^ $(CFLAGS) -framework IOKit
clean:
rm -f $(TARGET) $(LEAK) $(POC) $(SRCDIR)/$(HELPER)/$(HELPER) $(SRCDIR)/$(HELPER)/$(HELPER)_bin.c
fullclean: clean
rm -rf $(MIGDIR)