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