]> git.saurik.com Git - cycript.git/blame_incremental - makefile
Maybe fully separated the backend library from Console.
[cycript.git] / makefile
... / ...
CommitLineData
1ifndef PKG_TARG
2target :=
3else
4target := $(PKG_TARG)-
5endif
6
7flags := -g3 -O0 -DYYDEBUG=1
8#flags := -g0 -O3
9flags += -Wall -Werror -I. -fno-common
10
11svn := $(shell svnversion)
12
13filters := C
14
15all:
16all := libcycript.plist cycript
17
18dpkg_architecture := $(shell which dpkg-architecture 2>/dev/null)
19ifneq ($(dpkg_architecture),)
20arch := $(shell $(dpkg_architecture) -qDEB_HOST_ARCH 2>/dev/null)
21endif
22
23header := Cycript.tab.hh Parser.hpp Pooling.hpp cycript.hpp
24code := ffi_type.o parse.o Replace.o Output.o Cycript.tab.o lex.cy.o Network.o
25
26dll := so
27
28uname_s := $(shell uname -s)
29uname_p := $(shell uname -p)
30-include $(uname_s).mk
31-include $(uname_s)-$(uname_p).mk
32
33all += libcycript.$(dll)
34
35ifdef arch
36deb := $(shell grep ^Package: control | cut -d ' ' -f 2-)_$(shell grep ^Version: control | cut -d ' ' -f 2 | sed -e 's/\#/$(svn)/')_$(arch).deb
37
38all: $(deb)
39
40$(deb): $(all)
41 rm -rf package
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; \
51 fi
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)
60endif
61
62all: $(all)
63
64clean:
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
66
67libcycript.plist: Bridge.def
68 { \
69 echo '({'; \
70 grep '^[CFV]' Bridge.def | sed -e 's/^C/0/;s/^F/1/;s/^V/2/' | sed -e 's/"/\\"/g;s/^\([^ ]*\) \([^ ]*\) \(.*\)$$/\2 = (\1, \"\3\");/'; \
71 echo '},{'; \
72 grep '^:' Bridge.def | sed -e 's/^: \([^ ]*\) \(.*\)/"\1" = "\2";/'; \
73 echo '},{'; \
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\");/'; \
75 echo '})'; \
76 } >$@
77
78Cycript.y: Cycript.y.in
79 ./Filter.sh <$< >$@ $(filters)
80
81Cycript.tab.cc Cycript.tab.hh location.hh position.hh: Cycript.y
82 bison -v --report=state $<
83
84lex.cy.c: Cycript.l
85 flex $<
86
87#Parser.hpp: Parser.py Parser.dat
88# ./Parser.py <Parser.dat >$@
89
90%.o: sig/%.cpp
91 $(target)g++ $(flags) -c -o $@ $<
92
93Cycript.tab.o: Cycript.tab.cc Cycript.tab.hh Parser.hpp Pooling.hpp
94 $(target)g++ $(flags) -c -o $@ $<
95
96lex.cy.o: lex.cy.c Cycript.tab.hh Parser.hpp Pooling.hpp
97 $(target)g++ $(flags) -c -o $@ $<
98
99%.o: %.cpp $(header)
100 $(target)g++ $(flags) -c -o $@ $<
101
102%.o: %.mm $(header)
103 $(target)g++ $(flags) -c -o $@ $<
104
105cyrver: Server.o
106 $(target)g++ $(flags) -o $@ $(filter %.o,$^) \
107 -lobjc -lapr-1 -lsubstrate \
108 -framework CoreFoundation -framework CFNetwork
109 ldid -S $@
110
111libcycript.$(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
118 ldid -S $@
119
120cycript: Console.o libcycript.$(dll)
121 $(target)g++ $(flags) -o $@ $(filter %.o,$^) \
122 -lobjc -lapr-1 -lreadline \
123 -L. -lcycript \
124 -framework Foundation -framework CoreFoundation \
125 -framework JavaScriptCore -framework UIKit
126 ldid -S cycript
127
128package: $(deb)
129
130test: $(deb)
131 dpkg -i $(deb)
132 cycript test.cy
133
134.PHONY: all clean extra package