7 #flags := -g3 -O0 -DYYDEBUG=1
9 flags += -Wall -Werror -Wno-parentheses
10 flags += -fPIC -fno-common
11 flags += -I. -I$(shell apr-1-config --includedir)
13 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
25 code += Replace.o Output.o
26 code += Cycript.tab.o lex.cy.o
27 code += Network.o Parser.o
32 apr := $(shell apr-1-config --link-ld)
33 library := $(apr) -lffi
34 console := $(apr) -lreadline
36 uname_s := $(shell uname -s)
37 uname_p := $(shell uname -p)
38 -include $(uname_s).mk
39 -include $(uname_s)-$(uname_p).mk
41 all += libcycript.$(dll)
44 deb := $(shell grep ^Package: control | cut -d ' ' -f 2-)_$(shell grep ^Version: control | cut -d ' ' -f 2 | sed -e 's/\#/$(svn)/')_$(arch).deb
50 mkdir -p package/DEBIAN
51 sed -e 's/#/$(svn)/' control >package/DEBIAN/control
52 mkdir -p package/System/Library/LaunchDaemons
53 #cp -a com.saurik.Cyrver.plist package/System/Library/LaunchDaemons
54 mkdir -p package/Library/MobileSubstrate/DynamicLibraries
55 if [[ -e Settings.plist ]]; then \
56 mkdir -p package/Library/PreferenceLoader/Preferences; \
57 cp -a Settings.png package/Library/PreferenceLoader/Preferences/CycriptIcon.png; \
58 cp -a Settings.plist package/Library/PreferenceLoader/Preferences/Cycript.plist; \
60 if [[ -e Tweak.plist ]]; then cp -a Tweak.plist package/Library/MobileSubstrate/DynamicLibraries/Cycript.plist; fi
61 cp -a Cycript.$(dll) package/Library/MobileSubstrate/DynamicLibraries
62 mkdir -p package/usr/{bin,lib,sbin}
63 cp -a libcycript.$(dll) package/usr/lib
64 cp -a cycript package/usr/bin
65 #cp -a cyrver package/usr/sbin
66 cp -a libcycript.plist package/usr/lib
67 dpkg-deb -b package $(deb)
73 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
75 libcycript.plist: Bridge.def
78 grep '^[CFV]' Bridge.def | sed -e 's/^C/0/;s/^F/1/;s/^V/2/' | sed -e 's/"/\\"/g;s/^\([^ ]*\) \([^ ]*\) \(.*\)$$/\2 = (\1, \"\3\");/'; \
80 grep '^:' Bridge.def | sed -e 's/^: \([^ ]*\) \(.*\)/"\1" = "\2";/'; \
82 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\");/'; \
86 Cycript.y: Cycript.y.in
87 ./Filter.sh <$< >$@ $(filters)
89 Cycript.tab.cc Cycript.tab.hh location.hh position.hh: Cycript.y
90 bison -v --report=state $<
95 #Parser.hpp: Parser.py Parser.dat
96 # ./Parser.py <Parser.dat >$@
99 $(target)g++ $(flags) -c -o $@ $<
101 Cycript.tab.o: Cycript.tab.cc Cycript.tab.hh Parser.hpp Pooling.hpp
102 $(target)g++ $(flags) -c -o $@ $<
104 lex.cy.o: lex.cy.c Cycript.tab.hh Parser.hpp Pooling.hpp
105 $(target)g++ $(flags) -c -o $@ $<
108 $(target)g++ $(flags) -c -o $@ $<
111 $(target)g++ $(flags) -c -o $@ $<
113 libcycript.$(dll): $(code)
114 $(target)g++ $(flags) -shared -dynamiclib -o $@ $(filter %.o,$^) $(library) $(link)
117 cycript: Console.o libcycript.$(dll)
118 $(target)g++ $(flags) -o $@ $(filter %.o,$^) -L. -lcycript $(console) $(link)
127 .PHONY: all clean extra package