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