-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathMakefile
29 lines (20 loc) · 957 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
TARGET := IOKernelRW
SRC := src
# Don't use ?= with $(shell ...)
ifndef CXX_FLAGS
CXX_FLAGS := --std=gnu++17 -Wall -O3 -nostdinc -nostdlib -mkernel -DKERNEL -isystem $(shell xcrun --show-sdk-path)/System/Library/Frameworks/Kernel.framework/Headers -Wl,-kext -lcc_kext $(CXXFLAGS)
endif
.PHONY: all install clean
all: $(TARGET).kext/Contents/_CodeSignature/CodeResources
$(TARGET).kext/Contents/MacOS/$(TARGET): $(SRC)/*.cpp $(SRC)/*.h | $(TARGET).kext/Contents/MacOS
$(CXX) -arch arm64e -arch x86_64 -o $@ $(SRC)/*.cpp $(CXX_FLAGS)
$(TARGET).kext/Contents/Info.plist: misc/Info.plist | $(TARGET).kext/Contents
cp -f $^ $@
$(TARGET).kext/Contents/_CodeSignature/CodeResources: $(TARGET).kext/Contents/MacOS/$(TARGET) $(TARGET).kext/Contents/Info.plist
codesign -s - -f $(TARGET).kext
$(TARGET).kext/Contents $(TARGET).kext/Contents/MacOS:
mkdir -p $@
install: all
sudo cp -R $(TARGET).kext /Library/Extensions/
clean:
rm -rf $(TARGET).kext