]> git.saurik.com Git - cycript.git/blame_incremental - makefile
Added @ token for E4X.
[cycript.git] / makefile
... / ...
CommitLineData
1ifndef PKG_TARG
2target :=
3else
4target := $(PKG_TARG)-
5endif
6
7#flags := -g3 -O0 -DYYDEBUG=1
8flags := -g0 -O3
9
10flags += -Wall -Werror -I. -fno-common
11flags += -F${PKG_ROOT}/System/Library/PrivateFrameworks
12
13svn := $(shell svnversion)
14deb := $(shell grep ^Package: control | cut -d ' ' -f 2-)_$(shell grep ^Version: control | cut -d ' ' -f 2 | sed -e 's/\#/$(svn)/')_iphoneos-arm.deb
15all := cycript libcycript.dylib libcycript.plist Cycript.dylib #cyrver
16
17header := Cycript.tab.hh Parser.hpp Pooling.hpp Struct.hpp cycript.hpp
18
19$(deb):
20
21all: $(all)
22
23clean:
24 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
25
26libcycript.plist: Bridge.def
27 { \
28 echo '({'; \
29 grep '^[CFV]' Bridge.def | sed -e 's/^C/0/;s/^F/1/;s/^V/2/' | sed -e 's/"/\\"/g;s/^\([^ ]*\) \([^ ]*\) \(.*\)$$/\2 = (\1, \"\3\");/'; \
30 echo '},{'; \
31 grep '^:' Bridge.def | sed -e 's/^: \([^ ]*\) \(.*\)/"\1" = "\2";/'; \
32 echo '},{'; \
33 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\");/'; \
34 echo '})'; \
35 } >$@
36
37Cycript.tab.cc Cycript.tab.hh location.hh position.hh: Cycript.y
38 bison -v --report=state $<
39
40lex.cy.c: Cycript.l
41 flex $<
42
43Struct.hpp:
44 $$($(target)gcc -print-prog-name=cc1obj) -print-objc-runtime-info </dev/null >$@
45
46#Parser.hpp: Parser.py Parser.dat
47# ./Parser.py <Parser.dat >$@
48
49%.o: sig/%.cpp
50 $(target)g++ $(flags) -c -o $@ $<
51
52Cycript.tab.o: Cycript.tab.cc Cycript.tab.hh Parser.hpp Pooling.hpp
53 $(target)g++ $(flags) -c -o $@ $<
54
55lex.cy.o: lex.cy.c Cycript.tab.hh Parser.hpp Pooling.hpp
56 $(target)g++ $(flags) -c -o $@ $<
57
58%.o: %.cpp $(header)
59 $(target)g++ $(flags) -c -o $@ $<
60
61%.o: %.mm $(header)
62 $(target)g++ $(flags) -c -o $@ $<
63
64cyrver: Server.o
65 $(target)g++ $(flags) -o $@ $(filter %.o,$^) \
66 -lobjc -lapr-1 -lsubstrate \
67 -framework CoreFoundation -framework CFNetwork
68 ldid -S $@
69
70Cycript.dylib: Connector.o
71 $(target)g++ $(flags) -dynamiclib -o $@ $(filter %.o,$^) \
72 -lobjc -lapr-1 -lsubstrate \
73 -framework CoreFoundation
74 ldid -S $@
75
76libcycript.dylib: ffi_type.o parse.o Output.o Cycript.tab.o lex.cy.o Library.o
77 $(target)g++ $(flags) -dynamiclib -o $@ $(filter %.o,$^) \
78 -install_name /usr/lib/libcycript.dylib \
79 -lobjc -lapr-1 -lffi -lsubstrate \
80 -framework CoreFoundation -framework Foundation \
81 -framework CFNetwork \
82 -framework JavaScriptCore -framework WebCore
83 ldid -S $@
84
85cycript: Console.o libcycript.dylib
86 $(target)g++ $(flags) -o $@ $(filter %.o,$^) \
87 -lobjc -lapr-1 -lreadline \
88 -L. -lcycript \
89 -framework Foundation -framework CoreFoundation \
90 -framework JavaScriptCore -framework UIKit
91 ldid -S cycript
92
93$(deb): $(all)
94 rm -rf package
95 mkdir -p package/DEBIAN
96 sed -e 's/#/$(svn)/' control >package/DEBIAN/control
97 mkdir -p package/System/Library/LaunchDaemons
98 cp -a com.saurik.Cyrver.plist package/System/Library/LaunchDaemons
99 mkdir -p package/Library/MobileSubstrate/DynamicLibraries
100 if [[ -e Settings.plist ]]; then \
101 mkdir -p package/Library/PreferenceLoader/Preferences; \
102 cp -a Settings.png package/Library/PreferenceLoader/Preferences/CycriptIcon.png; \
103 cp -a Settings.plist package/Library/PreferenceLoader/Preferences/Cycript.plist; \
104 fi
105 if [[ -e Tweak.plist ]]; then cp -a Tweak.plist package/Library/MobileSubstrate/DynamicLibraries/Cycript.plist; fi
106 cp -a Cycript.dylib package/Library/MobileSubstrate/DynamicLibraries
107 mkdir -p package/usr/{bin,lib,sbin}
108 cp -a libcycript.dylib package/usr/lib
109 cp -a cycript package/usr/bin
110 #cp -a cyrver package/usr/sbin
111 cp -a libcycript.plist package/usr/lib
112 dpkg-deb -b package $(deb)
113
114package: $(deb)
115
116test: $(deb)
117 dpkg -i $(deb)
118 cycript test.cy
119
120.PHONY: all clean extra package