-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathMakefile
More file actions
80 lines (62 loc) · 2.08 KB
/
Copy pathMakefile
File metadata and controls
80 lines (62 loc) · 2.08 KB
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
68
69
70
71
72
73
74
75
76
77
78
79
# Rust library
RUST_PROFILE ?= release
# For Linux builds (xcrun is not available on Linux)
# Auto-detect the latest SDK in THEOS
ifndef SDKROOT
THEOS_SDKS := $(wildcard $(THEOS)/sdks/iPhoneOS*.sdk)
ifneq ($(THEOS_SDKS),)
export SDKROOT := $(lastword $(sort $(THEOS_SDKS)))
endif
endif
# Enable with dev-release profile logging
ifeq ($(RUST_PROFILE),dev-release)
export RUSTFLAGS += --cfg dev_release
endif
# Auto-detect sccache for faster rebuilds
SCCACHE := $(shell command -v sccache 2> /dev/null)
ifdef SCCACHE
export RUSTC_WRAPPER := sccache
endif
before-all::
@printf "\033[1;36m==>\033[0m Building Rust library...\n"
env -u SDKROOT cargo build --profile $(RUST_PROFILE) --target aarch64-apple-ios
ARCHS = arm64
FINALPACKAGE = 1
THEOS_DYLIB := .theos/obj/arm64/alloy.dylib
TARGET ?= iphone:clang:latest:latest
# Uncomment the following for roothide builds
# THEOS_PACKAGE_SCHEME = roothide
include $(THEOS)/makefiles/common.mk
TWEAK_NAME = alloy
RUST_LIB := target/aarch64-apple-ios/$(RUST_PROFILE)/liballoy.a
${TWEAK_NAME}_CFLAGS = -fobjc-arc
${TWEAK_NAME}_LDFLAGS = -force_load $(RUST_LIB)
${TWEAK_NAME}_FRAMEWORKS = UIKit Foundation CoreGraphics QuartzCore
${TWEAK_NAME}_LIBRARIES = objc
include $(THEOS_MAKE_PATH)/tweak.mk
clean::
rm -rf .theos packages
cargo clean
fmt:
@printf "\033[1;36m==>\033[0m Formatting Rust code...\n"
cargo fmt
clippy:
@printf "\033[1;36m==>\033[0m Running Clippy...\n"
cargo clippy --all-targets --all-features -- -D warnings
deploy:
@$(MAKE) fmt
@$(MAKE) rust-build
@if [ ! -f "$(THEOS_DYLIB)" ] || [ "$(RUST_LIB)" -nt "$(THEOS_DYLIB)" ]; then \
printf "\033[1;36m==>\033[0m Rust lib changed, re-linking...\n"; \
$(MAKE) theos-link; \
else \
printf "\033[1;36m==>\033[0m Dylib up-to-date, skipping link\n"; \
fi
@$(MAKE) package
@printf "\033[1;36m==>\033[0m Deploy complete!\n"
rust-build:
@printf "\033[1;36m==>\033[0m Building Rust library...\n"
@env -u SDKROOT cargo build --profile $(RUST_PROFILE) --target aarch64-apple-ios
theos-link:
@find .theos/obj -name "*.dylib" -delete 2>/dev/null || true
@$(MAKE) all