9 flags := -mthumb -g3 -O0 -Wall -Werror -I. -fno-common
10 flags += -F${PKG_ROOT}/System/Library/PrivateFrameworks
12 all: cycript libcycript.dylib libcycript.plist
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
17 libcycript.plist: Bridge.def
19 sed -e 's/^C/0/;s/^F/1/;s/^V/2/' Bridge.def | while read -r line; do \
20 if [[ $$line == '' ]]; then \
24 if [[ $$1 =~ [#fl:] ]]; then \
27 echo "$$2 = ($$1, \"$$3\");"; \
29 grep ^: Bridge.def | sed -e 's/^: \([^ ]*\) \(.*\)/":\1" = "\2";/'; \
32 Cycript.tab.cc Cycript.tab.hh location.hh position.hh: Cycript.y
33 bison -v --report=state $<
39 $$($(target)gcc -print-prog-name=cc1obj) -print-objc-runtime-info </dev/null >$@
41 #Parser.hpp: Parser.py Parser.dat
42 # ./Parser.py <Parser.dat >$@
45 $(target)g++ $(flags) -c -o $@ $<
47 Cycript.tab.o: Cycript.tab.cc Cycript.tab.hh Parser.hpp Pooling.hpp
48 $(target)g++ $(flags) -c -o $@ $<
50 lex.cy.o: lex.cy.c Cycript.tab.hh Parser.hpp Pooling.hpp
51 $(target)g++ $(flags) -c -o $@ $<
53 Output.o: Output.cpp Parser.hpp Pooling.hpp
54 $(target)g++ $(flags) -c -o $@ $<
56 Library.o: Library.mm Cycript.tab.hh Parser.hpp Pooling.hpp Struct.hpp cycript.hpp
57 $(target)g++ $(flags) -c -o $@ $<
59 Application.o: Application.mm Cycript.tab.hh Parser.hpp Pooling.hpp cycript.hpp
60 $(target)g++ $(flags) -c -o $@ $<
62 libcycript.dylib: ffi_type.o parse.o Output.o Cycript.tab.o lex.cy.o Library.o
63 $(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
66 cycript: Application.o libcycript.dylib
67 $(target)g++ $(flags) -o $@ $(filter %.o,$^) -framework UIKit -framework Foundation -framework CoreFoundation -lobjc libcycript.dylib -lreadline -framework JavaScriptCore -lapr-1
72 mkdir -p package/DEBIAN
73 cp -a control package/DEBIAN
74 mkdir -p package/Library/MobileSubstrate/DynamicLibraries
75 if [[ -e Settings.plist ]]; then \
76 mkdir -p package/Library/PreferenceLoader/Preferences; \
77 cp -a Settings.png package/Library/PreferenceLoader/Preferences/CycriptIcon.png; \
78 cp -a Settings.plist package/Library/PreferenceLoader/Preferences/Cycript.plist; \
80 if [[ -e Tweak.plist ]]; then cp -a Tweak.plist package/Library/MobileSubstrate/DynamicLibraries/Cycript.plist; fi
81 #cp -a Cycript.dylib package/Library/MobileSubstrate/DynamicLibraries
82 mkdir -p package/usr/{bin,lib}
83 cp -a libcycript.dylib package/usr/lib
84 #ln -s /usr/lib/libcycript.dylib package/Library/MobileSubstrate/DynamicLibraries/Cycript.dylib
85 cp -a cycript package/usr/bin
86 cp -a libcycript.plist package/usr/lib
87 dpkg-deb -b package $(shell grep ^Package: control | cut -d ' ' -f 2-)_$(shell grep ^Version: control | cut -d ' ' -f 2)_iphoneos-arm.deb
90 dpkg -i $(shell grep ^Package: control | cut -d ' ' -f 2-)_$(shell grep ^Version: control | cut -d ' ' -f 2)_iphoneos-arm.deb
91 cycript /Applications/HelloCycript.app/HelloCycript
93 .PHONY: all clean extra package