forked from koekeishiya/yabai
-
Notifications
You must be signed in to change notification settings - Fork 0
/
makefile
67 lines (53 loc) · 3.01 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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
FRAMEWORK_PATH = -F/System/Library/PrivateFrameworks
FRAMEWORK = -framework Carbon -framework Cocoa -framework CoreServices -framework CoreVideo -framework SkyLight
BUILD_FLAGS = -std=c99 -Wall -g -O0 -fvisibility=hidden -mmacosx-version-min=11.0 -fno-objc-arc -arch x86_64 -arch arm64 -sectcreate __TEXT __info_plist $(INFO_PLIST)
BUILD_PATH = ./bin
DOC_PATH = ./doc
SCRIPT_PATH = ./scripts
ASSET_PATH = ./assets
SMP_PATH = ./examples
ARCH_PATH = ./archive
OSAX_SRC = ./src/osax/payload_bin.c ./src/osax/loader_bin.c
YABAI_SRC = ./src/manifest.m $(OSAX_SRC)
OSAX_PATH = ./src/osax
INFO_PLIST = $(ASSET_PATH)/Info.plist
BINS = $(BUILD_PATH)/yabai
.PHONY: all asan tsan install man icon archive publish sign clean-build clean
all: clean-build $(BINS)
asan: BUILD_FLAGS=-std=c99 -Wall -g -O0 -fvisibility=hidden -fsanitize=address,undefined -mmacosx-version-min=11.0 -fno-objc-arc -arch x86_64 -arch arm64 -sectcreate __TEXT __info_plist $(INFO_PLIST)
asan: clean-build $(BINS)
tsan: BUILD_FLAGS=-std=c99 -Wall -g -O0 -fvisibility=hidden -fsanitize=thread,undefined -mmacosx-version-min=11.0 -fno-objc-arc -arch x86_64 -arch arm64 -sectcreate __TEXT __info_plist $(INFO_PLIST)
tsan: clean-build $(BINS)
install: BUILD_FLAGS=-std=c99 -Wall -DNDEBUG -O2 -fvisibility=hidden -mmacosx-version-min=11.0 -fno-objc-arc -arch x86_64 -arch arm64 -sectcreate __TEXT __info_plist $(INFO_PLIST)
install: clean-build $(BINS)
$(OSAX_SRC): $(OSAX_PATH)/loader.m $(OSAX_PATH)/payload.m
xcrun clang $(OSAX_PATH)/payload.m -shared -fPIC -O2 -mmacosx-version-min=11.0 -arch x86_64 -arch arm64e -o $(OSAX_PATH)/payload $(FRAMEWORK_PATH) -framework SkyLight -framework Foundation -framework Carbon
xcrun clang $(OSAX_PATH)/loader.m -O2 -mmacosx-version-min=11.0 -arch x86_64 -arch arm64e -o $(OSAX_PATH)/loader -framework Cocoa
xxd -i -a $(OSAX_PATH)/payload $(OSAX_PATH)/payload_bin.c
xxd -i -a $(OSAX_PATH)/loader $(OSAX_PATH)/loader_bin.c
rm -f $(OSAX_PATH)/payload
rm -f $(OSAX_PATH)/loader
man:
asciidoctor -b manpage $(DOC_PATH)/yabai.asciidoc -o $(DOC_PATH)/yabai.1
icon:
python3 $(SCRIPT_PATH)/seticon.py $(ASSET_PATH)/icon/2x/[email protected] $(BUILD_PATH)/yabai
publish:
sed -i '' "60s/^VERSION=.*/VERSION=\"$(shell $(BUILD_PATH)/yabai --version | cut -d "v" -f 2)\"/" $(SCRIPT_PATH)/install.sh
sed -i '' "61s/^EXPECTED_HASH=.*/EXPECTED_HASH=\"$(shell shasum -a 256 $(BUILD_PATH)/$(shell $(BUILD_PATH)/yabai --version).tar.gz | cut -d " " -f 1)\"/" $(SCRIPT_PATH)/install.sh
archive: man install sign icon
rm -rf $(ARCH_PATH)
mkdir -p $(ARCH_PATH)
cp -r $(BUILD_PATH) $(ARCH_PATH)/
cp -r $(DOC_PATH) $(ARCH_PATH)/
cp -r $(SMP_PATH) $(ARCH_PATH)/
tar -cvzf $(BUILD_PATH)/$(shell $(BUILD_PATH)/yabai --version).tar.gz $(ARCH_PATH)
rm -rf $(ARCH_PATH)
sign:
codesign -fs "yabai-cert" $(BUILD_PATH)/yabai
clean-build:
rm -rf $(BUILD_PATH)
clean: clean-build
rm -f $(OSAX_SRC)
$(BUILD_PATH)/yabai: $(YABAI_SRC)
mkdir -p $(BUILD_PATH)
xcrun clang $^ $(BUILD_FLAGS) $(FRAMEWORK_PATH) $(FRAMEWORK) -o $@