7 flags := -mthumb -g3 -O0 -Wall -Werror -I. -fno-common
8 flags += -F${PKG_ROOT}/System/Library/PrivateFrameworks
10 svn := $(shell svnversion)
11 deb := $(shell grep ^Package: control | cut -d ' ' -f 2-)_$(shell grep ^Version: control | cut -d ' ' -f 2 | sed -e 's/\#/$(svn)/')_iphoneos-arm.deb
12 all := cycript libcycript.dylib libcycript.plist
14 header := Cycript.tab.hh Parser.hpp Pooling.hpp Struct.hpp cycript.hpp
21 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
23 libcycript.plist: Bridge.def
26 grep '^[CFV]' Bridge.def | sed -e 's/^C/0/;s/^F/1/;s/^V/2/' | sed -e 's/"/\\"/g;s/^\([^ ]*\) \([^ ]*\) \(.*\)$$/\2 = (\1, \"\3\");/'; \
28 grep '^:' Bridge.def | sed -e 's/^: \([^ ]*\) \(.*\)/"\1" = "\2";/'; \
30 grep '^[EST]' Bridge.def | sed -e 's/^S/0/;s/^T/1/;s/^E/2/' | sed -e 's/^2\(.*\)$$/1\1 i/' | sed -e 's/"/\\"/g;s/^\([^ ]*\) \([^ ]*\) \(.*\)$$/\2 = (\1, \"\3\");/'; \
34 Cycript.tab.cc Cycript.tab.hh location.hh position.hh: Cycript.y
35 bison -v --report=state $<
41 $$($(target)gcc -print-prog-name=cc1obj) -print-objc-runtime-info </dev/null >$@
43 #Parser.hpp: Parser.py Parser.dat
44 # ./Parser.py <Parser.dat >$@
47 $(target)g++ $(flags) -c -o $@ $<
49 Cycript.tab.o: Cycript.tab.cc Cycript.tab.hh Parser.hpp Pooling.hpp
50 $(target)g++ $(flags) -c -o $@ $<
52 lex.cy.o: lex.cy.c Cycript.tab.hh Parser.hpp Pooling.hpp
53 $(target)g++ $(flags) -c -o $@ $<
56 $(target)g++ $(flags) -c -o $@ $<
59 $(target)g++ $(flags) -c -o $@ $<
61 libcycript.dylib: ffi_type.o parse.o Output.o Cycript.tab.o lex.cy.o Library.o
62 $(target)g++ $(flags) -dynamiclib -o $@ $(filter %.o,$^) \
63 -install_name /usr/lib/libcycript.dylib \
64 -lobjc -lapr-1 -lffi -lsubstrate \
65 -framework CoreFoundation -framework Foundation \
66 -framework CFNetwork \
67 -framework JavaScriptCore -framework WebCore
70 cycript: Application.o libcycript.dylib
71 $(target)g++ $(flags) -o $@ $(filter %.o,$^) \
72 -lobjc -lapr-1 -lreadline \
74 -framework Foundation -framework CoreFoundation \
75 -framework JavaScriptCore -framework UIKit
80 mkdir -p package/DEBIAN
81 sed -e 's/#/$(svn)/' control >package/DEBIAN/control
82 mkdir -p package/Library/MobileSubstrate/DynamicLibraries
83 if [[ -e Settings.plist ]]; then \
84 mkdir -p package/Library/PreferenceLoader/Preferences; \
85 cp -a Settings.png package/Library/PreferenceLoader/Preferences/CycriptIcon.png; \
86 cp -a Settings.plist package/Library/PreferenceLoader/Preferences/Cycript.plist; \
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
90 mkdir -p package/usr/{bin,lib}
91 cp -a libcycript.dylib package/usr/lib
92 ln -s /usr/lib/libcycript.dylib package/Library/MobileSubstrate/DynamicLibraries/Cycript.dylib
93 cp -a cycript package/usr/bin
94 cp -a libcycript.plist package/usr/lib
95 dpkg-deb -b package $(deb)
103 .PHONY: all clean extra package