forked from jkcoxson/em_proxy
-
Notifications
You must be signed in to change notification settings - Fork 8
/
Makefile
126 lines (109 loc) · 3.27 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
125
126
TARGET="em_proxy"
add_targets:
@echo "add_targets"
rustup target add aarch64-apple-ios aarch64-apple-ios-sim x86_64-apple-ios
build:
@echo "build aarch64-apple-ios"
@cargo build --release --target aarch64-apple-ios
@echo "lipo"
@lipo -create \
-output target/lib$(TARGET)-ios.a \
target/aarch64-apple-ios/release/lib$(TARGET).a
@echo "build aarch64-apple-ios-sim"
@cargo build --release --target aarch64-apple-ios-sim
@echo "build x86_64-apple-ios"
@cargo build --release --target x86_64-apple-ios
@lipo -create \
-output target/lib$(TARGET)-sim.a \
target/aarch64-apple-ios-sim/release/lib$(TARGET).a \
target/x86_64-apple-ios/release/lib$(TARGET).a
clean:
@echo "clean"
@if [ -d "include" ]; then \
echo "cleaning include"; \
rm -r include; \
fi
@if [ -d "target" ]; then \
echo "cleaning target"; \
rm -r target; \
fi
@if [ -d "$(TARGET).xcframework" ]; then \
echo "cleaning $(TARGET).xcframework"; \
rm -r $(TARGET).xcframework; \
fi
@if [ -f "$(TARGET).xcframework.zip" ]; then \
echo "cleaning $(TARGET).xcframework.zip"; \
rm $(TARGET).xcframework.zip; \
fi
xcframework: build
@echo "xcframework"
@if [ -d "include" ]; then \
echo "cleaning include"; \
rm -rf include; \
fi
@mkdir include
@mkdir include/$(TARGET)
@cp $(TARGET).h include/$(TARGET)
@cp module.modulemap include/$(TARGET)
@if [ -d "$(TARGET).xcframework" ]; then \
echo "cleaning $(TARGET).xcframework"; \
rm -rf $(TARGET).xcframework; \
fi
@xcodebuild \
-create-xcframework \
-library target/aarch64-apple-ios/release/lib$(TARGET).a \
-headers include/ \
-library target/lib$(TARGET)-sim.a \
-headers include/ \
-output $(TARGET).xcframework
xcframework_frameworks: build
@echo "xcframework_frameworks"
@if [ -d "include" ]; then \
echo "cleaning include"; \
rm -rf include; \
fi
@mkdir include
@mkdir include/$(TARGET)
@cp $(TARGET).h include/$(TARGET)
@cp module.modulemap include/$(TARGET)
@if [ -d "target/ios" ]; then \
echo "cleaning target/ios"; \
rm -rf target/ios; \
fi
@mkdir target/ios
@mkdir target/ios/$(TARGET).framework
@mkdir target/ios/$(TARGET).framework/Headers
@if [ -d "target/sim" ]; then \
echo "cleaning target/sim"; \
rm -rf target/sim; \
fi
@mkdir target/sim
@mkdir target/sim/$(TARGET).framework
@mkdir target/sim/$(TARGET).framework/Headers
@cp include/*.* target/ios/$(TARGET).framework/Headers
@libtool -static \
-o target/ios/$(TARGET).framework/$(TARGET) \
target/lib$(TARGET)-ios.a
@cp include/*.* target/sim/$(TARGET).framework/Headers
@xcrun \
-sdk iphonesimulator \
libtool -static \
-o target/sim/$(TARGET).framework/$(TARGET) \
target/lib$(TARGET)-sim.a
@if [ -d "$(TARGET).xcframework" ]; then \
echo "cleaning $(TARGET).xcframework"; \
rm -rf $(TARGET).xcframework; \
fi
@xcodebuild -create-xcframework \
-library target/sim/$(TARGET).framework \
-headers include/ \
-library target/ios/$(TARGET).framework \
-headers include/ \
-output $(TARGET).xcframework
zip: xcframework
@echo "zip"
@if [ -f "$(TARGET).xcframework.zip" ]; then \
echo "cleaning $(TARGET).xcframework.zip"; \
rm $(TARGET).xcframework.zip; \
fi
zip -r $(TARGET).xcframework.zip $(TARGET).xcframework