]> git.saurik.com Git - cycript.git/blob - makefile
Implemented @property access, made Pointer.toCYON printf %p, added UIWindow bridge...
[cycript.git] / makefile
1 ifndef PKG_TARG
2 target :=
3 else
4 target := $(PKG_TARG)-
5 endif
6
7 package:
8
9 flags := -mthumb -g3 -O0 -Wall -Werror -I. -fno-common
10 flags += -F${PKG_ROOT}/System/Library/PrivateFrameworks
11
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
15 all: cycript libcycript.dylib libcycript.plist
16
17 clean:
18 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
19
20 libcycript.plist: Bridge.def
21 { \
22 echo '({'; \
23 sed -e 's/^C/0/;s/^F/1/;s/^V/2/' Bridge.def | while read -r line; do \
24 if [[ $$line == '' ]]; then \
25 continue; \
26 fi; \
27 set $$line; \
28 if [[ $$1 =~ [#fl:] ]]; then \
29 continue; \
30 fi; \
31 echo "$$2 = ($$1, \"$${3//\"/\\\"}\");"; \
32 done; \
33 echo '},{'; \
34 grep ^: Bridge.def | sed -e 's/^: \([^ ]*\) \(.*\)/"\1" = "\2";/'; \
35 echo '})'; \
36 } >$@
37
38 Cycript.tab.cc Cycript.tab.hh location.hh position.hh: Cycript.y
39 bison -v --report=state $<
40
41 lex.cy.c: Cycript.l
42 flex $<
43
44 Struct.hpp:
45 $$($(target)gcc -print-prog-name=cc1obj) -print-objc-runtime-info </dev/null >$@
46
47 #Parser.hpp: Parser.py Parser.dat
48 # ./Parser.py <Parser.dat >$@
49
50 %.o: sig/%.cpp
51 $(target)g++ $(flags) -c -o $@ $<
52
53 Cycript.tab.o: Cycript.tab.cc Cycript.tab.hh Parser.hpp Pooling.hpp
54 $(target)g++ $(flags) -c -o $@ $<
55
56 lex.cy.o: lex.cy.c Cycript.tab.hh Parser.hpp Pooling.hpp
57 $(target)g++ $(flags) -c -o $@ $<
58
59 Output.o: Output.cpp Parser.hpp Pooling.hpp
60 $(target)g++ $(flags) -c -o $@ $<
61
62 Library.o: Library.mm Cycript.tab.hh Parser.hpp Pooling.hpp Struct.hpp cycript.hpp
63 $(target)g++ $(flags) -c -o $@ $<
64
65 Application.o: Application.mm Cycript.tab.hh Parser.hpp Pooling.hpp cycript.hpp
66 $(target)g++ $(flags) -c -o $@ $<
67
68 libcycript.dylib: ffi_type.o parse.o Output.o Cycript.tab.o lex.cy.o Library.o
69 $(target)g++ $(flags) -dynamiclib -o $@ $(filter %.o,$^) -lobjc -framework CFNetwork -framework JavaScriptCore -framework WebCore -install_name /usr/lib/libcycript.dylib -framework CoreFoundation -framework Foundation -L$(menes)/mobilesubstrate -lsubstrate -lapr-1 -lffi -framework UIKit
70 ldid -S $@
71
72 cycript: Application.o libcycript.dylib
73 $(target)g++ $(flags) -o $@ $(filter %.o,$^) -framework UIKit -framework Foundation -framework CoreFoundation -lobjc libcycript.dylib -lreadline -framework JavaScriptCore -lapr-1
74 ldid -S cycript
75
76 package: all
77 rm -rf package
78 mkdir -p package/DEBIAN
79 sed -e 's/#/$(svn)/' control >package/DEBIAN/control
80 mkdir -p package/Library/MobileSubstrate/DynamicLibraries
81 if [[ -e Settings.plist ]]; then \
82 mkdir -p package/Library/PreferenceLoader/Preferences; \
83 cp -a Settings.png package/Library/PreferenceLoader/Preferences/CycriptIcon.png; \
84 cp -a Settings.plist package/Library/PreferenceLoader/Preferences/Cycript.plist; \
85 fi
86 if [[ -e Tweak.plist ]]; then cp -a Tweak.plist package/Library/MobileSubstrate/DynamicLibraries/Cycript.plist; fi
87 #cp -a Cycript.dylib package/Library/MobileSubstrate/DynamicLibraries
88 mkdir -p package/usr/{bin,lib}
89 cp -a libcycript.dylib package/usr/lib
90 #ln -s /usr/lib/libcycript.dylib package/Library/MobileSubstrate/DynamicLibraries/Cycript.dylib
91 cp -a cycript package/usr/bin
92 cp -a libcycript.plist package/usr/lib
93 dpkg-deb -b package $(deb)
94
95 test: package
96 dpkg -i $(deb)
97 cycript test.cy
98
99 .PHONY: all clean extra package