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