7 #flags := -g3 -O0 -DYYDEBUG=1
9 flags += -Wall -Werror -I. -fno-common
11 svn := $(shell svnversion)
14 all := libcycript.plist cycript
16 dpkg_architecture := $(shell dpkg-architecture &>/dev/null)
17 ifneq ($(dpkg_architecture),)
18 arch := $(shell $(dpkg_architecture) -qDEB_HOST_ARCH)
21 header := Cycript.tab.hh Parser.hpp Pooling.hpp cycript.hpp
25 uname_s := $(shell uname -s)
26 uname_p := $(shell uname -p)
27 -include $(uname_s).mk
28 -include $(uname_s)-$(uname_p).mk
30 all += libcycript.$(dll)
33 deb := $(shell grep ^Package: control | cut -d ' ' -f 2-)_$(shell grep ^Version: control | cut -d ' ' -f 2 | sed -e 's/\#/$(svn)/')_$(arch).deb
39 mkdir -p package/DEBIAN
40 sed -e 's/#/$(svn)/' control >package/DEBIAN/control
41 mkdir -p package/System/Library/LaunchDaemons
42 #cp -a com.saurik.Cyrver.plist package/System/Library/LaunchDaemons
43 mkdir -p package/Library/MobileSubstrate/DynamicLibraries
44 if [[ -e Settings.plist ]]; then \
45 mkdir -p package/Library/PreferenceLoader/Preferences; \
46 cp -a Settings.png package/Library/PreferenceLoader/Preferences/CycriptIcon.png; \
47 cp -a Settings.plist package/Library/PreferenceLoader/Preferences/Cycript.plist; \
49 if [[ -e Tweak.plist ]]; then cp -a Tweak.plist package/Library/MobileSubstrate/DynamicLibraries/Cycript.plist; fi
50 cp -a Cycript.dylib package/Library/MobileSubstrate/DynamicLibraries
51 mkdir -p package/usr/{bin,lib,sbin}
52 cp -a libcycript.dylib package/usr/lib
53 cp -a cycript package/usr/bin
54 #cp -a cyrver package/usr/sbin
55 cp -a libcycript.plist package/usr/lib
56 dpkg-deb -b package $(deb)
62 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 cyrver
64 libcycript.plist: Bridge.def
67 grep '^[CFV]' Bridge.def | sed -e 's/^C/0/;s/^F/1/;s/^V/2/' | sed -e 's/"/\\"/g;s/^\([^ ]*\) \([^ ]*\) \(.*\)$$/\2 = (\1, \"\3\");/'; \
69 grep '^:' Bridge.def | sed -e 's/^: \([^ ]*\) \(.*\)/"\1" = "\2";/'; \
71 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\");/'; \
75 Cycript.tab.cc Cycript.tab.hh location.hh position.hh: Cycript.y
76 bison -v --report=state $<
81 #Parser.hpp: Parser.py Parser.dat
82 # ./Parser.py <Parser.dat >$@
85 $(target)g++ $(flags) -c -o $@ $<
87 Cycript.tab.o: Cycript.tab.cc Cycript.tab.hh Parser.hpp Pooling.hpp
88 $(target)g++ $(flags) -c -o $@ $<
90 lex.cy.o: lex.cy.c Cycript.tab.hh Parser.hpp Pooling.hpp
91 $(target)g++ $(flags) -c -o $@ $<
94 $(target)g++ $(flags) -c -o $@ $<
97 $(target)g++ $(flags) -c -o $@ $<
100 $(target)g++ $(flags) -o $@ $(filter %.o,$^) \
101 -lobjc -lapr-1 -lsubstrate \
102 -framework CoreFoundation -framework CFNetwork
105 libcycript.$(dll): ffi_type.o parse.o Replace.o Output.o Cycript.tab.o lex.cy.o Library.o
106 $(target)g++ $(flags) -dynamiclib -o $@ $(filter %.o,$^) \
107 -install_name /usr/lib/libcycript.dylib \
108 -lobjc -lapr-1 -lffi -lsubstrate \
109 -framework CoreFoundation -framework Foundation \
110 -framework CFNetwork \
111 -framework JavaScriptCore -framework WebCore
114 cycript: Console.o libcycript.dylib
115 $(target)g++ $(flags) -o $@ $(filter %.o,$^) \
116 -lobjc -lapr-1 -lreadline \
118 -framework Foundation -framework CoreFoundation \
119 -framework JavaScriptCore -framework UIKit
128 .PHONY: all clean extra package