7 #flags := -g3 -O0 -DYYDEBUG=1
9 flags += -Wall -Werror -I. -fno-common
11 svn := $(shell svnversion)
16 all := libcycript.plist cycript
18 dpkg_architecture := $(shell which dpkg-architecture 2>/dev/null)
19 ifneq ($(dpkg_architecture),)
20 arch := $(shell $(dpkg_architecture) -qDEB_HOST_ARCH 2>/dev/null)
23 header := Cycript.tab.hh Parser.hpp Pooling.hpp cycript.hpp
24 code := ffi_type.o parse.o Replace.o Output.o Cycript.tab.o lex.cy.o Network.o
28 uname_s := $(shell uname -s)
29 uname_p := $(shell uname -p)
30 -include $(uname_s).mk
31 -include $(uname_s)-$(uname_p).mk
33 all += libcycript.$(dll)
36 deb := $(shell grep ^Package: control | cut -d ' ' -f 2-)_$(shell grep ^Version: control | cut -d ' ' -f 2 | sed -e 's/\#/$(svn)/')_$(arch).deb
42 mkdir -p package/DEBIAN
43 sed -e 's/#/$(svn)/' control >package/DEBIAN/control
44 mkdir -p package/System/Library/LaunchDaemons
45 #cp -a com.saurik.Cyrver.plist package/System/Library/LaunchDaemons
46 mkdir -p package/Library/MobileSubstrate/DynamicLibraries
47 if [[ -e Settings.plist ]]; then \
48 mkdir -p package/Library/PreferenceLoader/Preferences; \
49 cp -a Settings.png package/Library/PreferenceLoader/Preferences/CycriptIcon.png; \
50 cp -a Settings.plist package/Library/PreferenceLoader/Preferences/Cycript.plist; \
52 if [[ -e Tweak.plist ]]; then cp -a Tweak.plist package/Library/MobileSubstrate/DynamicLibraries/Cycript.plist; fi
53 cp -a Cycript.$(dll) package/Library/MobileSubstrate/DynamicLibraries
54 mkdir -p package/usr/{bin,lib,sbin}
55 cp -a libcycript.$(dll) package/usr/lib
56 cp -a cycript package/usr/bin
57 #cp -a cyrver package/usr/sbin
58 cp -a libcycript.plist package/usr/lib
59 dpkg-deb -b package $(deb)
65 rm -f *.o libcycript.$(dll) cycript libcycript.plist Struct.hpp lex.cy.c Cycript.tab.cc Cycript.tab.hh location.hh position.hh stack.hh cyrver Cycript.y
67 libcycript.plist: Bridge.def
70 grep '^[CFV]' Bridge.def | sed -e 's/^C/0/;s/^F/1/;s/^V/2/' | sed -e 's/"/\\"/g;s/^\([^ ]*\) \([^ ]*\) \(.*\)$$/\2 = (\1, \"\3\");/'; \
72 grep '^:' Bridge.def | sed -e 's/^: \([^ ]*\) \(.*\)/"\1" = "\2";/'; \
74 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\");/'; \
78 Cycript.y: Cycript.y.in
79 ./Filter.sh <$< >$@ $(filters)
81 Cycript.tab.cc Cycript.tab.hh location.hh position.hh: Cycript.y
82 bison -v --report=state $<
87 #Parser.hpp: Parser.py Parser.dat
88 # ./Parser.py <Parser.dat >$@
91 $(target)g++ $(flags) -c -o $@ $<
93 Cycript.tab.o: Cycript.tab.cc Cycript.tab.hh Parser.hpp Pooling.hpp
94 $(target)g++ $(flags) -c -o $@ $<
96 lex.cy.o: lex.cy.c Cycript.tab.hh Parser.hpp Pooling.hpp
97 $(target)g++ $(flags) -c -o $@ $<
100 $(target)g++ $(flags) -c -o $@ $<
103 $(target)g++ $(flags) -c -o $@ $<
106 $(target)g++ $(flags) -o $@ $(filter %.o,$^) \
107 -lobjc -lapr-1 -lsubstrate \
108 -framework CoreFoundation -framework CFNetwork
111 libcycript.$(dll): $(code)
112 $(target)g++ $(flags) -dynamiclib -o $@ $(filter %.o,$^) \
113 -install_name /usr/lib/libcycript.$(dll) \
114 -lobjc -lapr-1 -lffi -lsubstrate \
115 -framework CoreFoundation -framework Foundation \
116 -framework CFNetwork \
117 -framework JavaScriptCore -framework WebCore
120 cycript: Console.o libcycript.$(dll)
121 $(target)g++ $(flags) -o $@ $(filter %.o,$^) \
122 -lobjc -lapr-1 -lreadline \
124 -framework Foundation -framework CoreFoundation \
125 -framework JavaScriptCore -framework UIKit
134 .PHONY: all clean extra package