9 flags := -mthumb -g0 -O3 -Wall -Werror -I.
11 all: cycript libcycript.dylib libcycript.plist
14 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
16 libcycript.plist: Bridge.def
17 sed -e 's/^C/0/;s/^F/1/;s/^V/2/' Bridge.def | while read -r line; do \
18 if [[ $$line == '' ]]; then \
22 if [[ $$1 =~ [#fl] ]]; then \
25 echo "$$2 = ($$1, \"$$3\");"; \
28 Cycript.tab.cc Cycript.tab.hh location.hh position.hh: Cycript.y
29 bison --report=state $<
35 $$($(target)gcc -print-prog-name=cc1obj) -print-objc-runtime-info </dev/null >$@
37 #Parser.hpp: Parser.py Parser.dat
38 # ./Parser.py <Parser.dat >$@
41 $(target)g++ $(flags) -c -o $@ $<
43 Cycript.tab.o: Cycript.tab.cc Cycript.tab.hh Parser.hpp Pooling.hpp
44 $(target)g++ $(flags) -c -o $@ $<
46 lex.cy.o: lex.cy.c Cycript.tab.hh Parser.hpp Pooling.hpp
47 $(target)g++ $(flags) -c -o $@ $<
49 Output.o: Output.cpp Parser.hpp Pooling.hpp
50 $(target)g++ $(flags) -c -o $@ $<
52 Library.o: Library.mm Cycript.tab.hh Parser.hpp Pooling.hpp Struct.hpp
53 $(target)g++ $(flags) -c -o $@ $<
55 libcycript.dylib: ffi_type.o parse.o Output.o Cycript.tab.o lex.cy.o Library.o
56 $(target)g++ $(flags) -dynamiclib -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
59 cycript: Application.mm libcycript.dylib
60 $(target)g++ $(flags) -o $@ $(filter %.mm,$^) -framework UIKit -framework Foundation -framework CoreFoundation -lobjc libcycript.dylib
65 mkdir -p package/DEBIAN
66 cp -a control package/DEBIAN
67 mkdir -p package/Library/MobileSubstrate/DynamicLibraries
68 if [[ -e Settings.plist ]]; then \
69 mkdir -p package/Library/PreferenceLoader/Preferences; \
70 cp -a Settings.png package/Library/PreferenceLoader/Preferences/CycriptIcon.png; \
71 cp -a Settings.plist package/Library/PreferenceLoader/Preferences/Cycript.plist; \
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
75 mkdir -p package/usr/{bin,lib}
76 cp -a libcycript.dylib package/usr/lib
77 #ln -s /usr/lib/libcycript.dylib package/Library/MobileSubstrate/DynamicLibraries/Cycript.dylib
78 cp -a cycript package/usr/bin
79 cp -a libcycript.plist package/usr/lib
80 dpkg-deb -b package $(shell grep ^Package: control | cut -d ' ' -f 2-)_$(shell grep ^Version: control | cut -d ' ' -f 2)_iphoneos-arm.deb
83 dpkg -i $(shell grep ^Package: control | cut -d ' ' -f 2-)_$(shell grep ^Version: control | cut -d ' ' -f 2)_iphoneos-arm.deb
86 .PHONY: all clean extra package