]> git.saurik.com Git - cycript.git/blame - makefile
C++ Bison conversion.
[cycript.git] / makefile
CommitLineData
ea2d184c
JF
1ifndef PKG_TARG
2target :=
3else
4target := $(PKG_TARG)-
5endif
6
62ca2b82
JF
7package:
8
107e3ed0 9flags := -framework CFNetwork -framework JavaScriptCore -framework WebCore -install_name /usr/lib/libcycript.dylib -I.
ea2d184c
JF
10menes := $(shell cd ~; pwd)/menes
11
12link := -framework CoreFoundation -framework Foundation -F${PKG_ROOT}/System/Library/PrivateFrameworks -L$(menes)/mobilesubstrate -lsubstrate -lapr-1 -lffi
13
262e358c 14all: cycript libcycript.dylib libcycript.plist
ea2d184c
JF
15
16clean:
63b4c5a8 17 rm -f libcycript.dylib cycript libcycript.plist Struct.hpp lex.cy.c Cycript.tab.cc Cycript.tab.hh location.hh position.hh
ea2d184c 18
107e3ed0 19libcycript.plist: Bridge.def makefile
707bcb93 20 sed -e 's/^C/0/;s/^F/1/;s/^V/2/' Bridge.def | while read -r line; do \
88c977fa
JF
21 if [[ $$line == '' ]]; then \
22 continue; \
23 fi; \
24 set $$line; \
25 if [[ $$1 =~ [#fl] ]]; then \
26 continue; \
27 fi; \
28 echo "$$2 = ($$1, \"$$3\");"; \
29 done >$@
30
63b4c5a8 31Cycript.tab.cc Cycript.tab.hh: Cycript.y makefile
1dbba6cc 32 bison -v $<
e5332278
JF
33
34lex.cy.c: Cycript.l
35 flex $<
36
04450da0
JF
37Struct.hpp:
38 $$($(target)gcc -print-prog-name=cc1obj) -print-objc-runtime-info </dev/null >$@
39
e5332278
JF
40#Parser.hpp: Parser.py Parser.dat
41# ./Parser.py <Parser.dat >$@
42
63b4c5a8
JF
43libcycript.dylib: Library.mm makefile $(menes)/mobilesubstrate/substrate.h sig/*.[ch]pp Struct.hpp Parser.hpp lex.cy.c Cycript.tab.cc Cycript.tab.hh
44 $(target)g++ -dynamiclib -mthumb -g0 -O2 -Wall -Werror -o $@ $(filter %.cpp,$^) $(filter %.cc,$^) $(filter %.c,$^) $(filter %.mm,$^) -lobjc -I$(menes)/mobilesubstrate $(link) $(flags) #-DYYDEBUG=1
ea2d184c
JF
45 ldid -S $@
46
262e358c 47cycript: Application.mm libcycript.dylib
8d9b5eed 48 $(target)g++ -g0 -O2 -Wall -Werror -o $@ $(filter %.mm,$^) -framework UIKit -framework Foundation -framework CoreFoundation -lobjc libcycript.dylib
262e358c
JF
49 ldid -S cycript
50
ea2d184c
JF
51package: all
52 rm -rf package
53 mkdir -p package/DEBIAN
88c977fa 54 cp -a control package/DEBIAN
ea2d184c 55 mkdir -p package/Library/MobileSubstrate/DynamicLibraries
ea2d184c
JF
56 if [[ -e Settings.plist ]]; then \
57 mkdir -p package/Library/PreferenceLoader/Preferences; \
262e358c
JF
58 cp -a Settings.png package/Library/PreferenceLoader/Preferences/CycriptIcon.png; \
59 cp -a Settings.plist package/Library/PreferenceLoader/Preferences/Cycript.plist; \
ea2d184c 60 fi
262e358c
JF
61 if [[ -e Tweak.plist ]]; then cp -a Tweak.plist package/Library/MobileSubstrate/DynamicLibraries/Cycript.plist; fi
62 #cp -a Cycript.dylib package/Library/MobileSubstrate/DynamicLibraries
62ca2b82 63 mkdir -p package/usr/{bin,lib}
262e358c 64 cp -a libcycript.dylib package/usr/lib
a2d9403c 65 #ln -s /usr/lib/libcycript.dylib package/Library/MobileSubstrate/DynamicLibraries/Cycript.dylib
107e3ed0
JF
66 cp -a cycript package/usr/bin
67 cp -a libcycript.plist package/usr/lib
88c977fa
JF
68 dpkg-deb -b package $(shell grep ^Package: control | cut -d ' ' -f 2-)_$(shell grep ^Version: control | cut -d ' ' -f 2)_iphoneos-arm.deb
69
1dbba6cc
JF
70test: package
71 dpkg -i $(shell grep ^Package: control | cut -d ' ' -f 2-)_$(shell grep ^Version: control | cut -d ' ' -f 2)_iphoneos-arm.deb
72 cycript
73
88c977fa 74.PHONY: all clean extra package