]>
Commit | Line | Data |
---|---|---|
ea2d184c JF |
1 | ifndef PKG_TARG |
2 | target := | |
3 | else | |
4 | target := $(PKG_TARG)- | |
5 | endif | |
6 | ||
62ca2b82 JF |
7 | package: |
8 | ||
5999c315 | 9 | flags := -mthumb -g3 -O0 -Wall -Werror -I. |
ea2d184c | 10 | |
262e358c | 11 | all: cycript libcycript.dylib libcycript.plist |
ea2d184c JF |
12 | |
13 | clean: | |
5999c315 | 14 | rm -f *.o libcycript.dylib cycript libcycript.plist Struct.hpp lex.cy.c Cycript.tab.cc Cycript.tab.hh location.hh position.hh |
ea2d184c | 15 | |
5999c315 | 16 | libcycript.plist: Bridge.def |
707bcb93 | 17 | sed -e 's/^C/0/;s/^F/1/;s/^V/2/' Bridge.def | while read -r line; do \ |
88c977fa JF |
18 | if [[ $$line == '' ]]; then \ |
19 | continue; \ | |
20 | fi; \ | |
21 | set $$line; \ | |
22 | if [[ $$1 =~ [#fl] ]]; then \ | |
23 | continue; \ | |
24 | fi; \ | |
25 | echo "$$2 = ($$1, \"$$3\");"; \ | |
26 | done >$@ | |
27 | ||
5999c315 | 28 | Cycript.tab.cc Cycript.tab.hh location.hh position.hh: Cycript.y |
c3c20102 | 29 | bison --report=state $< |
e5332278 JF |
30 | |
31 | lex.cy.c: Cycript.l | |
32 | flex $< | |
33 | ||
04450da0 JF |
34 | Struct.hpp: |
35 | $$($(target)gcc -print-prog-name=cc1obj) -print-objc-runtime-info </dev/null >$@ | |
36 | ||
e5332278 JF |
37 | #Parser.hpp: Parser.py Parser.dat |
38 | # ./Parser.py <Parser.dat >$@ | |
39 | ||
5999c315 JF |
40 | %.o: sig/%.cpp |
41 | $(target)g++ -c -o $@ $< $(flags) | |
42 | ||
43 | Cycript.tab.o: Cycript.tab.cc Cycript.tab.hh Parser.hpp Pooling.hpp | |
44 | $(target)g++ -c -o $@ $< $(flags) | |
45 | ||
46 | lex.cy.o: lex.cy.c Cycript.tab.hh Parser.hpp Pooling.hpp | |
47 | $(target)g++ -c -o $@ $< $(flags) | |
48 | ||
49 | Output.o: Output.cpp Parser.hpp Pooling.hpp | |
50 | $(target)g++ -c -o $@ $< $(flags) | |
51 | ||
52 | Library.o: Library.mm Cycript.tab.hh Parser.hpp Pooling.hpp Struct.hpp | |
53 | $(target)g++ -c -o $@ $< $(flags) | |
54 | ||
55 | libcycript.dylib: ffi_type.o parse.o Output.o Cycript.tab.o lex.cy.o Library.o | |
56 | $(target)g++ -I. -dynamiclib -mthumb -g3 -O0 -Wall -Werror -o $@ $(filter %.o,$^) -lobjc -framework CFNetwork -framework JavaScriptCore -framework WebCore -install_name /usr/lib/libcycript.dylib -framework CoreFoundation -framework Foundation -F${PKG_ROOT}/System/Library/PrivateFrameworks -L$(menes)/mobilesubstrate -lsubstrate -lapr-1 -lffi | |
ea2d184c JF |
57 | ldid -S $@ |
58 | ||
262e358c | 59 | cycript: Application.mm libcycript.dylib |
8d9b5eed | 60 | $(target)g++ -g0 -O2 -Wall -Werror -o $@ $(filter %.mm,$^) -framework UIKit -framework Foundation -framework CoreFoundation -lobjc libcycript.dylib |
262e358c JF |
61 | ldid -S cycript |
62 | ||
ea2d184c JF |
63 | package: all |
64 | rm -rf package | |
65 | mkdir -p package/DEBIAN | |
88c977fa | 66 | cp -a control package/DEBIAN |
ea2d184c | 67 | mkdir -p package/Library/MobileSubstrate/DynamicLibraries |
ea2d184c JF |
68 | if [[ -e Settings.plist ]]; then \ |
69 | mkdir -p package/Library/PreferenceLoader/Preferences; \ | |
262e358c JF |
70 | cp -a Settings.png package/Library/PreferenceLoader/Preferences/CycriptIcon.png; \ |
71 | cp -a Settings.plist package/Library/PreferenceLoader/Preferences/Cycript.plist; \ | |
ea2d184c | 72 | fi |
262e358c JF |
73 | if [[ -e Tweak.plist ]]; then cp -a Tweak.plist package/Library/MobileSubstrate/DynamicLibraries/Cycript.plist; fi |
74 | #cp -a Cycript.dylib package/Library/MobileSubstrate/DynamicLibraries | |
62ca2b82 | 75 | mkdir -p package/usr/{bin,lib} |
262e358c | 76 | cp -a libcycript.dylib package/usr/lib |
a2d9403c | 77 | #ln -s /usr/lib/libcycript.dylib package/Library/MobileSubstrate/DynamicLibraries/Cycript.dylib |
107e3ed0 JF |
78 | cp -a cycript package/usr/bin |
79 | cp -a libcycript.plist package/usr/lib | |
88c977fa JF |
80 | dpkg-deb -b package $(shell grep ^Package: control | cut -d ' ' -f 2-)_$(shell grep ^Version: control | cut -d ' ' -f 2)_iphoneos-arm.deb |
81 | ||
1dbba6cc JF |
82 | test: package |
83 | dpkg -i $(shell grep ^Package: control | cut -d ' ' -f 2-)_$(shell grep ^Version: control | cut -d ' ' -f 2)_iphoneos-arm.deb | |
84 | cycript | |
85 | ||
88c977fa | 86 | .PHONY: all clean extra package |