]>
Commit | Line | Data |
---|---|---|
ea2d184c JF |
1 | ifndef PKG_TARG |
2 | target := | |
3 | else | |
4 | target := $(PKG_TARG)- | |
5 | endif | |
6 | ||
c491b948 JF |
7 | #flags := -g3 -O0 -DYYDEBUG=1 |
8 | flags := -g0 -O3 | |
9185d5ef JF |
9 | flags += -Wall -Werror -Wno-parentheses -I. -fno-common |
10 | flags += -I$(shell apr-1-config --includedir) | |
ea2d184c | 11 | |
9e20b0b7 | 12 | svn := $(shell svnversion) |
9e20b0b7 | 13 | |
1e7ce557 JF |
14 | all: |
15 | all := libcycript.plist cycript | |
16 | ||
bb9f5eef | 17 | dpkg_architecture := $(shell which dpkg-architecture 2>/dev/null) |
1e7ce557 | 18 | ifneq ($(dpkg_architecture),) |
bb9f5eef | 19 | arch := $(shell $(dpkg_architecture) -qDEB_HOST_ARCH 2>/dev/null) |
1e7ce557 JF |
20 | endif |
21 | ||
22 | header := Cycript.tab.hh Parser.hpp Pooling.hpp cycript.hpp | |
9185d5ef JF |
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 | |
1e7ce557 | 27 | |
9185d5ef JF |
28 | filters := C |
29 | ldid := echo | |
1e7ce557 | 30 | dll := so |
9185d5ef JF |
31 | apr := $(shell apr-1-config --link-ld) |
32 | library := $(apr) -lffi #-lsubstrate | |
33 | link := $(apr) -lreadline | |
1e7ce557 JF |
34 | |
35 | uname_s := $(shell uname -s) | |
36 | uname_p := $(shell uname -p) | |
37 | -include $(uname_s).mk | |
38 | -include $(uname_s)-$(uname_p).mk | |
39 | ||
40 | all += libcycript.$(dll) | |
f7c38a29 | 41 | |
1e7ce557 JF |
42 | ifdef arch |
43 | deb := $(shell grep ^Package: control | cut -d ' ' -f 2-)_$(shell grep ^Version: control | cut -d ' ' -f 2 | sed -e 's/\#/$(svn)/')_$(arch).deb | |
44 | ||
45 | all: $(deb) | |
46 | ||
47 | $(deb): $(all) | |
48 | rm -rf package | |
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; \ | |
58 | fi | |
59 | if [[ -e Tweak.plist ]]; then cp -a Tweak.plist package/Library/MobileSubstrate/DynamicLibraries/Cycript.plist; fi | |
328ad766 | 60 | cp -a Cycript.$(dll) package/Library/MobileSubstrate/DynamicLibraries |
1e7ce557 | 61 | mkdir -p package/usr/{bin,lib,sbin} |
328ad766 | 62 | cp -a libcycript.$(dll) package/usr/lib |
1e7ce557 JF |
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) | |
67 | endif | |
9b5527f0 | 68 | |
8953777c | 69 | all: $(all) |
ea2d184c JF |
70 | |
71 | clean: | |
328ad766 | 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 |
ea2d184c | 73 | |
5999c315 | 74 | libcycript.plist: Bridge.def |
b09da87b | 75 | { \ |
953647c1 | 76 | echo '({'; \ |
f7c38a29 | 77 | grep '^[CFV]' Bridge.def | sed -e 's/^C/0/;s/^F/1/;s/^V/2/' | sed -e 's/"/\\"/g;s/^\([^ ]*\) \([^ ]*\) \(.*\)$$/\2 = (\1, \"\3\");/'; \ |
953647c1 | 78 | echo '},{'; \ |
f33b048a JF |
79 | grep '^:' Bridge.def | sed -e 's/^: \([^ ]*\) \(.*\)/"\1" = "\2";/'; \ |
80 | echo '},{'; \ | |
61933e16 | 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\");/'; \ |
953647c1 | 82 | echo '})'; \ |
b09da87b | 83 | } >$@ |
88c977fa | 84 | |
4de0686f JF |
85 | Cycript.y: Cycript.y.in |
86 | ./Filter.sh <$< >$@ $(filters) | |
87 | ||
5999c315 | 88 | Cycript.tab.cc Cycript.tab.hh location.hh position.hh: Cycript.y |
e7ed5354 | 89 | bison -v --report=state $< |
e5332278 JF |
90 | |
91 | lex.cy.c: Cycript.l | |
92 | flex $< | |
93 | ||
e5332278 JF |
94 | #Parser.hpp: Parser.py Parser.dat |
95 | # ./Parser.py <Parser.dat >$@ | |
96 | ||
5999c315 | 97 | %.o: sig/%.cpp |
457afcc9 | 98 | $(target)g++ $(flags) -c -o $@ $< |
5999c315 JF |
99 | |
100 | Cycript.tab.o: Cycript.tab.cc Cycript.tab.hh Parser.hpp Pooling.hpp | |
457afcc9 | 101 | $(target)g++ $(flags) -c -o $@ $< |
5999c315 JF |
102 | |
103 | lex.cy.o: lex.cy.c Cycript.tab.hh Parser.hpp Pooling.hpp | |
457afcc9 | 104 | $(target)g++ $(flags) -c -o $@ $< |
5999c315 | 105 | |
f7c38a29 | 106 | %.o: %.cpp $(header) |
057f943f JF |
107 | $(target)g++ $(flags) -c -o $@ $< |
108 | ||
f7c38a29 | 109 | %.o: %.mm $(header) |
457afcc9 | 110 | $(target)g++ $(flags) -c -o $@ $< |
5999c315 | 111 | |
4de0686f | 112 | libcycript.$(dll): $(code) |
9185d5ef JF |
113 | $(target)g++ $(flags) -shared -dynamiclib -o $@ $(filter %.o,$^) $(library) |
114 | $(ldid) -S $@ | |
ea2d184c | 115 | |
bb9f5eef | 116 | cycript: Console.o libcycript.$(dll) |
9185d5ef JF |
117 | $(target)g++ $(flags) -o $@ $(filter %.o,$^) -L. -lcycript $(link) |
118 | $(ldid) -S cycript | |
262e358c | 119 | |
9b5527f0 JF |
120 | package: $(deb) |
121 | ||
122 | test: $(deb) | |
9e20b0b7 | 123 | dpkg -i $(deb) |
953647c1 | 124 | cycript test.cy |
1dbba6cc | 125 | |
88c977fa | 126 | .PHONY: all clean extra package |