]> git.saurik.com Git - cycript.git/blame_incremental - makefile
Actually finished using the real apr_getopt API.
[cycript.git] / makefile
... / ...
CommitLineData
1ifndef PKG_TARG
2target :=
3else
4target := $(PKG_TARG)-
5endif
6
7#flags := -g3 -O0 -DYYDEBUG=1
8flags := -g0 -O3
9flags += -Wall -Werror -Wno-parentheses -I. -fno-common
10flags += -I$(shell apr-1-config --includedir)
11
12svn := $(shell svnversion)
13
14all:
15all := libcycript.plist cycript
16
17dpkg_architecture := $(shell which dpkg-architecture 2>/dev/null)
18ifneq ($(dpkg_architecture),)
19arch := $(shell $(dpkg_architecture) -qDEB_HOST_ARCH 2>/dev/null)
20endif
21
22header := Cycript.tab.hh Parser.hpp Pooling.hpp cycript.hpp
23code := ffi_type.o parse.o
24code += Replace.o Output.o
25code += Cycript.tab.o lex.cy.o
26code += Network.o Parser.o
27
28filters := C
29ldid := echo
30dll := so
31apr := $(shell apr-1-config --link-ld)
32library := $(apr) -lffi
33console := $(apr) -lreadline
34
35uname_s := $(shell uname -s)
36uname_p := $(shell uname -p)
37-include $(uname_s).mk
38-include $(uname_s)-$(uname_p).mk
39
40all += libcycript.$(dll)
41
42ifdef arch
43deb := $(shell grep ^Package: control | cut -d ' ' -f 2-)_$(shell grep ^Version: control | cut -d ' ' -f 2 | sed -e 's/\#/$(svn)/')_$(arch).deb
44
45all: $(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
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)
67endif
68
69all: $(all)
70
71clean:
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
73
74libcycript.plist: Bridge.def
75 { \
76 echo '({'; \
77 grep '^[CFV]' Bridge.def | sed -e 's/^C/0/;s/^F/1/;s/^V/2/' | sed -e 's/"/\\"/g;s/^\([^ ]*\) \([^ ]*\) \(.*\)$$/\2 = (\1, \"\3\");/'; \
78 echo '},{'; \
79 grep '^:' Bridge.def | sed -e 's/^: \([^ ]*\) \(.*\)/"\1" = "\2";/'; \
80 echo '},{'; \
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\");/'; \
82 echo '})'; \
83 } >$@
84
85Cycript.y: Cycript.y.in
86 ./Filter.sh <$< >$@ $(filters)
87
88Cycript.tab.cc Cycript.tab.hh location.hh position.hh: Cycript.y
89 bison -v --report=state $<
90
91lex.cy.c: Cycript.l
92 flex $<
93
94#Parser.hpp: Parser.py Parser.dat
95# ./Parser.py <Parser.dat >$@
96
97%.o: sig/%.cpp
98 $(target)g++ $(flags) -c -o $@ $<
99
100Cycript.tab.o: Cycript.tab.cc Cycript.tab.hh Parser.hpp Pooling.hpp
101 $(target)g++ $(flags) -c -o $@ $<
102
103lex.cy.o: lex.cy.c Cycript.tab.hh Parser.hpp Pooling.hpp
104 $(target)g++ $(flags) -c -o $@ $<
105
106%.o: %.cpp $(header)
107 $(target)g++ $(flags) -c -o $@ $<
108
109%.o: %.mm $(header)
110 $(target)g++ $(flags) -c -o $@ $<
111
112libcycript.$(dll): $(code)
113 $(target)g++ $(flags) -shared -dynamiclib -o $@ $(filter %.o,$^) $(library) $(link)
114 $(ldid) -S $@
115
116cycript: Console.o libcycript.$(dll)
117 $(target)g++ $(flags) -o $@ $(filter %.o,$^) -L. -lcycript $(console) $(link)
118 $(ldid) -S cycript
119
120package: $(deb)
121
122test: $(deb)
123 dpkg -i $(deb)
124 cycript test.cy
125
126.PHONY: all clean extra package