-
Notifications
You must be signed in to change notification settings - Fork 60
/
Makefile
39 lines (30 loc) · 956 Bytes
/
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
NAME := DisableTurboBoost
#KEXT := /System/Library/Extensions/$(NAME).kext
KEXT := /tmp/$(NAME).kext
DIR := Contents/MacOS
BIN := $(DIR)/$(NAME)
INFO := Contents/Info.plist
# detect current kernel architecture
CPU := $(shell uname -m)
ifeq ($(CPU),i386)
CPPFLAGS += -m32
else
ifeq ($(CPU),x86_64)
CPPFLAGS += -m64
endif
endif
KERNELDIR := $(shell xcrun --sdk macosx --show-sdk-path)/System/Library/Frameworks/Kernel.framework/Headers
$(BIN): $(DIR) $(NAME).c Makefile
$(CC) $(CFLAGS) $(CPPFLAGS) $(MARCH) -Xlinker -kext --include-directory=$(KERNELDIR) -static $(NAME).c -o $@ -fno-builtin -nostdlib -lkmod -r -Wall
$(DIR):; mkdir -p $(DIR)
load: $(KEXT) $(KEXT)/$(BIN) $(KEXT)/$(INFO)
sudo chown -R root:wheel $(KEXT)
sudo kextutil -v $(KEXT)
unload:
sudo kextunload -v $(KEXT)
$(KEXT):; mkdir -p $@
$(KEXT)/$(DIR):; mkdir -p $@
$(KEXT)/$(INFO): $(KEXT) $(INFO)
sudo cp $(INFO) $@
$(KEXT)/$(BIN): $(KEXT)/$(DIR) $(BIN)
sudo cp $(BIN) $@