]>
Commit | Line | Data |
---|---|---|
1 | ifndef PKG_TARG | |
2 | target := | |
3 | else | |
4 | target := $(PKG_TARG)- | |
5 | endif | |
6 | ||
7 | flags := -mthumb -g0 -O3 -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 Cycript.dylib #cyrver | |
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 | cyrver: Server.o | |
62 | $(target)g++ $(flags) -o $@ $(filter %.o,$^) \ | |
63 | -lobjc -lapr-1 -lsubstrate \ | |
64 | -framework CoreFoundation -framework CFNetwork | |
65 | ldid -S $@ | |
66 | ||
67 | Cycript.dylib: Connector.o | |
68 | $(target)g++ $(flags) -dynamiclib -o $@ $(filter %.o,$^) \ | |
69 | -lobjc -lapr-1 -lsubstrate \ | |
70 | -framework CoreFoundation | |
71 | ldid -S $@ | |
72 | ||
73 | libcycript.dylib: ffi_type.o parse.o Output.o Cycript.tab.o lex.cy.o Library.o | |
74 | $(target)g++ $(flags) -dynamiclib -o $@ $(filter %.o,$^) \ | |
75 | -install_name /usr/lib/libcycript.dylib \ | |
76 | -lobjc -lapr-1 -lffi -lsubstrate \ | |
77 | -framework CoreFoundation -framework Foundation \ | |
78 | -framework CFNetwork \ | |
79 | -framework JavaScriptCore -framework WebCore | |
80 | ldid -S $@ | |
81 | ||
82 | cycript: Console.o libcycript.dylib | |
83 | $(target)g++ $(flags) -o $@ $(filter %.o,$^) \ | |
84 | -lobjc -lapr-1 -lreadline \ | |
85 | -L. -lcycript \ | |
86 | -framework Foundation -framework CoreFoundation \ | |
87 | -framework JavaScriptCore -framework UIKit | |
88 | ldid -S cycript | |
89 | ||
90 | $(deb): $(all) | |
91 | rm -rf package | |
92 | mkdir -p package/DEBIAN | |
93 | sed -e 's/#/$(svn)/' control >package/DEBIAN/control | |
94 | mkdir -p package/System/Library/LaunchDaemons | |
95 | cp -a com.saurik.Cyrver.plist package/System/Library/LaunchDaemons | |
96 | mkdir -p package/Library/MobileSubstrate/DynamicLibraries | |
97 | if [[ -e Settings.plist ]]; then \ | |
98 | mkdir -p package/Library/PreferenceLoader/Preferences; \ | |
99 | cp -a Settings.png package/Library/PreferenceLoader/Preferences/CycriptIcon.png; \ | |
100 | cp -a Settings.plist package/Library/PreferenceLoader/Preferences/Cycript.plist; \ | |
101 | fi | |
102 | if [[ -e Tweak.plist ]]; then cp -a Tweak.plist package/Library/MobileSubstrate/DynamicLibraries/Cycript.plist; fi | |
103 | cp -a Cycript.dylib package/Library/MobileSubstrate/DynamicLibraries | |
104 | mkdir -p package/usr/{bin,lib,sbin} | |
105 | cp -a libcycript.dylib package/usr/lib | |
106 | cp -a cycript package/usr/bin | |
107 | #cp -a cyrver package/usr/sbin | |
108 | cp -a libcycript.plist package/usr/lib | |
109 | dpkg-deb -b package $(deb) | |
110 | ||
111 | package: $(deb) | |
112 | ||
113 | test: $(deb) | |
114 | dpkg -i $(deb) | |
115 | cycript test.cy | |
116 | ||
117 | .PHONY: all clean extra package |