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