flags := -mthumb -g3 -O0 -Wall -Werror -I. -fno-common
flags += -F${PKG_ROOT}/System/Library/PrivateFrameworks
+svn := $(shell svnversion)
+deb := $(shell grep ^Package: control | cut -d ' ' -f 2-)_$(shell grep ^Version: control | cut -d ' ' -f 2 | sed -e 's/\#/$(svn)/')_iphoneos-arm.deb
+
all: cycript libcycript.dylib libcycript.plist
clean:
libcycript.plist: Bridge.def
{ \
- sed -e 's/^C/0/;s/^F/1/;s/^V/2/' Bridge.def | while read -r line; do \
+ echo '({'; \
+ grep '^[CFV]' Bridge.def | sed -e 's/^C/0/;s/^F/1/;s/^V/2/' | while read -r line; do \
if [[ $$line == '' ]]; then \
continue; \
fi; \
set $$line; \
- if [[ $$1 =~ [#fl:] ]]; then \
- continue; \
- fi; \
- echo "$$2 = ($$1, \"$$3\");"; \
+ echo "$$2 = ($$1, \"$${3//\"/\\\"}\");"; \
+ done; \
+ echo '},{'; \
+ grep '^:' Bridge.def | sed -e 's/^: \([^ ]*\) \(.*\)/"\1" = "\2";/'; \
+ echo '},{'; \
+ grep '^S' Bridge.def | sed -e 's/^S/0/' | while read -r line; do \
+ set $$line; \
+ echo "$$2 = ($$1, \"$${3//\"/\\\"}\");"; \
done; \
- grep ^: Bridge.def | sed -e 's/^: \([^ ]*\) \(.*\)/":\1" = "\2";/'; \
+ echo '})'; \
} >$@
Cycript.tab.cc Cycript.tab.hh location.hh position.hh: Cycript.y
Library.o: Library.mm Cycript.tab.hh Parser.hpp Pooling.hpp Struct.hpp cycript.hpp
$(target)g++ $(flags) -c -o $@ $<
-Application.o: Application.cpp Cycript.tab.hh Parser.hpp Pooling.hpp cycript.hpp
+Application.o: Application.mm Cycript.tab.hh Parser.hpp Pooling.hpp cycript.hpp
$(target)g++ $(flags) -c -o $@ $<
libcycript.dylib: ffi_type.o parse.o Output.o Cycript.tab.o lex.cy.o Library.o
package: all
rm -rf package
mkdir -p package/DEBIAN
- cp -a control package/DEBIAN
+ sed -e 's/#/$(svn)/' control >package/DEBIAN/control
mkdir -p package/Library/MobileSubstrate/DynamicLibraries
if [[ -e Settings.plist ]]; then \
mkdir -p package/Library/PreferenceLoader/Preferences; \
#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
+ dpkg-deb -b package $(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 /Applications/HelloCycript.app/HelloCycript
+ dpkg -i $(deb)
+ cycript test.cy
.PHONY: all clean extra package