7 #flags := -g3 -O0 -DYYDEBUG=1
9 flags += -Wall -Werror -Wno-parentheses -I. -fno-common
10 flags += -I$(shell apr-1-config --includedir)
12 svn := $(shell svnversion)
15 all := libcycript.plist cycript
17 dpkg_architecture := $(shell which dpkg-architecture 2>/dev/null)
18 ifneq ($(dpkg_architecture),)
19 arch := $(shell $(dpkg_architecture) -qDEB_HOST_ARCH 2>/dev/null)
22 header := Cycript.tab.hh Parser.hpp Pooling.hpp cycript.hpp
23 code := ffi_type.o parse.o
24 code += Replace.o Output.o
25 code += Cycript.tab.o lex.cy.o
26 code += Network.o Parser.o
31 apr := $(shell apr-1-config --link-ld)
32 library := $(apr) -lffi #-lsubstrate
33 link := $(apr) -lreadline
35 uname_s := $(shell uname -s)
36 uname_p := $(shell uname -p)
37 -include $(uname_s).mk
38 -include $(uname_s)-$(uname_p).mk
40 all += libcycript.$(dll)
43 deb := $(shell grep ^Package: control | cut -d ' ' -f 2-)_$(shell grep ^Version: control | cut -d ' ' -f 2 | sed -e 's/\#/$(svn)/')_$(arch).deb
49 mkdir -p package/DEBIAN
50 sed -e 's/#/$(svn)/' control >package/DEBIAN/control
51 mkdir -p package/System/Library/LaunchDaemons
52 #cp -a com.saurik.Cyrver.plist package/System/Library/LaunchDaemons
53 mkdir -p package/Library/MobileSubstrate/DynamicLibraries
54 if [[ -e Settings.plist ]]; then \
55 mkdir -p package/Library/PreferenceLoader/Preferences; \
56 cp -a Settings.png package/Library/PreferenceLoader/Preferences/CycriptIcon.png; \
57 cp -a Settings.plist package/Library/PreferenceLoader/Preferences/Cycript.plist; \
59 if [[ -e Tweak.plist ]]; then cp -a Tweak.plist package/Library/MobileSubstrate/DynamicLibraries/Cycript.plist; fi
60 cp -a Cycript.$(dll) package/Library/MobileSubstrate/DynamicLibraries
61 mkdir -p package/usr/{bin,lib,sbin}
62 cp -a libcycript.$(dll) package/usr/lib
63 cp -a cycript package/usr/bin
64 #cp -a cyrver package/usr/sbin
65 cp -a libcycript.plist package/usr/lib
66 dpkg-deb -b package $(deb)
72 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
74 libcycript.plist: Bridge.def
77 grep '^[CFV]' Bridge.def | sed -e 's/^C/0/;s/^F/1/;s/^V/2/' | sed -e 's/"/\\"/g;s/^\([^ ]*\) \([^ ]*\) \(.*\)$$/\2 = (\1, \"\3\");/'; \
79 grep '^:' Bridge.def | sed -e 's/^: \([^ ]*\) \(.*\)/"\1" = "\2";/'; \
81 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\");/'; \
85 Cycript.y: Cycript.y.in
86 ./Filter.sh <$< >$@ $(filters)
88 Cycript.tab.cc Cycript.tab.hh location.hh position.hh: Cycript.y
89 bison -v --report=state $<
94 #Parser.hpp: Parser.py Parser.dat
95 # ./Parser.py <Parser.dat >$@
98 $(target)g++ $(flags) -c -o $@ $<
100 Cycript.tab.o: Cycript.tab.cc Cycript.tab.hh Parser.hpp Pooling.hpp
101 $(target)g++ $(flags) -c -o $@ $<
103 lex.cy.o: lex.cy.c Cycript.tab.hh Parser.hpp Pooling.hpp
104 $(target)g++ $(flags) -c -o $@ $<
107 $(target)g++ $(flags) -c -o $@ $<
110 $(target)g++ $(flags) -c -o $@ $<
112 libcycript.$(dll): $(code)
113 $(target)g++ $(flags) -shared -dynamiclib -o $@ $(filter %.o,$^) $(library)
116 cycript: Console.o libcycript.$(dll)
117 $(target)g++ $(flags) -o $@ $(filter %.o,$^) -L. -lcycript $(link)
126 .PHONY: all clean extra package