forked from kpwn/uikittools-ng
-
Notifications
You must be signed in to change notification settings - Fork 14
/
Makefile
124 lines (96 loc) · 3.99 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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
CC ?= xcrun -sdk iphoneos clang -arch arm64 -miphoneos-version-min=11.0
CFLAGS ?=
LDFLAGS ?=
STRIP ?= strip
LDID ?= ldid
ifneq (,$(findstring bridgeos,$(CC) $(CFLAGS)))
ALL := ldrestart mgask
else ifneq (,$(findstring iphoneos,$(CC) $(CFLAGS)))
ALL := ldrestart sbdidlaunch sbreload uicache uiopen deviceinfo uialert uishoot uinotify uisave lsrebuild uidisplay mgask
else ifneq (,$(findstring appletvos,$(CC) $(CFLAGS)))
ALL := ldrestart sbreload uicache uiopen deviceinfo uialert uishoot lsrebuild mgask
else
ALL := deviceinfo uialert mgask
endif
MAN := $(patsubst %,%.1,$(ALL))
MANLANGS := zh_CN zh_TW
ifeq ($(NLS),1)
ifneq ($(LOCALEDIR),)
CFLAGS += -DLOCALEDIR=\"$(LOCALEDIR)\"
endif
CFLAGS += -DNLS=1
LDFLAGS += -lintl
else
CFLAGS += -DNLS=0
endif
CFLAGS += -Wno-unguarded-availability-new
APP_PATH ?= $(MEMO_PREFIX)/Applications
all: sign po
sign: $(ALL)
$(STRIP) $(ALL)
ifeq (,$(findstring macosx,$(CC) $(CFLAGS)))
for tool in $(ALL); do \
if [ -f $$tool.plist ]; then \
$(LDID) -S$${tool}.plist $$tool; \
else \
$(LDID) -Sent.plist $$tool; \
fi; \
done
endif
ldrestart: ldrestart.c ent.plist
$(CC) -fobjc-arc $(CFLAGS) $< -o $@ $(LDFLAGS)
sbdidlaunch: sbdidlaunch.c ent.plist
$(CC) -fobjc-arc $(CFLAGS) $< -o $@ $(LDFLAGS) -framework CoreFoundation
uialert: uialert.m strtonum.c ent.plist
$(CC) -fobjc-arc $(CFLAGS) $< $(word 2,$^) -o $@ $(LDFLAGS) -framework CoreFoundation
sbreload: sbreload.m sbreload-launchd.c sbreload.plist
$(CC) -fobjc-arc $(CFLAGS) $< $(word 2,$^) -o $@ $(LDFLAGS) -framework Foundation
uicache: uicache.m uicache.plist
$(CC) -fobjc-arc $(CFLAGS) $< -o $@ -framework Foundation $(LDFLAGS) -FFrameworks -framework MobileCoreServices -framework Security -framework MobileContainerManager -DAPP_PATH="@\"$(APP_PATH)\""
uiopen: uiopen.m ent.plist
$(CC) -fobjc-arc $(CFLAGS) $< -o $@ $(LDFLAGS) -framework Foundation -framework MobileCoreServices
uishoot: uishoot.m strtonum.c uishoot.plist
$(CC) -fobjc-arc $(CFLAGS) $< $(word 2,$^) -o $@ $(LDFLAGS) -framework ImageIO -framework Photos -framework UIKit
uinotify: uinotify.m strtonum.c uinotify.plist
$(CC) -fobjc-arc $(CFLAGS) $< $(word 2,$^) -o $@ $(LDFLAGS) -framework UserNotifications
uisave: uisave.m uisave.plist
$(CC) -fobjc-arc $(CFLAGS) $< -o $@ $(LDFLAGS) -framework Foundation -framework Photos -framework UIKit
lsrebuild: lsrebuild.m lsrebuild.plist
$(CC) -fobjc-arc $(CFLAGS) $< -o $@ $(LDFLAGS) -framework Foundation -framework MobileCoreServices
uidisplay: uidisplay.m strtonum.c uidisplay.plist
$(CC) -fobjc-arc $(CFLAGS) $< $(word 2,$^) -o $@ $(LDFLAGS) -framework Foundation -lAccessibility -framework UIKit -framework CoreGraphics -framework IOKit
deviceinfo: info/deviceinfo.c info/ecid.m info/uid.m info/serial.m info/locale.m info/cfversion.c
$(CC) -fobjc-arc $(CFLAGS) $^ -o $@ $(LDFLAGS) -framework CoreFoundation -lMobileGestalt
mgask: mgask.m mgask.plist
$(CC) -fobjc-arc $(CFLAGS) $< -o $@ $(LDFLAGS) -framework CoreFoundation -framework Foundation -lMobileGestalt
install: $(ALL) sign install-po
install -d $(DESTDIR)$(PREFIX)/bin/
install -m755 $(ALL) $(DESTDIR)$(PREFIX)/bin/
ifneq ($(NO_COMPAT),1)
ln -sf deviceinfo $(DESTDIR)$(PREFIX)/bin/cfversion
ln -sf deviceinfo $(DESTDIR)$(PREFIX)/bin/uiduid
ln -sf deviceinfo $(DESTDIR)$(PREFIX)/bin/ecidecid
ln -sf mgask $(DESTDIR)$(PREFIX)/bin/gssc
endif
install -d $(DESTDIR)$(PREFIX)/share/man/man1/
install -m644 $(patsubst %,man/%,$(MAN)) $(DESTDIR)$(PREFIX)/share/man/man1/
for lang in $(MANLANGS); do \
install -d $(DESTDIR)$(PREFIX)/share/man/$$lang/man1/; \
install -m644 $(patsubst %,man/$$lang/%,$(MAN)) $(DESTDIR)$(PREFIX)/share/man/$$lang/man1/ || true; \
done
po:
ifeq ($(NLS),1)
$(MAKE) -C po
endif
install-po: po
ifeq ($(NLS),1)
$(MAKE) -C po install LOCALEDIR="$(LOCALEDIR)"
endif
clean:
rm -rf $(ALL) *.dSYM
$(MAKE) -C po clean
format:
find . -type f -name '*.[cm]' -exec clang-format -i {} \;
man-lint:
find man -type f -name '*.[1-9]' -exec mandoc -Tlint {} \;
.PHONY: all clean install sign format po install-po man-lint