]>
Commit | Line | Data |
---|---|---|
ea2d184c JF |
1 | ifndef PKG_TARG |
2 | target := | |
3 | else | |
4 | target := $(PKG_TARG)- | |
5 | endif | |
6 | ||
62ca2b82 JF |
7 | package: |
8 | ||
057f943f JF |
9 | flags := -mthumb -g3 -O0 -Wall -Werror -I. -fno-common |
10 | flags += -F${PKG_ROOT}/System/Library/PrivateFrameworks | |
ea2d184c | 11 | |
9e20b0b7 JF |
12 | svn := $(shell svnversion) |
13 | deb := $(shell grep ^Package: control | cut -d ' ' -f 2-)_$(shell grep ^Version: control | cut -d ' ' -f 2 | sed -e 's/\#/$(svn)/')_iphoneos-arm.deb | |
14 | ||
f7c38a29 JF |
15 | header := Cycript.tab.hh Parser.hpp Pooling.hpp Struct.hpp cycript.hpp |
16 | ||
262e358c | 17 | all: cycript libcycript.dylib libcycript.plist |
ea2d184c JF |
18 | |
19 | clean: | |
457afcc9 | 20 | 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 |
ea2d184c | 21 | |
5999c315 | 22 | libcycript.plist: Bridge.def |
b09da87b | 23 | { \ |
953647c1 | 24 | echo '({'; \ |
f7c38a29 | 25 | grep '^[CFV]' Bridge.def | sed -e 's/^C/0/;s/^F/1/;s/^V/2/' | sed -e 's/"/\\"/g;s/^\([^ ]*\) \([^ ]*\) \(.*\)$$/\2 = (\1, \"\3\");/'; \ |
953647c1 | 26 | echo '},{'; \ |
f33b048a JF |
27 | grep '^:' Bridge.def | sed -e 's/^: \([^ ]*\) \(.*\)/"\1" = "\2";/'; \ |
28 | echo '},{'; \ | |
61933e16 | 29 | 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\");/'; \ |
953647c1 | 30 | echo '})'; \ |
b09da87b | 31 | } >$@ |
88c977fa | 32 | |
5999c315 | 33 | Cycript.tab.cc Cycript.tab.hh location.hh position.hh: Cycript.y |
e7ed5354 | 34 | bison -v --report=state $< |
e5332278 JF |
35 | |
36 | lex.cy.c: Cycript.l | |
37 | flex $< | |
38 | ||
04450da0 JF |
39 | Struct.hpp: |
40 | $$($(target)gcc -print-prog-name=cc1obj) -print-objc-runtime-info </dev/null >$@ | |
41 | ||
e5332278 JF |
42 | #Parser.hpp: Parser.py Parser.dat |
43 | # ./Parser.py <Parser.dat >$@ | |
44 | ||
5999c315 | 45 | %.o: sig/%.cpp |
457afcc9 | 46 | $(target)g++ $(flags) -c -o $@ $< |
5999c315 JF |
47 | |
48 | Cycript.tab.o: Cycript.tab.cc Cycript.tab.hh Parser.hpp Pooling.hpp | |
457afcc9 | 49 | $(target)g++ $(flags) -c -o $@ $< |
5999c315 JF |
50 | |
51 | lex.cy.o: lex.cy.c Cycript.tab.hh Parser.hpp Pooling.hpp | |
457afcc9 | 52 | $(target)g++ $(flags) -c -o $@ $< |
5999c315 | 53 | |
f7c38a29 | 54 | %.o: %.cpp $(header) |
057f943f JF |
55 | $(target)g++ $(flags) -c -o $@ $< |
56 | ||
f7c38a29 | 57 | %.o: %.mm $(header) |
457afcc9 | 58 | $(target)g++ $(flags) -c -o $@ $< |
5999c315 JF |
59 | |
60 | libcycript.dylib: ffi_type.o parse.o Output.o Cycript.tab.o lex.cy.o Library.o | |
f7c38a29 JF |
61 | $(target)g++ $(flags) -dynamiclib -o $@ $(filter %.o,$^) \ |
62 | -install_name /usr/lib/libcycript.dylib \ | |
61933e16 | 63 | -lobjc -lapr-1 -lffi -lsubstrate \ |
f7c38a29 JF |
64 | -framework CoreFoundation -framework Foundation \ |
65 | -framework CFNetwork \ | |
66 | -framework JavaScriptCore -framework WebCore | |
ea2d184c JF |
67 | ldid -S $@ |
68 | ||
057f943f | 69 | cycript: Application.o libcycript.dylib |
f7c38a29 JF |
70 | $(target)g++ $(flags) -o $@ $(filter %.o,$^) \ |
71 | -lobjc -lapr-1 -lreadline \ | |
72 | -L. -lcycript \ | |
73 | -framework Foundation -framework CoreFoundation \ | |
74 | -framework JavaScriptCore -framework UIKit | |
262e358c JF |
75 | ldid -S cycript |
76 | ||
ea2d184c JF |
77 | package: all |
78 | rm -rf package | |
79 | mkdir -p package/DEBIAN | |
9e20b0b7 | 80 | sed -e 's/#/$(svn)/' control >package/DEBIAN/control |
ea2d184c | 81 | mkdir -p package/Library/MobileSubstrate/DynamicLibraries |
ea2d184c JF |
82 | if [[ -e Settings.plist ]]; then \ |
83 | mkdir -p package/Library/PreferenceLoader/Preferences; \ | |
262e358c JF |
84 | cp -a Settings.png package/Library/PreferenceLoader/Preferences/CycriptIcon.png; \ |
85 | cp -a Settings.plist package/Library/PreferenceLoader/Preferences/Cycript.plist; \ | |
ea2d184c | 86 | fi |
262e358c JF |
87 | if [[ -e Tweak.plist ]]; then cp -a Tweak.plist package/Library/MobileSubstrate/DynamicLibraries/Cycript.plist; fi |
88 | #cp -a Cycript.dylib package/Library/MobileSubstrate/DynamicLibraries | |
62ca2b82 | 89 | mkdir -p package/usr/{bin,lib} |
262e358c | 90 | cp -a libcycript.dylib package/usr/lib |
a2d9403c | 91 | #ln -s /usr/lib/libcycript.dylib package/Library/MobileSubstrate/DynamicLibraries/Cycript.dylib |
107e3ed0 JF |
92 | cp -a cycript package/usr/bin |
93 | cp -a libcycript.plist package/usr/lib | |
9e20b0b7 | 94 | dpkg-deb -b package $(deb) |
88c977fa | 95 | |
1dbba6cc | 96 | test: package |
9e20b0b7 | 97 | dpkg -i $(deb) |
953647c1 | 98 | cycript test.cy |
1dbba6cc | 99 | |
88c977fa | 100 | .PHONY: all clean extra package |