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