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