- cp -a control package/DEBIAN
- mkdir -p package/Library/MobileSubstrate/DynamicLibraries
- if [[ -e Settings.plist ]]; then \
- mkdir -p package/Library/PreferenceLoader/Preferences; \
- cp -a Settings.png package/Library/PreferenceLoader/Preferences/CycriptIcon.png; \
- cp -a Settings.plist package/Library/PreferenceLoader/Preferences/Cycript.plist; \
- fi
- if [[ -e Tweak.plist ]]; then cp -a Tweak.plist package/Library/MobileSubstrate/DynamicLibraries/Cycript.plist; fi
- #cp -a Cycript.dylib package/Library/MobileSubstrate/DynamicLibraries
- mkdir -p package/usr/{bin,lib}
- cp -a libcycript.dylib package/usr/lib
- #ln -s /usr/lib/libcycript.dylib package/Library/MobileSubstrate/DynamicLibraries/Cycript.dylib
- cp -a cycript package/usr/bin
- cp -a libcycript.plist package/usr/lib
- dpkg-deb -b package $(shell grep ^Package: control | cut -d ' ' -f 2-)_$(shell grep ^Version: control | cut -d ' ' -f 2)_iphoneos-arm.deb
-
-test: package
- dpkg -i $(shell grep ^Package: control | cut -d ' ' -f 2-)_$(shell grep ^Version: control | cut -d ' ' -f 2)_iphoneos-arm.deb
- cycript
-
-.PHONY: all clean extra package
+ cp -pR control package/DEBIAN
+ mkdir -p package/usr/{bin,lib,sbin}
+ $(restart) extra
+ cp -pR $(lib)cycript.$(dll) package/usr/lib
+ cp -pR cycript package/usr/bin
+ #cp -pR cyrver package/usr/sbin
+ dpkg-deb -b package $(deb)
+endif
+
+all: $(all)
+
+clean::
+ rm -f *.o $(lib)cycript.$(dll) $(all) Struct.hpp lex.cy.c Cycript.tab.cc Cycript.tab.hh location.hh position.hh stack.hh cyrver Cycript.yy Cycript.l control Bridge.hpp Cycript.output
+
+%.yy: %.yy.in
+ ./Filter.sh <$< >$@ $(filters)
+
+%.l: %.l.in
+ ./Filter.sh <$< >$@ $(filters)
+
+Cycript.tab.cc Cycript.tab.hh location.hh position.hh: Cycript.yy
+ bison -v --report=state $<
+
+lex.cy.c: Cycript.l
+ flex -t $< | sed -e 's/int yyl;/yy_size_t yyl;/;s/int yyleng_r;/yy_size_t yyleng_r;/' >$@
+
+#Parser.hpp: Parser.py Parser.dat
+# ./Parser.py <Parser.dat >$@
+
+Cycript.tab.o: Cycript.tab.cc $(header)
+ $(target)$(gcc) $(flags) -c -o $@ $<
+
+lex.cy.o: lex.cy.c $(header)
+ $(target)$(gcc) $(flags) -c -o $@ $<
+
+%.o: %.cpp $(header)
+ $(target)$(gcc) $(flags) -c -o $@ $<
+
+#objc := -x c++
+%.o: %.mm $(header)
+ $(target)$(gcc) $(objc) $(flags) -c -o $@ $<
+
+$(lib)cycript.$(dll): $(code)
+ $(target)$(gcc) $(flags) -shared -dynamiclib -o $@ $(filter %.o,$^) $(library) $(link)
+ $(ldid) $@
+
+cycript: Console.o $(lib)cycript.$(dll) $(inject)
+ $(target)$(gcc) $(flags) -o $@ $(filter %.o,$^) -L. -lcycript $(console) $(link)
+ $(entitle) cycript
+
+package: $(deb)
+
+test: $(deb)
+ dpkg -i $(deb)
+ if [[ -e target.cy ]]; then cycript -c target.cy && echo; fi
+ if [[ -e jquery.js ]]; then /usr/bin/time cycript -c jquery.js >jquery.cyc.js; gzip -9c jquery.cyc.js >jquery.cyc.js.gz; wc -c jquery.{mam,gcc,cyc,bak,yui}.js; wc -c jquery.{cyc,gcc,bak,mam,yui}.js.gz; fi
+ if [[ -e test.cy ]]; then cycript test.cy; fi
+
+install: cycript $(lib)cycript.$(dll)
+ cp -p cycript /usr/bin
+ cp -p $(lib)cycript.$(dll) /usr/lib
+
+.PHONY: all clean extra package control.tmp