]> git.saurik.com Git - cycript.git/blob - makefile
Changed console commands to start with ? and added ?expand to unescape strings.
[cycript.git] / makefile
1 ifndef PKG_TARG
2 target :=
3 else
4 target := $(PKG_TARG)-
5 endif
6
7 flags := -mthumb -g3 -O0 -Wall -Werror -I. -fno-common
8 flags += -F${PKG_ROOT}/System/Library/PrivateFrameworks
9
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
13
14 header := Cycript.tab.hh Parser.hpp Pooling.hpp Struct.hpp cycript.hpp
15
16 $(deb):
17
18 all: $(all)
19
20 clean:
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
22
23 libcycript.plist: Bridge.def
24 { \
25 echo '({'; \
26 grep '^[CFV]' Bridge.def | sed -e 's/^C/0/;s/^F/1/;s/^V/2/' | sed -e 's/"/\\"/g;s/^\([^ ]*\) \([^ ]*\) \(.*\)$$/\2 = (\1, \"\3\");/'; \
27 echo '},{'; \
28 grep '^:' Bridge.def | sed -e 's/^: \([^ ]*\) \(.*\)/"\1" = "\2";/'; \
29 echo '},{'; \
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\");/'; \
31 echo '})'; \
32 } >$@
33
34 Cycript.tab.cc Cycript.tab.hh location.hh position.hh: Cycript.y
35 bison -v --report=state $<
36
37 lex.cy.c: Cycript.l
38 flex $<
39
40 Struct.hpp:
41 $$($(target)gcc -print-prog-name=cc1obj) -print-objc-runtime-info </dev/null >$@
42
43 #Parser.hpp: Parser.py Parser.dat
44 # ./Parser.py <Parser.dat >$@
45
46 %.o: sig/%.cpp
47 $(target)g++ $(flags) -c -o $@ $<
48
49 Cycript.tab.o: Cycript.tab.cc Cycript.tab.hh Parser.hpp Pooling.hpp
50 $(target)g++ $(flags) -c -o $@ $<
51
52 lex.cy.o: lex.cy.c Cycript.tab.hh Parser.hpp Pooling.hpp
53 $(target)g++ $(flags) -c -o $@ $<
54
55 %.o: %.cpp $(header)
56 $(target)g++ $(flags) -c -o $@ $<
57
58 %.o: %.mm $(header)
59 $(target)g++ $(flags) -c -o $@ $<
60
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
68 ldid -S $@
69
70 cycript: Application.o libcycript.dylib
71 $(target)g++ $(flags) -o $@ $(filter %.o,$^) \
72 -lobjc -lapr-1 -lreadline \
73 -L. -lcycript \
74 -framework Foundation -framework CoreFoundation \
75 -framework JavaScriptCore -framework UIKit
76 ldid -S cycript
77
78 $(deb): $(all)
79 rm -rf package
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; \
87 fi
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)
96
97 package: $(deb)
98
99 test: $(deb)
100 dpkg -i $(deb)
101 cycript test.cy
102
103 .PHONY: all clean extra package