]> git.saurik.com Git - cycript.git/blob - makefile
0e566fea7575d5392727e84bc3297d4d8d54c177
[cycript.git] / makefile
1 ifndef PKG_TARG
2 target :=
3 else
4 target := $(PKG_TARG)-
5 endif
6
7 package:
8
9 name := Cyrver
10 flags := -framework CFNetwork -framework JavaScriptCore -framework WebCore -install_name /usr/lib/libcyrver.dylib -I.
11 menes := $(shell cd ~; pwd)/menes
12
13 link := -framework CoreFoundation -framework Foundation -F${PKG_ROOT}/System/Library/PrivateFrameworks -L$(menes)/mobilesubstrate -lsubstrate -lapr-1 -lffi
14
15 all: $(name).dylib $(control)
16
17 clean:
18 rm -f $(name).dylib
19
20 $(name).dylib: Tweak.mm makefile $(menes)/mobilesubstrate/substrate.h sig/*.[ch]pp
21 $(target)g++ -save-temps -dynamiclib -mthumb -g0 -O2 -Wall -Werror -o $@ $(filter %.cpp,$^) $(filter %.mm,$^) -lobjc -I$(menes)/mobilesubstrate $(link) $(flags)
22 ldid -S $@
23
24 package: all
25 rm -rf package
26 mkdir -p package/DEBIAN
27 mkdir -p package/Library/MobileSubstrate/DynamicLibraries
28 cp -a control $(control) package/DEBIAN
29 if [[ -e Settings.plist ]]; then \
30 mkdir -p package/Library/PreferenceLoader/Preferences; \
31 cp -a Settings.png package/Library/PreferenceLoader/Preferences/$(name)Icon.png; \
32 cp -a Settings.plist package/Library/PreferenceLoader/Preferences/$(name).plist; \
33 fi
34 if [[ -e Tweak.plist ]]; then cp -a Tweak.plist package/Library/MobileSubstrate/DynamicLibraries/$(name).plist; fi
35 cp -a $(name).dylib package/Library/MobileSubstrate/DynamicLibraries
36 $(MAKE) extra
37 dpkg-deb -b package $(shell grep ^Package: control | cut -d ' ' -f 2-)_$(shell grep ^Version: control | cut -d ' ' -f 2)_iphoneos-arm.deb
38
39 extra:
40
41 %: %.mm
42 $(target)g++ -o $@ -Wall -Werror $< -lobjc -framework CoreFoundation -framework Foundation
43
44 .PHONY: all clean extra package
45
46 all: cyrver
47
48 extra:
49 mkdir -p package/usr/{bin,lib}
50 mv package/Library/MobileSubstrate/DynamicLibraries/Cyrver.dylib package/usr/lib/libcyrver.dylib
51 ln -s /usr/lib/libcyrver.dylib package/Library/MobileSubstrate/DynamicLibraries/Cyrver.dylib
52 cp -a cyrver package/usr/bin
53
54 cyrver: Application.mm Cyrver.dylib
55 $(target)g++ -g0 -O2 -Wall -Werror -o $@ $(filter %.mm,$^) -framework UIKit -framework Foundation -framework CoreFoundation -lobjc Cyrver.dylib -framework JavaScriptCore -F${PKG_ROOT}/System/Library/PrivateFrameworks
56 ldid -S cyrver